fix tests and examples to use v1.8 model

This commit is contained in:
Boshi Lian
2017-11-24 12:19:44 +08:00
parent b102bc63bd
commit f7c0aa34d3
8 changed files with 42 additions and 41 deletions

View File

@@ -54,7 +54,7 @@ namespace @namespace
ListNamespaces(client);
var ns = new Corev1Namespace
var ns = new V1Namespace
{
Metadata = new V1ObjectMeta
{
@@ -71,7 +71,7 @@ namespace @namespace
if (status.HasObject)
{
var obj = status.ObjectView<Corev1Namespace>();
var obj = status.ObjectView<V1Namespace>();
Console.WriteLine(obj.Status.Phase);
Delete(client, ns.Metadata.Name, 3 * 1000);

View File

@@ -1,22 +1,23 @@
using System;
using k8s;
namespace simple
{
using System;
using System.IO;
using k8s;
class PodList
internal class PodList
{
static void Main(string[] args)
private static void Main(string[] args)
{
var k8sClientConfig = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(k8sClientConfig);
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(config);
Console.WriteLine("Starting Request!");
var listTask = client.ListNamespacedPodWithHttpMessagesAsync("default").Result;
var list = listTask.Body;
foreach (var item in list.Items) {
var list = client.ListNamespacedPod("default");
foreach (var item in list.Items)
{
Console.WriteLine(item.Metadata.Name);
}
if (list.Items.Count == 0) {
if (list.Items.Count == 0)
{
Console.WriteLine("Empty!");
}
}

View File

@@ -14,7 +14,7 @@ namespace watch
IKubernetes client = new Kubernetes(config);
var podlistResp = client.ListNamespacedPodWithHttpMessagesAsync("default", watch: true).Result;
using (podlistResp.Watch<Corev1Pod>((type, item) =>
using (podlistResp.Watch<V1Pod>((type, item) =>
{
Console.WriteLine("==on watch event==");
Console.WriteLine(type);