/// <summary> /// Initializes a new <see cref="CustomResource"/> /// </summary> /// <param name="definition">The <see cref="CustomResource"/>'s definition</param> protected CustomResource(ICustomResourceDefinition definition) { if (definition == null) { throw new ArgumentNullException(nameof(definition)); } this.Definition = definition; this.Kind = this.Definition.Kind; this.ApiVersion = this.Definition.ApiVersion; }
/// <summary> /// Initializes a new <see cref="CustomResource"/> /// </summary> /// <param name="definition">The <see cref="CustomResource"/>'s definition</param> protected CustomResource(ICustomResourceDefinition definition) : base(definition) { }
/// <inheritdoc/> public virtual ICustomResourceEventWatcher <TResource> CreateController <TResource>(ICustomResourceDefinition resourceDefinition, CustomResourceEventDelegate <TResource> eventHandler, string ns = null) where TResource : ICustomResource { ICustomResourceEventWatcher <TResource> controller = ActivatorUtilities.CreateInstance <CustomResourceEventWatcher <TResource> >(this.ServiceProvider, resourceDefinition, eventHandler, ns); return(controller); }
/// <summary> /// Initializes a new <see cref="ICustomResourceEventWatcher{TResource}"/>. /// </summary> /// <param name="logger">The service used to perform logging</param> /// <param name="kubernetesClient">The service used to communicate with Kubernetes.</param> /// <param name="resourceDefinition">The <see cref="ICustomResourceDefinition"/> of the <see cref="ICustomResource"/> type to to listen the Kubernetes events for.</param> /// <param name="namespaceProperty">The namespace in which to listen for Kubernetes events for the specified <see cref="ICustomResource"/> type. If null or empty, the controller will listen for cluster-wide events instead.</param> /// <param name="eventHandler">The <see cref="CustomResourceEventDelegate{TResource}"/> to invoke whenever a Kubernetes event for the specified <see cref="ICustomResource"/> type is received.</param> public CustomResourceEventWatcher(ILogger <CustomResourceEventWatcher <TResource> > logger, IKubernetes kubernetesClient, ICustomResourceDefinition resourceDefinition, string namespaceProperty, CustomResourceEventDelegate <TResource> eventHandler) { this.Logger = logger; this.KubernetesClient = kubernetesClient; this.ResourceDefinition = resourceDefinition; this.Namespace = namespaceProperty; this.EventHandler = eventHandler; }