* Use camelCase policy when serializing enums * Revert "Use camelCase policy when serializing enums" This reverts commit 467f49d8734bcbd6aabb87447fbd7d21840c4c48. * Add jonSerializerOptions to GenericClient * Add jsonSerializerOptions param * Revert pass deserialization options in GenericClient * Add JsonSerializerOptions to KubernetesClientConfiguration * Use user JsonSerializerOptions in SendRequest and CreateResultAsync * Improve comment * Remove JsonSerializerOptions * Cosmetic * Add AddJsonOptions * Fix example * Fix test * Add test * Add summary * Improve summary * Remove configure from Kubernetes ctor and tests * Add AddJsonOptions to config and test * Support per client json serializer options * Add ConfigureAwait for tests * Check for nullargument
30 lines
808 B
C#
Executable File
30 lines
808 B
C#
Executable File
using k8s;
|
|
using Prometheus;
|
|
using System;
|
|
using System.Threading;
|
|
|
|
namespace prom
|
|
{
|
|
internal class Prometheus
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
var config = KubernetesClientConfiguration.BuildDefaultConfig();
|
|
var handler = new PrometheusHandler();
|
|
IKubernetes client = new Kubernetes(config, handler);
|
|
|
|
var server = new MetricServer(hostname: "localhost", port: 1234);
|
|
server.Start();
|
|
|
|
Console.WriteLine("Making requests!");
|
|
while (true)
|
|
{
|
|
client.CoreV1.ListNamespacedPod("default");
|
|
client.CoreV1.ListNode();
|
|
client.AppsV1.ListNamespacedDeployment("default");
|
|
Thread.Sleep(1000);
|
|
}
|
|
}
|
|
}
|
|
}
|