add generic create (#744)

* add generic create

* flaky test on test env
This commit is contained in:
Boshi Lian
2021-11-12 12:06:28 -08:00
committed by GitHub
parent 4ff1ea49b8
commit f515fb4d76
4 changed files with 127 additions and 18 deletions

View File

@@ -10,11 +10,12 @@ namespace exec
private static async Task Main(string[] args)
{
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
var generic = new GenericClient(config, "", "v1", "nodes");
IKubernetes client = new Kubernetes(config);
var generic = new GenericClient(client, "", "v1", "nodes");
var node = await generic.ReadAsync<V1Node>("kube0").ConfigureAwait(false);
Console.WriteLine(node.Metadata.Name);
var genericPods = new GenericClient(config, "", "v1", "pods");
var genericPods = new GenericClient(client, "", "v1", "pods");
var pods = await genericPods.ListNamespacedAsync<V1PodList>("default").ConfigureAwait(false);
foreach (var pod in pods.Items)
{