Class: ClientConfig

client~ ClientConfig

Describes the configuration of a KubernetesClient object. All options relevant to the client initialization are provided as instance properties. The token property is managed by the Auth module if user credentials are given.

new ClientConfig(options)

Kubernetes API Client Configuration

Create a new ClientConfig object. The given object will supply the necessary fields to initialize the object. If any required parameters are missing an error will be thrown.

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

Input parameters

Properties
Name Type Argument Default Description
auth object <optional>
<nullable>
null

Sets ClientConfig#auth

Properties
Name Type Description
user string

Client username

pass string

Client password

authOptions object <optional>
{}

Sets ClientConfig#authOptions

Properties
Name Type Argument Default Description
allowUnsafe boolean <optional>
false

Permit authentication without SSL/TLS

preserveAuth boolean <optional>
true

Keep user credentials for re-authentication

host string

Sets ClientConfig#host

hostname string <optional>

Alias for the host parameter

logLevel string | number <optional>
bunyan.FATAL

Set log output level (equivalent to logOptions.level)

logOptions object <optional>
{}

Configure options for the bunyan logger

namespace string <optional>
<nullable>
null

Sets ClientConfig#namespace

port string | number <optional>

Sets port component of ClientConfig#host

protocol string <optional>

Sets protocol component of ClientConfig#host

requestOptions object <optional>
{}

Sets ClientConfig#requestOptions

timeout number <optional>
<nullable>
null

Sets ClientConfig#timeout

token string <optional>
<nullable>
null

Sets ClientConfig#token

version string | number

Sets ClientConfig#version

Throws:

Members

<readonly, nullable> auth :object

User credentials for authentication with the API server

Specify a username and password in the object's 'user' and 'pass' properties, respectively. If authentication is handled externally and a valid token has been supplied, or if authentication is not required for the given API server host, then this parameter may be excluded.

Type:
  • object
Properties:
Name Type Description
user string

Client username

pass string

Client password

Default Value:
  • null

<readonly> authOptions :object

Request options for authentication

Contained properties are passed directly to the request module and override the default configuration for token requests. Consult the documentation for the request module (linked below) for information on valid properties.

Type:
  • object
Default Value:
  • {}
See:

<readonly, non-null> host :string

Kubernetes API server host

Defines the full URL endpoint for the API server, including protocol and port. If port or protocol are excluded from the host specification, then the ClientConfig will look for them as port or protocol input parameters, respectively. If they are not defined in either format then the default values will be used to complete the URL.

Default if only hostname is provided: https://{hostname}

Type:
  • string
Example
'http://localhost:8080'

<readonly, nullable> namespace :string

Default Kubernetes project namespace

This is used to restrict the scope of all methods to the given project. If defined, all of the client's methods will use this namespace as their project scope. Individual calls to an API endpoint may override this default by defining the namespace property of their request options. An empty namespace is equivalent to the global scope.

Type:
  • string
Default Value:
  • null

<readonly> requestOptions :object

Request options for API endpoints

These are passed directly to the request module and override the default configuration for every method. Consult the documentation for the request module (linked below) for information on valid properties for this object.

The most common use case is to supply custom headers needed by your proxy or API server.

Type:
  • object
Default Value:
  • {}
See:

<readonly, nullable> timeout :number

Request timeout in milliseconds

Type:
  • number
Default Value:
  • null

<nullable> token :string

oAuth token for authentication

If this is omitted and the auth property is set, then the credentials found in auth will be used to request a new oAuth token from the API server automatically. Invalid or expired tokens will also be silently refreshed without an error being thrown for the first authentication failure.

If the auth property is not defined then this token must be set manually for authentication of API requests.

Type:
  • string
Default Value:
  • null

<readonly, non-null> version :string

Kubernetes API version

If a number is provided, it is converted to a string and prepended with 'v' for compatibility with the Kubernetes API schema for API versions.

Type:
  • string
See:
Example
'v1'