trait KubernetesClient extends AnyRef
- Alphabetic
- By Inheritance
- KubernetesClient
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
close: Unit
Closes the client.
Closes the client. Any requests to the client after this is called will be rejected.
- abstract val clusterServer: String
-
abstract
def
create[O <: ObjectResource](obj: O)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[O]
Create a new object resource.
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.
- O
the specific object resource type e.g. Pod, Deployment
- obj
the resource to create on the cluster
- returns
A future containing the created resource returned by Kubernetes
-
abstract
def
delete[O <: ObjectResource](name: String, gracePeriodSeconds: Int = -1)(implicit rd: ResourceDefinition[O], lc: LoggingContext): Future[Unit]
Delete an existing object resource
Delete an existing object resource
- name
the name of the resource to delete
- gracePeriodSeconds
optional parameter specifying a grace period to be applied before hard killing the resource
- returns
A future that will be set to success if the deletion request was accepted by Kubernetes, otherwise failure
-
abstract
def
deleteAll[L <: ListResource[_]]()(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[L]
Delete all resources of specified type in current namespace
Delete all resources of specified type in current namespace
- L
list resource type of resources to delete e.g. PodList, DeploymentList
- returns
A future containing the list of all deleted resources
-
abstract
def
deleteAllSelected[L <: ListResource[_]](labelSelector: LabelSelector)(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[L]
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
- L
the list resource type of resources to delete e.g. PodList, DeploymentList
- labelSelector
selects the resources to delete
- returns
A future containing the list of all deleted resources
-
abstract
def
deleteWithOptions[O <: ObjectResource](name: String, options: DeleteOptions)(implicit rd: ResourceDefinition[O], lc: LoggingContext): Future[Unit]
Delete an existing object resource
Delete an existing object resource
- O
the specific object resource type e.g. Pod, Deployment
- name
the name of the resource to delete
- 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
-
abstract
def
exec(podName: String, command: Seq[String], maybeContainerName: Option[String] = None, maybeStdin: Option[Source[String, _]] = None, maybeStdout: Option[Sink[String, _]] = None, maybeStderr: Option[Sink[String, _]] = None, tty: Boolean = false, maybeClose: Option[Promise[Unit]] = None)(implicit lc: LoggingContext): Future[Unit]
Execute a command in a pod (similar to
kubectl exec ...
)Execute a command in a pod (similar to
kubectl exec ...
)- podName
the name of the pod
- command
the command to execute
- maybeContainerName
an optional container name
- maybeStdin
optional Akka Source for sending input to stdin for the command
- maybeStdout
optional Akka Sink to receive output from stdout for the command
- maybeStderr
optional Akka Sink to receive output from stderr for the command
- tty
optionally set tty on
- maybeClose
if set, this can be used to close the connection to the pod by completing the promise
- returns
A future indicating the exec command has been submitted
-
abstract
def
get[O <: ObjectResource](name: String)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[O]
Retrieve the object resource with the specified name and type
Retrieve the object resource with the specified name and type
- O
the specific object resource type e.g. Pod, Deployment
- name
the name of the object resource
- returns
A future containing the retrieved resource (or an exception if resource not found)
-
abstract
def
getInNamespace[O <: ObjectResource](name: String, namespace: String)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[O]
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
- O
the specific object resource type e.g. Pod, Deployment
- name
the name of the object resource
- namespace
the namespace containing the object resource
- returns
A future conatining Some(resource) if the resource is found on the cluster otherwise None
-
abstract
def
getNamespaceNames(implicit lc: LoggingContext): Future[List[String]]
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
-
abstract
def
getOption[O <: ObjectResource](name: String)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Option[O]]
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
- O
the specific object resource type e.g. Pod, Deployment
- name
the name of the object resource
- returns
A future containing Some(resource) if the resource is found on the cluster, or None if not found
-
abstract
def
getPodLogSource(name: String, queryParams: LogQueryParams, namespace: Option[String] = None)(implicit lc: LoggingContext): Future[Source[ByteString, _]]
Get the logs from a pod (similar to
kubectl logs ...
).Get the logs from a pod (similar to
kubectl logs ...
). The logs are streamed using an Akka streams source- name
the name of the pod
- queryParams
optional parameters of the request (for example container name)
- namespace
if set this specifies the namespace of the pod (otherwise the configured namespace is used)
- returns
A future containing a Source for the logs stream.
-
abstract
def
getScale[O <: ObjectResource](objName: String)(implicit rd: ResourceDefinition[O], sc: SubresourceSpec[O], lc: LoggingContext): Future[Scale]
Get the scale subresource of the named object resource This can only be called on certain resource types that support scale subresources.
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
- O
the type of the resource e.g. Pod
- 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
-
abstract
def
getServerAPIVersions(implicit lc: LoggingContext): Future[List[String]]
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
-
abstract
def
getStatus[O <: ObjectResource](name: String)(implicit fmt: Format[O], rd: ResourceDefinition[O], statusEv: HasStatusSubresource[O], lc: LoggingContext): Future[O]
Get the status subresource of a given object resource.
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.
- O
the resource type e.g. Pod, Deployment
- name
the name of the object resource
- 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
-
abstract
def
list[L <: ListResource[_]]()(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[L]
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
- L
the list type to retrieve e.g. PodList, DeploymentList
- returns
A future containing the resource list retrieved
-
abstract
def
listByNamespace[L <: ListResource[_]]()(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[Map[String, L]]
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
- 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
-
abstract
def
listInNamespace[L <: ListResource[_]](theNamespace: String)(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[L]
Get list of resources of a given type in a specified namespace
Get list of resources of a given type in a specified namespace
- L
the list resource type of the objects to retrieve e.g. PodList, DeploymentList
- theNamespace
the namespace to search
- returns
A future containing the resource list retrieved
-
abstract
def
listSelected[L <: ListResource[_]](labelSelector: LabelSelector)(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[L]
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
- L
the list type of the resources to retrieve e.g. PodList, DeploymentList
- labelSelector
the label selector to use to select the resources to return
- returns
A future containing the resource list retrieved
-
abstract
def
listWithOptions[L <: ListResource[_]](options: ListOptions)(implicit fmt: Format[L], rd: ResourceDefinition[L], lc: LoggingContext): Future[L]
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
- L
the list type of the resources to retrieve e.g. PodList, DeploymentList
- 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
- abstract val logConfig: LoggingConfig
- abstract val namespaceName: String
-
abstract
def
patch[P <: Patch, O <: ObjectResource](name: String, patchData: P, namespace: Option[String] = None)(implicit patchfmt: Writes[P], fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext = RequestLoggingContext()): Future[O]
Patch a resource
Patch a resource
- P
the patch type (specifies the patch strategy details)
- O
the type of the resource to be patched
- name
The name of the resource to patch
- patchData
The patch data to apply to the resource
- namespace
the namespace (defaults to currently configured namespace)
- patchfmt
an implicit parameter that knows how to serialise the patch data to Json
- returns
a future conating the patched resource
-
abstract
def
update[O <: ObjectResource](obj: O)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[O]
Update an existing object resource
Update an existing object resource
- obj
the resource with the desired updates
- returns
A future containing the updated resource returned by Kubernetes
-
abstract
def
updateScale[O <: ObjectResource](objName: String, scale: Scale)(implicit rd: ResourceDefinition[O], sc: SubresourceSpec[O], lc: LoggingContext): Future[Scale]
Update the scale subresource of a specified resource This can only be called on certain resource types that support scale subresources.
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
- O
the type of the resource
- objName
the name of the resource
- scale
the updated scale to set on 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 successfully updated scale subresource
-
abstract
def
updateStatus[O <: ObjectResource](obj: O)(implicit fmt: Format[O], rd: ResourceDefinition[O], statusEv: HasStatusSubresource[O], lc: LoggingContext): Future[O]
Update the status subresource of a given object resource.
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
- O
The resource type
- 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
-
abstract
def
usingNamespace(newNamespace: String): KubernetesClient
Create a new KubernetesClient instance that reuses this clients configuration and connection resources, but with a different target namespace.
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.
-
abstract
def
watch[O <: ObjectResource](name: String, sinceResourceVersion: Option[String] = None, bufSize: Int = 10000)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]]
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.
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.
- O
the type of the resource to watch
- name
the name of the object
- 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.
- bufSize
An optional buffer size for the returned on-the-wire representation of each modified object - normally the default is more than enough.
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
watch[O <: ObjectResource](obj: O)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]]
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.
- O
the type of the object to watch e.g. Pod, Deployment
- obj
the name of the object to watch
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
watchAll[O <: ObjectResource](sinceResourceVersion: Option[String] = None, bufSize: Int = 10000)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Future[Source[WatchEvent[O], _]]
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.
- O
the type of resource to watch e.g. Pod, Dpeloyment
- 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.
- bufSize
optional buffer size for each modified object received, normally the default is more than enough
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
watchAllContinuously[O <: ObjectResource](sinceResourceVersion: Option[String] = None, bufSize: Int = 10000)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _]
Watch all object resources of a specified type continuously.
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.
- O
the type pf the resource
- 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.
- bufSize
optional buffer size for received object updates, normally the default is more than enough
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
watchContinuously[O <: ObjectResource](name: String, sinceResourceVersion: Option[String] = None, bufSize: Int = 10000)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _]
Watch a specific object resource continuously.
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.
- O
the type of the resource
- name
the name of the resource to watch
- 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.
- bufSize
optional buffer size for received object updates, normally the default is more than enough
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
watchContinuously[O <: ObjectResource](obj: O)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _]
Watch a specific object resource continuously.
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.
- O
the type of the resource e.g Pod
- obj
the object resource to watch
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
watchWithOptions[O <: ObjectResource](options: ListOptions, bufsize: Int = 10000)(implicit fmt: Format[O], rd: ResourceDefinition[O], lc: LoggingContext): Source[WatchEvent[O], _]
Watch all object resources of a specified type continuously, passing the specified options to the API server with the watch request.
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.
- O
the resource type to watch
- 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.- bufsize
optional buffer size for received object updates, normally the default is more than enough
- returns
A future containing an Akka streams Source of WatchEvents that will be emitted
-
abstract
def
jsonMergePatch[O <: ObjectResource](obj: O, patch: String)(implicit rd: ResourceDefinition[O], fmt: Format[O], lc: LoggingContext): Future[O]
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
- O
the type of the resource
- obj
the name of the resource to patch
- patch
the patch (in json patch format)
- returns
A future containing the patched resource
- Annotations
- @deprecated
- Deprecated
(Since version v2.1) use patch instead
-
abstract
def
scale[O <: ObjectResource](objName: String, count: Int)(implicit rd: ResourceDefinition[O], sc: SubresourceSpec[O], lc: LoggingContext): Future[Scale]
- Annotations
- @deprecated
- Deprecated
use getScale followed by updateScale instead
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()