hpecp.k8s_worker module

class hpecp.k8s_worker.WorkerK8sStatus(value)[source]

Bases: Enum

An enumeration.

bundle = 1
installing = 2
installed = 3
ready = 4
unlicensed = 5
configuring = 6
configured = 7
error = 8
sysinfo = 9
unconfiguring = 10
deleting = 11
storage_pending = 12
storage_configuring = 13
storage_error = 14
class hpecp.k8s_worker.WorkerK8s(json)[source]

Bases: AbstractResource

all_fields = ['id', 'status', 'hostname', 'ipaddr', 'href', '_links']

All of the fields of a K8s Cluster objects that are returned by the HPE Container Platform API

default_display_fields = ['id', 'status', 'hostname', 'ipaddr']
property worker_id
property status
property hostname
property ipaddr
property href
class hpecp.k8s_worker.K8sWorkerController(client)[source]

Bases: AbstractWaitableResourceController

base_resource_path = '/api/v2/worker/k8shost'

Declare the resource base path for the API resource.

Getter:

Returns the resource base path

Setter:

Sets the resource base path

Type:

str

class K8sClusterController(AbstractResourceController):

… base_resource_path = “/api/v2/k8scluster”

resource_list_path = 'k8shosts'

Declare the implementing resource list path for the API resource. The resource list path is where the resources are after the ‘_embedded’ element in the API response json.

Getter:

Returns the resource list path

Setter:

Sets the resource list path

Type:

str

class K8sClusterController(AbstractResourceController):

… resource_list_path = “k8sclusters”

resource_class

alias of WorkerK8s

status_class

alias of WorkerK8sStatus

status_fieldname = 'status'

Declare the Status fieldname in the API resource.

Usually either: status or state

Getter:

Returns the Status fieldname

Setter:

Sets the Status fieldname

Type:

str

class K8sClusterController(AbstractResourceController):

… status_fieldname = status

create_with_ssh_key(ip, ssh_key_data, ssh_passphrase=None, tags=[])[source]

Create a gateway instance using SSH key credentials to access the host.

ip: str

The IP address of the proxy host. Used for internal communication.

ssh_key_data: str

The ssh key data as a string.

ssh_passphrase: str

The ssh passphrase

tags: list

Tags to use, e.g. “{ ‘tag1’: ‘foo’, ‘tag2’, ‘bar’ }”.

string

Worker ID

get(id, params=None, setup_log=False)[source]

Make an API call to retrieve a Resource.

idstr

The ID with the format /resource/path/id

paramsstr, optional

API Parameters.

Instance of self.resource_class

An instance of the class defined by the property self.resource_class

APIException

The remote API returned an error.

APIItemNotFoundException

The item with {id} was not found.

set_storage(worker_id, ephemeral_disks=[], persistent_disks=[])[source]

Set storage for a k8s worker.

worker_idstr

The k8s worker ID, format - ‘/api/v2/worker/k8shost/[0-9]+’

ephemeral_diskslist

List of ephemeral disks. Mandatory parameter, by default []

persistent_diskslist, optional

List of persistent disks, by default []

APIItemNotFoundException APIItemConflictException APIException AssertionError