Class KubernetesExtensions
Kubernetes related extension methods.
Namespace: Neon.Kube.K8s
Assembly: Neon.Kube.dll
Syntax
public static class KubernetesExtensions
Methods
CreateClusterCustomObjectAsync<T>(ICustomObjectsOperations, T, string, string, string, CancellationToken)
Create a cluster scoped custom object.
Declaration
public static Task<T> CreateClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T body, string name, string dryRun = null, string fieldManager = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | body | The object data. |
string | name | Specifies the object name. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The new object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
CreateNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, T, string, string, string, string, CancellationToken)
Create a namespaced custom object.
Declaration
public static Task<T> CreateNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T body, string name, string namespaceParameter, string dryRun = null, string fieldManager = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | body | The object data. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The new object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
CreateNamespacedTypedConfigMapAsync<TConfigMapData>(ICoreV1Operations, TypedConfigMap<TConfigMapData>, CancellationToken)
Creates a namespace scoped typed configmap.
Declaration
public static Task<TypedConfigMap<TConfigMapData>> CreateNamespacedTypedConfigMapAsync<TConfigMapData>(this ICoreV1Operations k8sCoreV1, TypedConfigMap<TConfigMapData> typedConfigMap, CancellationToken cancellationToken = default) where TConfigMapData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
Typed |
typedConfigMap | Specifies the typed configmap. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The new Typed |
Type Parameters
Name | Description |
---|---|
TConfigMapData | Specifies the configmap data type. |
Remarks
Typed configmaps are V1Config
CreateNamespacedTypedSecretAsync<TSecretData>(ICoreV1Operations, TypedSecret<TSecretData>, CancellationToken)
Creates a namespace scoped typed secret.
Declaration
public static Task<TypedSecret<TSecretData>> CreateNamespacedTypedSecretAsync<TSecretData>(this ICoreV1Operations k8sCoreV1, TypedSecret<TSecretData> typedSecret, CancellationToken cancellationToken = default) where TSecretData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
Typed |
typedSecret | Specifies the typed secret. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The new Typed |
Type Parameters
Name | Description |
---|---|
TSecretData | Specifies the secret data type. |
Remarks
Typed secrets are V1Secret objects that wrap a strongly typed
object formatted using the Typed
DeleteClusterCustomObjectAsync<T>(ICustomObjectsOperations, string, V1DeleteOptions, int?, bool?, string, string, CancellationToken)
Deletes a namespace scoped custom object of the specified generic object type, and doesn't throw any exceptions if the object doesn't exist.
Declaration
public static Task DeleteClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, string name, V1DeleteOptions body = null, int? gracePeriodSeconds = null, bool? orphanDependents = null, string propagationPolicy = null, string dryRun = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | name | Specifies the object name. |
V1Delete |
body | Optionally specifies deletion options. |
int? | gracePeriodSeconds | Optionally specifies the duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. |
bool? | orphanDependents | Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. |
string | propagationPolicy | Optionally specifies ehether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. |
string | dryRun | Optionally specifies that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
DeleteClusterCustomObjectAsync<T>(ICustomObjectsOperations, T, V1DeleteOptions, int?, bool?, string, string, CancellationToken)
Deletes a namespace scoped custom object of the specified generic object type, and doesn't throw any exceptions if the object doesn't exist.
Declaration
public static Task DeleteClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T @object, V1DeleteOptions body = null, int? gracePeriodSeconds = null, bool? orphanDependents = null, string propagationPolicy = null, string dryRun = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | object | Specifies the object being deleted. |
V1Delete |
body | Optionally specifies deletion options. |
int? | gracePeriodSeconds | Optionally specifies the duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. |
bool? | orphanDependents | Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. |
string | propagationPolicy | Optionally specifies ehether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. |
string | dryRun | Optionally specifies that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
DeleteNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, string, string, V1DeleteOptions, int?, bool?, string, string, CancellationToken)
Deletes a namespace scoped custom object of the specified generic object type, nanmespace, and name and doesn't throw any exceptions if the object doesn't exist.
Declaration
public static Task DeleteNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, string name, string namespaceParameter, V1DeleteOptions body = null, int? gracePeriodSeconds = null, bool? orphanDependents = null, string propagationPolicy = null, string dryRun = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | name | Specifies the object name. |
string | namespaceParameter | Specifies the target Kubernetes namespace. |
V1Delete |
body | Optionally specifies deletion options. |
int? | gracePeriodSeconds | Optionally specifies the duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. |
bool? | orphanDependents | Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. |
string | propagationPolicy | Optionally specifies ehether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. |
string | dryRun | Optionally specifies that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
DeleteNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, string, T, V1DeleteOptions, int?, bool?, string, string, CancellationToken)
Deletes a namespace scoped custom object passed, and name and doesn't throw any exceptions if the object doesn't exist.
Declaration
public static Task DeleteNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, string namespaceParameter, T @object, V1DeleteOptions body = null, int? gracePeriodSeconds = null, bool? orphanDependents = null, string propagationPolicy = null, string dryRun = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | namespaceParameter | Specifies the target Kubernetes namespace. |
T | object | Specifies the object being deleted. |
V1Delete |
body | Optionally specifies deletion options. |
int? | gracePeriodSeconds | Optionally specifies the duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately. |
bool? | orphanDependents | Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the "orphan" finalizer will be added to/removed from the object's finalizers list. Either this field or PropagationPolicy may be set, but not both. |
string | propagationPolicy | Optionally specifies ehether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. |
string | dryRun | Optionally specifies that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
DeleteNamespacedTypedConfigMapAsync(ICoreV1Operations, string, string, CancellationToken)
Deletes a namespaced typed configmap.
Declaration
public static Task DeleteNamespacedTypedConfigMapAsync(this ICoreV1Operations k8sCoreV1, string name, string namespaceParameter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Remarks
Typed configmaps are V1Config
DeleteNamespacedTypedSecretAsync(ICoreV1Operations, string, string, CancellationToken)
Deletes a namespaced typed secret.
Declaration
public static Task DeleteNamespacedTypedSecretAsync(this ICoreV1Operations k8sCoreV1, string name, string namespaceParameter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Remarks
Typed secrets are V1Secret objects that wrap a strongly typed
object formatted using the Typed
GetLabel(V1ObjectMeta, string)
Fetches the value of a label from the metadata.
Declaration
public static string GetLabel(this V1ObjectMeta metadata, string name)
Parameters
Type | Name | Description |
---|---|---|
V1Object |
metadata | The metadata instance. |
string | name | The label name. |
Returns
Type | Description |
---|---|
string | The label value or |
GetNamespacedRunningPodAsync(ICoreV1Operations, string, string)
Returns a running pod within the specified namespace that matches a label selector.
Declaration
public static Task<V1Pod> GetNamespacedRunningPodAsync(this ICoreV1Operations k8sCoreV1, string namespaceParameter, string labelSelector)
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
string | namespaceParameter | Specifies the namespace hosting the pod. |
string | labelSelector | Specifies the label selector to constrain the set of pods to be targeted. This is required. |
Returns
Exceptions
Type | Condition |
---|---|
Kubernetes |
Thrown when no healthy pods exist. |
Get<T>(List<NamedExtension>, string, T)
Searches extensions
for an extension with the name passed and
returns its value when found, otherwise returns default
.
Declaration
public static T Get<T>(this List<NamedExtension> extensions, string name, T @default)
Parameters
Type | Name | Description |
---|---|---|
List<Named |
extensions | Holds the extensions. |
string | name | Specifies the extension name. |
T | default | The value to be returned when the extension doesn't exist. |
Returns
Type | Description |
---|---|
T | The extension value when found, otherwise |
Type Parameters
Name | Description |
---|---|
T | Specifies the property value type. |
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown when the extension value cannot be cast to |
ListAllPodsAsync(ICoreV1Operations)
Lists pods from all cluster namespaces.
Declaration
public static Task<V1PodList> ListAllPodsAsync(this ICoreV1Operations k8sCoreV1)
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The IKubernetes instance. |
Returns
ListClusterCustomObjectAsync<T>(ICustomObjectsOperations, bool?, string, string, string, int?, string, string, int?, bool?, CancellationToken)
List or watch cluster scoped custom objects, deserializing them into the specified generic type.
Declaration
public static Task<V1CustomObjectList<T>> ListClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, bool? allowWatchBookmarks = null, string continueParameter = null, string fieldSelector = null, string labelSelector = null, int? limit = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, bool? watch = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
bool? | allowWatchBookmarks | allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. |
string | continueParameter | The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. |
string | fieldSelector | A selector to restrict the list of returned objects by their fields. Defaults to everything. |
string | labelSelector | A selector to restrict the list of returned objects by their labels. Defaults to everything. |
int? | limit | limit is a maximum number of responses to return for a list call. If more items
exist, the server will set the |
string | resourceVersion | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. |
string | resourceVersionMatch | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset |
int? | timeoutSeconds | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. |
bool? | watch | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<V1Custom |
The deserialized object list. |
Type Parameters
Name | Description |
---|---|
T | The custom object list type. |
ListClusterCustomObjectMetadataAsync(ICustomObjectsOperations, string, string, string, bool?, string, string, string, int?, string, string, int?, bool?, CancellationToken)
List or watch cluster scoped custom objects by group, version, and plural name, deserializing them into
Kubernetes
Declaration
public static Task<V1CustomObjectList<KubernetesObjectMetadata>> ListClusterCustomObjectMetadataAsync(this ICustomObjectsOperations k8s, string group, string version, string plural, bool? allowWatchBookmarks = null, string continueParameter = null, string fieldSelector = null, string labelSelector = null, int? limit = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, bool? watch = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | group | The custom resource's group name |
string | version | The custom resource's version |
string | plural | The custom resource's plural name. For TPRs this would be lowercase plural kind. |
bool? | allowWatchBookmarks | allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. |
string | continueParameter | The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. |
string | fieldSelector | A selector to restrict the list of returned objects by their fields. Defaults to everything. |
string | labelSelector | A selector to restrict the list of returned objects by their labels. Defaults to everything. |
int? | limit | limit is a maximum number of responses to return for a list call. If more items
exist, the server will set the |
string | resourceVersion | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. |
string | resourceVersionMatch | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset |
int? | timeoutSeconds | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. |
bool? | watch | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<V1Custom |
The deserialized object list. |
ListClusterCustomObjectWithHttpMessagesAsync<T>(ICustomObjectsOperations, bool?, string, string, string, int?, string, string, int?, bool?, CancellationToken)
List or watch cluster scoped custom objects, deserializing them into the specified generic type.
Declaration
public static Task<HttpOperationResponse<object>> ListClusterCustomObjectWithHttpMessagesAsync<T>(this ICustomObjectsOperations k8s, bool? allowWatchBookmarks = null, string continueParameter = null, string fieldSelector = null, string labelSelector = null, int? limit = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, bool? watch = null, CancellationToken cancellationToken = default) where T : IKubernetesObject
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
bool? | allowWatchBookmarks | allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. |
string | continueParameter | The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. |
string | fieldSelector | A selector to restrict the list of returned objects by their fields. Defaults to everything. |
string | labelSelector | A selector to restrict the list of returned objects by their labels. Defaults to everything. |
int? | limit | limit is a maximum number of responses to return for a list call. If more items
exist, the server will set the |
string | resourceVersion | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. |
string | resourceVersionMatch | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset |
int? | timeoutSeconds | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. |
bool? | watch | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Http |
The deserialized object list. |
Type Parameters
Name | Description |
---|---|
T | The custom object list type. |
ListNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, string, bool?, string, string, string, int?, string, string, int?, bool?, CancellationToken)
List or watch namespaced custom objects, deserializing them into the specified generic type.
Declaration
public static Task<V1CustomObjectList<T>> ListNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, string namespaceParameter, bool? allowWatchBookmarks = null, string continueParameter = null, string fieldSelector = null, string labelSelector = null, int? limit = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, bool? watch = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | namespaceParameter | Specifies the namespace hosting the pod. |
bool? | allowWatchBookmarks | allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. |
string | continueParameter | The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. |
string | fieldSelector | A selector to restrict the list of returned objects by their fields. Defaults to everything. |
string | labelSelector | A selector to restrict the list of returned objects by their labels. Defaults to everything. |
int? | limit | limit is a maximum number of responses to return for a list call. If more items
exist, the server will set the |
string | resourceVersion | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. |
string | resourceVersionMatch | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset |
int? | timeoutSeconds | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. |
bool? | watch | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<V1Custom |
The deserialized object list. |
Type Parameters
Name | Description |
---|---|
T | The custom object list type. |
ListNamespacedCustomObjectMetadataAsync<T>(ICustomObjectsOperations, string, string, string, string, bool?, string, string, string, int?, string, string, int?, bool?, CancellationToken)
List or watch namespace scoped custom objects by group, version, and plural name, deserializing them into
Kubernetes
Declaration
public static Task<V1CustomObjectList<KubernetesObjectMetadata>> ListNamespacedCustomObjectMetadataAsync<T>(this ICustomObjectsOperations k8s, string namespaceParameter, string group, string version, string plural, bool? allowWatchBookmarks = null, string continueParameter = null, string fieldSelector = null, string labelSelector = null, int? limit = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, bool? watch = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | namespaceParameter | Specifies the namespace hosting the pod. |
string | group | The custom resource's group name |
string | version | The custom resource's version |
string | plural | The custom resource's plural name. For TPRs this would be lowercase plural kind. |
bool? | allowWatchBookmarks | allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. |
string | continueParameter | The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. |
string | fieldSelector | A selector to restrict the list of returned objects by their fields. Defaults to everything. |
string | labelSelector | A selector to restrict the list of returned objects by their labels. Defaults to everything. |
int? | limit | limit is a maximum number of responses to return for a list call. If more items
exist, the server will set the |
string | resourceVersion | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. |
string | resourceVersionMatch | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset |
int? | timeoutSeconds | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. |
bool? | watch | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<V1Custom |
The deserialized object list. |
Type Parameters
Name | Description |
---|---|
T |
ListNamespacedCustomObjectWithHttpMessagesAsync<T>(ICustomObjectsOperations, string, bool?, string, string, string, int?, string, string, int?, bool?, CancellationToken)
List or watch namespaced custom objects, deserializing them into the specified generic type.
Declaration
public static Task<HttpOperationResponse<object>> ListNamespacedCustomObjectWithHttpMessagesAsync<T>(this ICustomObjectsOperations k8s, string namespaceParameter, bool? allowWatchBookmarks = null, string continueParameter = null, string fieldSelector = null, string labelSelector = null, int? limit = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, bool? watch = null, CancellationToken cancellationToken = default) where T : IKubernetesObject
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | namespaceParameter | Specifies the namespace hosting the pod. |
bool? | allowWatchBookmarks | allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. |
string | continueParameter | The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. |
string | fieldSelector | A selector to restrict the list of returned objects by their fields. Defaults to everything. |
string | labelSelector | A selector to restrict the list of returned objects by their labels. Defaults to everything. |
int? | limit | limit is a maximum number of responses to return for a list call. If more items
exist, the server will set the |
string | resourceVersion | When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv. |
string | resourceVersionMatch | resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset |
int? | timeoutSeconds | Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. |
bool? | watch | Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Http |
The deserialized object list. |
Type Parameters
Name | Description |
---|---|
T | The custom object list type. |
NamespacedPodExecAsync(IKubernetes, string, string, string, string[], bool, CancellationToken)
Executes a command within a pod container.
Declaration
public static Task<ExecuteResponse> NamespacedPodExecAsync(this IKubernetes k8s, string name, string namespaceParameter, string container, string[] command, bool noSuccessCheck = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IKubernetes | k8s | The Neon. |
string | name | Specifies the target pod name. |
string | namespaceParameter | Specifies the namespace hosting the pod. |
string | container | Identifies the target container within the pod. |
string[] | command | Specifies the program and arguments to be executed. |
bool | noSuccessCheck | Optionally disables the Ensure |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Execute |
An Execute |
Exceptions
Type | Condition |
---|---|
Execute |
Thrown if the exit code isn't zero and |
NamespacedPodExecWithRetryAsync(IKubernetes, IRetryPolicy, string, string, string, string[], CancellationToken)
Executes a command within a pod container with a IRetry
Declaration
public static Task<ExecuteResponse> NamespacedPodExecWithRetryAsync(this IKubernetes k8s, IRetryPolicy retryPolicy, string name, string namespaceParameter, string container, string[] command, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IKubernetes | k8s | The Neon. |
IRetry |
retryPolicy | The IRetry |
string | name | Specifies the target pod name. |
string | namespaceParameter | Specifies the namespace hosting the pod. |
string | container | Identifies the target container within the pod. |
string[] | command | Specifies the program and arguments to be executed. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Execute |
An Execute |
Exceptions
Type | Condition |
---|---|
Execute |
Thrown if the exit code isn't zero. |
PatchClusterCustomObjectAsync<T>(ICustomObjectsOperations, V1Patch, string, string, string, bool?, CancellationToken)
Updates the spec of a cluster scoped custom object of the specified generic object type and name.
Declaration
public static Task<T> PatchClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, V1Patch patch, string name, string dryRun = null, string fieldManager = null, bool? force = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
V1Patch | patch | Specifies the patch to be applied to the object spec. This is typically a V1Patch instance but additional patch types may be supported in |
string | name | Specifies the object name. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
bool? | force | Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated custom object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
PatchClusterCustomObjectStatusAsync<T>(ICustomObjectsOperations, V1Patch, string, string, string, bool?, CancellationToken)
Updates the status of a cluster scoped custom object of the specified generic object type and name.
Declaration
public static Task<T> PatchClusterCustomObjectStatusAsync<T>(this ICustomObjectsOperations k8s, V1Patch patch, string name, string dryRun = null, string fieldManager = null, bool? force = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
V1Patch | patch | Specifies the patch to be applied to the object status. This is typically a V1Patch instance but additional patch types may be supported in |
string | name | Specifies the object name. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
bool? | force | Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated custom object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
PatchNamespacedCustomObjectStatusAsync<T>(ICustomObjectsOperations, V1Patch, string, string, string, string, bool?, CancellationToken)
Updates the status of a namespace scoped custom object of the specified generic object type and name.
Declaration
public static Task<T> PatchNamespacedCustomObjectStatusAsync<T>(this ICustomObjectsOperations k8s, V1Patch patch, string name, string namespaceParameter, string dryRun = null, string fieldManager = null, bool? force = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
V1Patch | patch | Specifies the patch to be applied to the object status. This is typically a V1Patch instance but additional patch types may be supported in |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
bool? | force | Force is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated custom object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. Note that this is passed as the entire custom object including its status. |
ReadClusterCustomObjectAsync<T>(ICustomObjectsOperations, string, CancellationToken)
Returns a cluster scoped custom object, deserialized as the specified generic object type.
Declaration
public static Task<T> ReadClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, string name, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | name | Specifies the object name. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The deserialized object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
ReadNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, string, string, CancellationToken)
Returns a namespaced custom object, deserialized as the specified generic object type.
Declaration
public static Task<T> ReadNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, string name, string namespaceParameter, CancellationToken cancellationToken = default) where T : IKubernetesObject, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The deserialized object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
ReadNamespacedTypedConfigMapAsync<TConfigMapData>(ICoreV1Operations, string, string, CancellationToken)
Retrieves a namespace scoped typed configmap.
Declaration
public static Task<TypedConfigMap<TConfigMapData>> ReadNamespacedTypedConfigMapAsync<TConfigMapData>(this ICoreV1Operations k8sCoreV1, string name, string namespaceParameter, CancellationToken cancellationToken = default) where TConfigMapData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The retrieved Typed |
Type Parameters
Name | Description |
---|---|
TConfigMapData | Specifies the configmap data type. |
Remarks
Typed configmaps are V1Config
ReadNamespacedTypedSecretAsync<TSecretData>(ICoreV1Operations, string, string, CancellationToken)
Retrieves a namespace scoped typed secret.
Declaration
public static Task<TypedSecret<TSecretData>> ReadNamespacedTypedSecretAsync<TSecretData>(this ICoreV1Operations k8sCoreV1, string name, string namespaceParameter, CancellationToken cancellationToken = default) where TSecretData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The retrieved Typed |
Type Parameters
Name | Description |
---|---|
TSecretData | Specifies the secret data type. |
Remarks
Typed secrets are V1Secret objects that wrap a strongly typed
object formatted using the Typed
Remove(List<NamedExtension>, string)
Removes a named extension if present.
Declaration
public static void Remove(this List<NamedExtension> extensions, string name)
Parameters
Type | Name | Description |
---|---|---|
List<Named |
extensions | Holds the extensions. |
string | name | Specifies the name of the extension being removed. |
ReplaceClusterCustomObjectAsync<T>(ICustomObjectsOperations, T, string, string, string, CancellationToken)
Replace a cluster scoped custom object of the specified generic object type.
Declaration
public static Task<T> ReplaceClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T body, string name, string dryRun = null, string fieldManager = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | body | Specifies the new object data. |
string | name | Specifies the object name. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
ReplaceNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, T, string, string, string, string, CancellationToken)
Replace a namespaced custom object of the specified generic object type.
Declaration
public static Task<T> ReplaceNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T body, string name, string namespaceParameter, string dryRun = null, string fieldManager = null, CancellationToken cancellationToken = default) where T : IKubernetesObject, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | body | Specifies the new object data. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
ReplaceNamespacedTypedConfigMapAsync<TConfigMapData>(ICoreV1Operations, TypedConfigMap<TConfigMapData>, CancellationToken)
Replaces an existing typed configmap.
Declaration
public static Task<TypedConfigMap<TConfigMapData>> ReplaceNamespacedTypedConfigMapAsync<TConfigMapData>(this ICoreV1Operations k8sCoreV1, TypedConfigMap<TConfigMapData> configmap, CancellationToken cancellationToken = default) where TConfigMapData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
Typed |
configmap | Specifies the replacement configmap data. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The updated Typed |
Type Parameters
Name | Description |
---|---|
TConfigMapData | Specifies the configmap data type. |
Remarks
note
This method calls Update() to ensure that the untyped configmap data is up-to-date before persisting the changes.
Typed configmaps are V1Config
ReplaceNamespacedTypedConfigMapAsync<TConfigMapData>(ICoreV1Operations, TConfigMapData, string, string, CancellationToken)
Replaces an existing typed configmap with new data.
Declaration
public static Task<TypedConfigMap<TConfigMapData>> ReplaceNamespacedTypedConfigMapAsync<TConfigMapData>(this ICoreV1Operations k8sCoreV1, TConfigMapData data, string name, string namespaceParameter, CancellationToken cancellationToken = default) where TConfigMapData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
TConfig |
data | Specifies the replacement configmap data. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The updated Typed |
Type Parameters
Name | Description |
---|---|
TConfigMapData | Specifies the configmap data type. |
Remarks
Typed configmaps are V1Config
ReplaceNamespacedTypedSecretAsync<TSecretData>(ICoreV1Operations, TypedSecret<TSecretData>, CancellationToken)
Replaces an existing typed secret.
Declaration
public static Task<TypedSecret<TSecretData>> ReplaceNamespacedTypedSecretAsync<TSecretData>(this ICoreV1Operations k8sCoreV1, TypedSecret<TSecretData> secret, CancellationToken cancellationToken = default) where TSecretData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
Typed |
secret | Specifies the replacement secret data. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The updated Typed |
Type Parameters
Name | Description |
---|---|
TSecretData | Specifies the secret data type. |
Remarks
note
This method calls Update() to ensure that the untyped secret data is up-to-date before persisting the changes.
Typed secret are V1Secret objects that wrap a strongly typed
object formatted using the Typed
ReplaceNamespacedTypedSecretAsync<TSecretData>(ICoreV1Operations, TSecretData, string, string, CancellationToken)
Replaces an existing typed secret with new data.
Declaration
public static Task<TypedSecret<TSecretData>> ReplaceNamespacedTypedSecretAsync<TSecretData>(this ICoreV1Operations k8sCoreV1, TSecretData data, string name, string namespaceParameter, CancellationToken cancellationToken = default) where TSecretData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
TSecret |
data | Specifies the replacement secret data. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The updated Typed |
Type Parameters
Name | Description |
---|---|
TSecretData | Specifies the secret data type. |
Remarks
Typed secrets are V1Secret objects that wrap a strongly typed
object formatted using the Typed
RestartAsync(V1DaemonSet, IKubernetes)
Restarts a V1Daemon
Declaration
public static Task RestartAsync(this V1DaemonSet daemonset, IKubernetes k8s)
Parameters
Type | Name | Description |
---|---|---|
V1Daemon |
daemonset | The daemonset being restarted. |
IKubernetes | k8s | The IKubernetes client to be used for the operation. |
Returns
RestartAsync(V1Deployment, IKubernetes)
Restarts a V1Deployment.
Declaration
public static Task RestartAsync(this V1Deployment deployment, IKubernetes k8s)
Parameters
Type | Name | Description |
---|---|---|
V1Deployment | deployment | The target deployment. |
IKubernetes | k8s | The IKubernetes client to be used for the operation. |
Returns
RestartAsync(V1StatefulSet, IKubernetes)
Restarts a V1Stateful
Declaration
public static Task RestartAsync(this V1StatefulSet statefulset, IKubernetes k8s)
Parameters
Type | Name | Description |
---|---|---|
V1Stateful |
statefulset | The deployment being restarted. |
IKubernetes | k8s | The IKubernetes client to be used for the operation. |
Returns
SetLabel(V1ObjectMeta, string, string)
Sets a label within the metadata, constructing the label dictionary when necessary.
Declaration
public static void SetLabel(this V1ObjectMeta metadata, string name, string value = null)
Parameters
Type | Name | Description |
---|---|---|
V1Object |
metadata | The metadata instance. |
string | name | The label name. |
string | value | Optionally specifies a label value. This defaults to an empty string. |
SetLabels(V1ObjectMeta, Dictionary<string, string>)
Sets a collection of labels within the metadata, constructing the label dictionary when necessary.
Declaration
public static void SetLabels(this V1ObjectMeta metadata, Dictionary<string, string> labels)
Parameters
Type | Name | Description |
---|---|---|
V1Object |
metadata | The metadata instance. |
Dictionary<string, string> | labels | The dictionary of labels to set. |
SetMetadata(IKubernetesObject)
Initializes a custom Kubernetes object's metadata Group, ApiVersion, and
Kind properties from the Kubernetes
Declaration
public static void SetMetadata(this IKubernetesObject obj)
Parameters
Type | Name | Description |
---|---|---|
IKubernetes |
obj | The object. |
Remarks
This should be called in all custom object constructors to ensure that the object's metadata is configured and matches what was specified in the attribute. Here's what this will look like:
[KubernetesEntity(Group = "mygroup.io", ApiVersion = "v1", Kind = "my-resource", PluralName = "my-resources")]
[KubernetesEntityShortNames]
[EntityScope(EntityScope.Cluster)]
[Description("My custom resource.")]
public class V1MyCustomResource : CustomKubernetesEntity<V1ContainerRegistry.V1ContainerRegistryEntitySpec>
{
public V1ContainerRegistry()
{
((IKubernetesObject)this).InitializeMetadata();
}
...</code></pre>
Exceptions
Type | Condition |
---|---|
Invalid |
Thrown when the object's type does not have a Kubernetes |
Set<T>(List<NamedExtension>, string, T)
Sets the named extension value by adding it if it doesn't already exist or changing the existing value.
Declaration
public static void Set<T>(this List<NamedExtension> extensions, string name, T value)
Parameters
Type | Name | Description |
---|---|---|
List<Named |
extensions | Holds the extensions. |
string | name | Specifies the extension name. |
T | value | Specifies the value being set. |
Type Parameters
Name | Description |
---|---|
T | Specifies the property value type. |
UpsertClusterCustomObjectAsync<T>(ICustomObjectsOperations, T, string, string, string, CancellationToken)
Creates or replaces a cluster scoped custom object of the specified generic object type and name, depending on whether the object already exists in the cluster.
Declaration
public static Task<T> UpsertClusterCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T body, string name, string dryRun = null, string fieldManager = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | body | Specifies the new object data. |
string | name | Specifies the object name. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
UpsertNamespacedCustomObjectAsync<T>(ICustomObjectsOperations, T, string, string, string, string, CancellationToken)
Creates or replaces a namespace scoped custom object of the specified generic object type, depending on whether the object already exists in the cluster.
Declaration
public static Task<T> UpsertNamespacedCustomObjectAsync<T>(this ICustomObjectsOperations k8s, T body, string name, string namespaceParameter, string dryRun = null, string fieldManager = null, CancellationToken cancellationToken = default) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
ICustom |
k8s | The Neon. |
T | body | Specifies the new object data. |
string | name | Specifies the object name. |
string | namespaceParameter | The target Kubernetes namespace. |
string | dryRun | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
string | fieldManager | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<T> | The updated object. |
Type Parameters
Name | Description |
---|---|
T | The custom object type. |
UpsertNamespacedTypedSecretAsync<TSecretData>(ICoreV1Operations, TypedSecret<TSecretData>, CancellationToken)
Upserts a namespaced typed secret.
Declaration
public static Task<TypedSecret<TSecretData>> UpsertNamespacedTypedSecretAsync<TSecretData>(this ICoreV1Operations k8sCoreV1, TypedSecret<TSecretData> secret, CancellationToken cancellationToken = default) where TSecretData : class, new()
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
Typed |
secret | Specifies the secret. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<Typed |
The tracking Task. |
Type Parameters
Name | Description |
---|---|
TSecretData |
Remarks
Typed secrets are V1Secret objects that wrap a strongly typed
object formatted using the Typed
UpsertSecretAsync(ICoreV1Operations, V1Secret, string)
Adds a new Kubernetes secret or updates an existing secret.
Declaration
public static Task<V1Secret> UpsertSecretAsync(this ICoreV1Operations k8s, V1Secret secret, string namespaceParameter = null)
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8s | The Neon. |
V1Secret | secret | The secret. |
string | namespaceParameter | Optionally overrides the default namespace. |
Returns
WaitForCustomResourceDefinitionAsync<TEntity>(IApiextensionsV1Operations, TimeSpan, TimeSpan, CancellationToken)
Waits for a custom resource definition to be created in the API server.
Declaration
public static Task WaitForCustomResourceDefinitionAsync<TEntity>(this IApiextensionsV1Operations k8sApiextensionsV1, TimeSpan pollInterval = default, TimeSpan timeout = default, CancellationToken cancellationToken = default) where TEntity : IKubernetesObject<V1ObjectMeta>
Parameters
Type | Name | Description |
---|---|---|
IApiextensions |
k8sApiextensionsV1 | The Neon. |
Time |
pollInterval | Optionally specifies the polling interval. This defaults to 5 seconds. |
Time |
timeout | Optionally specifies the maximum time to wait. This defaults to 90 seconds. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
Returns
Type Parameters
Name | Description |
---|---|
TEntity | Specifies the custom resource type. |
WaitForDaemonsetAsync(IAppsV1Operations, string, string, string, string, TimeSpan, TimeSpan, CancellationToken)
Waits for a daemon set to start successfully.
Declaration
public static Task WaitForDaemonsetAsync(this IAppsV1Operations k8sAppsV1, string namespaceParameter, string name = null, string labelSelector = null, string fieldSelector = null, TimeSpan pollInterval = default, TimeSpan timeout = default, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IApps |
k8sAppsV1 | The Neon. |
string | namespaceParameter | The namespace. |
string | name | Optionally specifies the daemonset name. |
string | labelSelector | Optionally specifies a label selector. |
string | fieldSelector | Optionally specifies a field selector. |
Time |
pollInterval | Optionally specifies the polling interval. This defaults to 1 second. |
Time |
timeout | Optionally specifies the operation timeout. This defaults to 30 seconds. |
Cancellation |
cancellationToken | Optionally specifies the cancellation token. |
Returns
Remarks
One of name
, labelSelector
, or fieldSelector
must be specified.
WaitForDeploymentAsync(IAppsV1Operations, string, string, string, string, TimeSpan, TimeSpan, CancellationToken)
Waits for a service deployment to start successfully.
Declaration
public static Task WaitForDeploymentAsync(this IAppsV1Operations k8sAppsV1, string namespaceParameter, string name = null, string labelSelector = null, string fieldSelector = null, TimeSpan pollInterval = default, TimeSpan timeout = default, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IApps |
k8sAppsV1 | The Neon. |
string | namespaceParameter | The namespace. |
string | name | Optionally specifies the deployment name. |
string | labelSelector | Optionally specifies a label selector. |
string | fieldSelector | Optionally specifies a field selector. |
Time |
pollInterval | Optionally specifies the polling interval. This defaults to 1 second. |
Time |
timeout | Optopnally specifies the operation timeout. This defaults to 30 seconds. |
Cancellation |
cancellationToken | Optionally specifies the cancellation token. |
Returns
Remarks
One of name
, labelSelector
, or fieldSelector
must be specified.
WaitForPodAsync(ICoreV1Operations, string, string, TimeSpan, TimeSpan, CancellationToken)
Waits for a pod to start successfully.
Declaration
public static Task WaitForPodAsync(this ICoreV1Operations k8sCoreV1, string name, string namespaceParameter, TimeSpan pollInterval = default, TimeSpan timeout = default, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ICore |
k8sCoreV1 | The Neon. |
string | name | The pod name. |
string | namespaceParameter | The namespace. |
Time |
pollInterval | Optionally specifies the polling interval. This defaults to 1 second. |
Time |
timeout | Optionally specifies the operation timeout. This defaults to 30 seconds. |
Cancellation |
cancellationToken | Optionally specifies the cancellation token. |
Returns
WaitForStatefulSetAsync(IAppsV1Operations, string, string, string, string, TimeSpan, TimeSpan, CancellationToken)
Waits for a stateful set to start successfully.
Declaration
public static Task WaitForStatefulSetAsync(this IAppsV1Operations k8sAppsV1, string namespaceParameter, string name = null, string labelSelector = null, string fieldSelector = null, TimeSpan pollInterval = default, TimeSpan timeout = default, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IApps |
k8sAppsV1 | The Neon. |
string | namespaceParameter | The namespace. |
string | name | Optionally specifies the stateful set name.. |
string | labelSelector | Optionally specifies a label selector. |
string | fieldSelector | Optionally specifies a field selector. |
Time |
pollInterval | Optionally specifies the polling interval. This defaults to 1 second. |
Time |
timeout | Optionally specifies the operation timeout. This defaults to 30 seconds. |
Cancellation |
cancellationToken | Optionally specifies the cancellation token. |
Returns
Remarks
One of name
, labelSelector
, or fieldSelector
must be specified.
WatchAsync<T>(IKubernetes, Func<WatchEvent<T>, Task>, string, string, string, string, string, int?, CancellationToken, ILogger)
Watches a Kubernetes resource with a callback.
Declaration
public static Task WatchAsync<T>(this IKubernetes k8s, Func<WatchEvent<T>, Task> actionAsync, string namespaceParameter = null, string fieldSelector = null, string labelSelector = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, CancellationToken cancellationToken = default, ILogger logger = null) where T : IKubernetesObject<V1ObjectMeta>, new()
Parameters
Type | Name | Description |
---|---|---|
IKubernetes | k8s | The IKubernetes instance. |
Func<Watch |
actionAsync | The async action called as watch events are received. |
string | namespaceParameter | Optionally specifies a Kubernetes namespace. |
string | fieldSelector | Optionally specifies a field selector |
string | labelSelector | Optionally specifies a label selector |
string | resourceVersion | Optionally specifies a resource version. |
string | resourceVersionMatch | Optionally specifies a resourceVersionMatch setting. |
int? | timeoutSeconds | Optionally specifies a timeout override. |
Cancellation |
cancellationToken | Optionally specifies a cancellation token. |
ILogger | logger | Optionally specifies a ILogger. |
Returns
Type Parameters
Name | Description |
---|---|
T | The type parameter. |