示例#1
0
        public static async Task Run(KubernetesClientConfiguration config)
        {
            var crd = new CustomResourceDefinition()
            {
                ApiVersion = "engineerd.dev/v1alpha1",
                PluralName = "examples",
                Kind       = "Example",
                Namespace  = "default"
            };

            var controller = new Controller <ExampleCRD>(
                new Kubernetes(config),
                crd,
                (WatchEventType eventType, ExampleCRD example) =>
            {
                Console.WriteLine("Event type: {0} for {1}", eventType, example.Metadata.Name);
            });

            var cts = new CancellationTokenSource();
            await controller.StartAsync(cts.Token).ConfigureAwait(false);
        }
示例#2
0
 public Controller(Kubernetes client, CustomResourceDefinition crd, Handle handle)
 {
     _client = client;
     _crd    = crd;
     _handle = handle;
 }