Class: KubernetesClient

client. KubernetesClient

Initialized KubernetesClient objects are used to interface with the Kubernetes API server specified in the ClientConfig. The client's Endpoint properties are generated at runtime from the Kubernetes resource specification.

new KubernetesClient(options)

Kubernetes API Client

Create a new KubernetesClient object. If the given object is not of type ClientConfig then it is used as input to the ClientConfig constructor to define a new one. Parses the Kubernetes API spec to generate Endpoint properties.

Parameters:
Name Type Description
options object | module:client~ClientConfig

Sets KubernetesClient#config

Properties
Name Type Argument Description
oshift string | boolean <optional>

Define OpenShift API resource endpoints

extensions string | boolean <optional>

Define Kubernetes Extensions API resource endpoints

beta string | boolean <optional>

(deprecated) Alias for options.extensions

apis Array.<APISpecification> <optional>

List of additional API specifications to define

Throws:

Members

config :module:client~ClientConfig

Client object configuration

Type:

Methods

authenticate(flush, next) → {Promise.<module:client~ClientConfig>}

Authenticate with the oAuth server

The new token is added to the ClientConfig. Returns a Promise of the updated ClientConfig with the new token parameter.

Parameters:
Name Type Argument Default Description
flush boolean <optional>
false

Delete the client's token if it already exists

next function <optional>

Node.js callback (replaces Promise output)

See:
Returns:
Type
Promise.<module:client~ClientConfig>

createEndpoint(resource, spec)

Define a new API server resource endpoint. The returned object will be an instantiated Endpoint or a relevant subtype.

Parameters:
Name Type Argument Description
resource string

Resource name

spec EndpointSpecification <optional>
<nullable>

Endpoint specification for the resource

Properties
Name Type Argument Description
name string <optional>
<nullable>

Custom name for the endpoint property

See:

defineAPI(api)

Create all resource endpoints defined in the given API specification

Parameters:
Name Type Description
api APISpecification

API endpoints to define