KubernetesClient
Value members
Abstract methods
Closes the client. Any requests to the client after this is called will be rejected.
Closes the client. Any requests to the client after this is called will be rejected.
Create a new object resource. If the namespace metadata field is set to a non-empty value then the object will be created in that namespace, otherwise it will be created in the configured namespace of the client.
Create a new object resource. If the namespace metadata field is set to a non-empty value then the object will be created in that namespace, otherwise it will be created in the configured namespace of the client.
- Type parameters:
- O
the specific object resource type e.g. Pod, Deployment
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- obj
the resource to create on the cluster
- Returns:
A future containing the created resource returned by Kubernetes
Delete an existing object resource
Delete an existing object resource
- Value parameters:
- gracePeriodSeconds
optional parameter specifying a grace period to be applied before hard killing the resource
- name
the name of the resource to delete
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future that will be set to success if the deletion request was accepted by Kubernetes, otherwise failure
Delete all resources of specified type in current namespace
Delete all resources of specified type in current namespace
- Type parameters:
- L
list resource type of resources to delete e.g. PodList, DeploymentList
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future containing the list of all deleted resources
Delete all resources of specified type selected by a specified label selector in current namespace
Delete all resources of specified type selected by a specified label selector in current namespace
- Type parameters:
- L
the list resource type of resources to delete e.g. PodList, DeploymentList
- Value parameters:
- labelSelector
selects the resources to delete
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future containing the list of all deleted resources
Delete an existing object resource
Delete an existing object resource
- Type parameters:
- O
the specific object resource type e.g. Pod, Deployment
- Value parameters:
- name
the name of the resource to delete
- namespace
the namespace (defaults to currently configured namespace)
- options
contains various options that can be passed to the deletion operation, see Kubernetes documentation
- Returns:
A future that will be set to success if the deletion request was accepted by Kubernetes, otherwise failure
Execute a command in a pod (similar to kubectl exec ...
)
Execute a command in a pod (similar to kubectl exec ...
)
- Value parameters:
- command
the command to execute
- maybeClose
if set, this can be used to close the connection to the pod by completing the promise
- maybeContainerName
an optional container name
- maybeStderr
optional Akka Sink to receive output from stderr for the command
- maybeStdin
optional Akka Source for sending input to stdin for the command
- maybeStdout
optional Akka Sink to receive output from stdout for the command
- namespace
if set this specifies the namespace of the pod (otherwise the configured namespace is used)
- podName
the name of the pod
- tty
optionally set tty on
- Returns:
A future indicating the exec command has been submitted
Retrieve the object resource with the specified name and type
Retrieve the object resource with the specified name and type
- Type parameters:
- O
the specific object resource type e.g. Pod, Deployment
- Value parameters:
- name
the name of the object resource
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future containing the retrieved resource (or an exception if resource not found)
Return a list of the names of all namespaces in the cluster
Return a list of the names of all namespaces in the cluster
- Returns:
a future containing the list of names of all namespaces in the cluster
Retrieve the object resource with the specified name and type, returning None if resource does not exist
Retrieve the object resource with the specified name and type, returning None if resource does not exist
- Type parameters:
- O
the specific object resource type e.g. Pod, Deployment
- Value parameters:
- name
the name of the object resource
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future containing Some(resource) if the resource is found on the cluster, or None if not found
Get the logs from a pod (similar to kubectl logs ...
). The logs are streamed using an Akka streams source
Get the logs from a pod (similar to kubectl logs ...
). The logs are streamed using an Akka streams source
- Value parameters:
- name
the name of the pod
- namespace
if set this specifies the namespace of the pod (otherwise the configured namespace is used)
- queryParams
optional parameters of the request (for example container name)
- Returns:
A future containing a Source for the logs stream.
Get the scale subresource of the named object resource This can only be called on certain resource types that support scale subresources. Normally used in advanced use cases such as custom controllers
Get the scale subresource of the named object resource This can only be called on certain resource types that support scale subresources. Normally used in advanced use cases such as custom controllers
- Type parameters:
- O
the type of the resource e.g. Pod
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- objName
the name of the resource
- sc
this implicit parameter provides evidence that the resource type supports scale subresources. Normally defined in the companion object of the resource type if applicable so does not need to be imported.
- Returns:
a future containing the scale subresource
Return list of API versions supported by the server
Return list of API versions supported by the server
- Returns:
a future containing the list of API versions
Get the status subresource of a given object resource. Only supported by certain object resource kinds (which need to have defined an implicit HasStatusResource) This method is generally for advanced use cases such as custom controllers.
Get the status subresource of a given object resource. Only supported by certain object resource kinds (which need to have defined an implicit HasStatusResource) This method is generally for advanced use cases such as custom controllers.
- Type parameters:
- O
the resource type e.g. Pod, Deployment
- Value parameters:
- name
the name of the object resource
- namespace
the namespace (defaults to currently configured namespace)
- statusEv
this implicit provides evidence that the resource kind has status subresources, so supports this method
- Returns:
A future containing the object resource including current status
Get list of all resources of specified type in the configured namespace for the client
Get list of all resources of specified type in the configured namespace for the client
- Type parameters:
- L
the list type to retrieve e.g. PodList, DeploymentList
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future containing the resource list retrieved
Get list of all resources across all namespaces in the cluster of a specified list type, grouped by namespace
Get list of all resources across all namespaces in the cluster of a specified list type, grouped by namespace
- Type parameters:
- L
the list resource type of resources to list e.g. PodList, DeploymentList
- Returns:
A future with a map containing an entry for each namespace, each entry consists of a list of resources keyed by the name of their namesapce
Get list of selected resources of specified type in the configured namespace for the client
Get list of selected resources of specified type in the configured namespace for the client
- Type parameters:
- L
the list type of the resources to retrieve e.g. PodList, DeploymentList
- Value parameters:
- labelSelector
the label selector to use to select the resources to return
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future containing the resource list retrieved
Get list of resources of specified type, applying the specified options to the list request
Get list of resources of specified type, applying the specified options to the list request
- Type parameters:
- L
the list type of the resources to retrieve e.g. PodList, DeploymentList
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- options
a set of options to be added to the request that can modify how the request is handled by Kubernetes.
- Returns:
A future containing the resource list retrieved
Patch a resource
Patch a resource
- Type parameters:
- O
the type of the resource to be patched
- P
the patch type (specifies the patch strategy details)
- Value parameters:
- name
The name of the resource to patch
- namespace
the namespace (defaults to currently configured namespace)
- patchData
The patch data to apply to the resource
- patchfmt
an implicit parameter that knows how to serialise the patch data to Json
- Returns:
a future conating the patched resource
Update an existing object resource
Update an existing object resource
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- obj
the resource with the desired updates
- Returns:
A future containing the updated resource returned by Kubernetes
Update the scale subresource of a specified resource This can only be called on certain resource types that support scale subresources. Normally used in advanced use cases such as custom controllers
Update the scale subresource of a specified resource This can only be called on certain resource types that support scale subresources. Normally used in advanced use cases such as custom controllers
- Type parameters:
- O
the type of the resource
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- objName
the name of the resource
- sc
this implicit parameter provides evidence that the resource type supports scale subresources. Normally defined in the companion object of the resource type if applicable so does not need to be imported
- scale
the updated scale to set on the resource
- Returns:
a future containing the successfully updated scale subresource
Update the status subresource of a given object resource. Only supported by certain object resource kinds (which need to have defined an implicit HasStatusResource) This method is generally for advanced use cases such as custom controllers
Update the status subresource of a given object resource. Only supported by certain object resource kinds (which need to have defined an implicit HasStatusResource) This method is generally for advanced use cases such as custom controllers
- Type parameters:
- O
The resource type
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- obj
the name of the object resource whose status subresource is to be updated
- statusEv
this implicit provides evidence that the resource kind has status subresources, so supports this method
- Returns:
A future containing the full updated object resource
Place a watch on a specific object - this returns a source of events that will be produced whenever the object is added, modified or deleted on the cluster Note: Most applications should probably use watchContinuously instead, which transparently reconnects and continues the watch in the case of server timeouts - the source returned by this method will complete in the presence of such timeouts or other disconnections.
Place a watch on a specific object - this returns a source of events that will be produced whenever the object is added, modified or deleted on the cluster Note: Most applications should probably use watchContinuously instead, which transparently reconnects and continues the watch in the case of server timeouts - the source returned by this method will complete in the presence of such timeouts or other disconnections.
- Type parameters:
- O
the type of the object to watch e.g. Pod, Deployment
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- obj
the name of the object to watch
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Place a watch for any changes to a specific object, optionally since a given resource version - this returns a source of events that will be produced whenever the object is modified or deleted on the cluster, if the resource version on the updated object is greater than or equal to that specified. Note: Most applications should probably use watchContinuously instead, which transparently reconnects and continues the watch in the case of server timeouts - the source returned by this method will complete in the presence of such timeouts or other disconnections.
Place a watch for any changes to a specific object, optionally since a given resource version - this returns a source of events that will be produced whenever the object is modified or deleted on the cluster, if the resource version on the updated object is greater than or equal to that specified. Note: Most applications should probably use watchContinuously instead, which transparently reconnects and continues the watch in the case of server timeouts - the source returned by this method will complete in the presence of such timeouts or other disconnections.
- Type parameters:
- O
the type of the resource to watch
- Value parameters:
- bufSize
An optional buffer size for the returned on-the-wire representation of each modified object - normally the default is more than enough.
- name
the name of the object
- namespace
the namespace (defaults to currently configured namespace)
- sinceResourceVersion
the resource version - normally the applications gets the current resource from the metadata of a list call on the applicable type (e.g. PodList, DeploymentList) and then supplies that to this method. If no resource version is specified, a single ADDED event will be produced for an already existing object followed by events for any future changes.
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Place a watch on changes to all objects of a specific resource type - this returns a source of events that will be produced whenever an object of the specified type is added, modified or deleted on the cluster Note: Most applications should probably use watchAllContinuously instead, which transparently reconnects and continues the watch in the case of server timeouts - the source returned by this method will complete in the presence of such timeouts or other disconnections.
Place a watch on changes to all objects of a specific resource type - this returns a source of events that will be produced whenever an object of the specified type is added, modified or deleted on the cluster Note: Most applications should probably use watchAllContinuously instead, which transparently reconnects and continues the watch in the case of server timeouts - the source returned by this method will complete in the presence of such timeouts or other disconnections.
- Type parameters:
- O
the type of resource to watch e.g. Pod, Dpeloyment
- Value parameters:
- bufSize
optional buffer size for each modified object received, normally the default is more than enough
- namespace
the namespace (defaults to currently configured namespace)
- sinceResourceVersion
the resource version - normally the applications gets the current resource from the metadata of a list call on the applicable type (e.g. PodList, DeploymentList) and then supplies that to this method. If no resource version is specified, a single ADDED event will be produced for an already existing object followed by events for any future changes.
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Watch all object resources of a specified type continuously. This returns a source that will continue to produce events even if the server times out, by transparently restarting the watch as needed. The optional resourceVersion can be used to specify that only events on versions of objects greater than or equal to the resource version should be produced.
Watch all object resources of a specified type continuously. This returns a source that will continue to produce events even if the server times out, by transparently restarting the watch as needed. The optional resourceVersion can be used to specify that only events on versions of objects greater than or equal to the resource version should be produced.
- Type parameters:
- O
the type pf the resource
- Value parameters:
- bufSize
optional buffer size for received object updates, normally the default is more than enough
- namespace
the namespace (defaults to currently configured namespace)
- sinceResourceVersion
the resource version - normally the applications gets the current resource version from the metadata of a list call on the applicable type (e.g. PodList, DeploymentList) and then supplies that to this method to receive any future updates. If no resource version is specified, a single ADDED event will be produced for an already existing object followed by events for any future changes.
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Watch a specific object resource continuously. This returns a source that will continue to produce events on any updates to the object even if the server times out, by transparently restarting the watch as needed.
Watch a specific object resource continuously. This returns a source that will continue to produce events on any updates to the object even if the server times out, by transparently restarting the watch as needed.
- Type parameters:
- O
the type of the resource e.g Pod
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- obj
the object resource to watch
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Watch a specific object resource continuously. This returns a source that will continue to produce events on any updates to the object even if the server times out, by transparently restarting the watch as needed. The optional resourceVersion can be used to specify that only events on versions of the object greater than or equal to the resource version should be produced.
Watch a specific object resource continuously. This returns a source that will continue to produce events on any updates to the object even if the server times out, by transparently restarting the watch as needed. The optional resourceVersion can be used to specify that only events on versions of the object greater than or equal to the resource version should be produced.
- Type parameters:
- O
the type of the resource
- Value parameters:
- bufSize
optional buffer size for received object updates, normally the default is more than enough
- name
the name of the resource to watch
- namespace
the namespace (defaults to currently configured namespace)
- sinceResourceVersion
the resource version - normally the applications gets the current resource version from the metadata of a list call on the applicable type (e.g. PodList, DeploymentList) and then supplies that to this method to receive any future updates. If no resource version is specified, a single ADDED event will be produced for an already existing object followed by events for any future changes.
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Watch all object resources of a specified type continuously, passing the specified options to the API server with the watch request. This returns a source that will continue to produce events even if the server times out, by transparently restarting the watch as needed.
Watch all object resources of a specified type continuously, passing the specified options to the API server with the watch request. This returns a source that will continue to produce events even if the server times out, by transparently restarting the watch as needed.
- Type parameters:
- O
the resource type to watch
- Value parameters:
- bufsize
optional buffer size for received object updates, normally the default is more than enough
- namespace
the namespace (defaults to currently configured namespace)
- options
a set of list options to pass to the server. See https://godoc.org/k8s.io/apimachinery/pkg/apis/meta/v1#ListOptions for the meaning of the options. Note that the
watch
flag in the options will be ignored / overridden by the client, which ensures a watch is always requested on the server.
- Returns:
A future containing an Akka streams Source of WatchEvents that will be emitted
Deprecated methods
- Deprecated
Retrieve the object resource with the specified name and type from the specified namespace
Retrieve the object resource with the specified name and type from the specified namespace
- Type parameters:
- O
the specific object resource type e.g. Pod, Deployment
- Value parameters:
- name
the name of the object resource
- namespace
the namespace (defaults to currently configured namespace)
- Returns:
A future conatining Some(resource) if the resource is found on the cluster otherwise None
- Deprecated
Apply a patch to a specified object resource using json merge patch strategy
Apply a patch to a specified object resource using json merge patch strategy
- Type parameters:
- O
the type of the resource
- Value parameters:
- namespace
the namespace (defaults to currently configured namespace)
- obj
the name of the resource to patch
- patch
the patch (in json patch format)
- Returns:
A future containing the patched resource
- Deprecated
- Deprecated
Get list of resources of a given type in a specified namespace
Get list of resources of a given type in a specified namespace
- Type parameters:
- L
the list resource type of the objects to retrieve e.g. PodList, DeploymentList
- Value parameters:
- theNamespace
the namespace to search
- Returns:
A future containing the resource list retrieved
- Deprecated
- Deprecated
Create a new KubernetesClient instance that reuses this clients configuration and connection resources, but with a different target namespace. This is useful for applications that need a lightweight way to target multiple or dynamic namespaces.
Create a new KubernetesClient instance that reuses this clients configuration and connection resources, but with a different target namespace. This is useful for applications that need a lightweight way to target multiple or dynamic namespaces.
- Deprecated
- Deprecated
- Deprecated