/// <summary> /// Finds a resource by its metadata.name property. /// </summary> /// <exception cref="KeyNotFoundException">No element in the store has the given <paramref name="name"/>.</exception> public static TResource FindByName <TResource>(this ICustomResourceWatcher <TResource> watcher, string name) where TResource : CustomResource { var customResource = watcher.FirstOrDefault(res => res.Metadata.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); if (customResource == null) { throw new KeyNotFoundException($"No such resource '{name}'"); } return(customResource); }
public ResourceController(IServiceProvider serviceProvider, ILogger <ResourceController> logger, IKubernetes kubernetesClient, ICustomResourceWatcher <Test> crdWatcher) { this.ServiceProvider = serviceProvider; this.Logger = logger; this.KubernetesClient = kubernetesClient; this.CrdWatcher = crdWatcher; }
public KubernetesCorsPolicyService(ILogger <KubernetesCorsPolicyService> logger, ICustomResourceWatcher <ClientResource> clientWatcher) : base(logger, clientWatcher.RawResources.Select(client => EnsureWellFormedAllowedCorsOrigins(client, logger))) { }
public KubernetesCorsPolicyService(ILogger <KubernetesCorsPolicyService> logger, ICustomResourceWatcher <ClientResource> clientWatcher) : base(logger, clientWatcher.Select(resource => GetClient(resource, logger))) { }
public KubernetesClientStore(ICustomResourceWatcher <ClientResource> clientWatcher) : base(clientWatcher.RawResources.Select(resource => resource.Spec)) { }
public KubernetesClientStore(ICustomResourceWatcher <ClientResource> clientWatcher) : base(clientWatcher.Select(GetClient)) { }
public KubernetesClientStore(ICustomResourceWatcher <ClientResource> clientWatcher, ILogger <KubernetesClientStore> logger) : base(Filter(clientWatcher, logger)) { }
/// <summary> /// Finds all resources by its metadata.name property. /// </summary> /// <returns>Empty enumerable if nothing found.</returns> public static IEnumerable <TResource> FindByNamespace <TResource>(this ICustomResourceWatcher <TResource> watcher, string @namespace) where TResource : CustomResource => watcher.Where(res => res.Metadata.Namespace.Equals(@namespace, StringComparison.InvariantCultureIgnoreCase));
public KubernetesResourceStore(IEnumerable <IdentityResource> identityResources, ICustomResourceWatcher <ApiResourceResource> apiResourceWatcher) : base(identityResources, apiResourceWatcher.RawResources.Select(resource => resource.Spec)) { }
public KubernetesResourceStore(ILogger<KubernetesResourceStore> logger, ICustomResourceWatcher<IdentityResourceResource> identityResourceWatcher, ICustomResourceWatcher<ApiResourceResource> apiResourceWatcher, IEnumerable<IdentityResource> defaultIdentityResources = null) : base( logger, identityResourceWatcher.Select(GetIdentityResource).Concat(defaultIdentityResources ?? Enumerable.Empty<IdentityResource>()), apiResourceWatcher.Select(GetApiResource)) {}