VK Cloud logo

Working with ConfigMaps

These methods allow you to work with ConfigMaps (configuration maps) of a Kubernetes cluster in the Managed Containers service, which provides the operation of the Cloud Spark cluster. They are used to store configuration data: environment variables, command-line arguments, or configuration files. Using a ConfigMap allows you to separate the configuration of environment-specific data from the application code. This makes it easier to move your Spark applications between code runtime environments.

create_configmap_from_yaml

Create a ConfigMap in the specified namespace based on the provided manifest. The manifest must be in YAML format.

Required token role: Administrator. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

The ID of the Cloud Spark cluster.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

configmap_yaml_path

(required)

str

Path to the YAML file with the manifest to be passed to the Cloud Spark cluster

namespace

(optional)

str

The name of the namespace in which to create the ConfigMap. The namespace must exist, otherwise the ConfigMap will not be created.

If the argument is omitted, the default value is used: default

Return value

An object of the K8sConfigmap class with information about the created ConfigMap.

Field

Type

Description

data

dict[str,str]

ConfigMap data as key: value pairs

name

str

The name of the ConfigMap

namespace

str

The name of the namespace in which the ConfigMap is created

Method signature, manifest examples, and example of using the method

list_configmaps

Get a list of names of all ConfigMaps in the specified namespace.

To get detailed information about an individual ConfigMap from the list, use the get_configmap_detail method.

Required token role: Administrator or User. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

The ID of the Cloud Spark cluster.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

namespace

(optional)

str

The name of the namespace for which to get the list of all ConfigMaps.

If the argument is omitted, the default value is used: default

Return value

An object of the K8sObjectNamesList[str] class that contains a list of names of all ConfigMaps in the specified namespace.

Method signature and example of use

get_configmap_detail

Get information about a ConfigMap with the specified name.

Required token role: Administrator or User. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

The ID of the Cloud Spark cluster.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

configmap_name

(required)

str

The name of the ConfigMap.

The list of names of all ConfigMaps can be obtained using the list_configmaps method

namespace

(optional)

str

The name of the namespace in which the ConfigMap is located.

If the argument is omitted, the default value is used: default

Return value

An object of the K8sConfigmap class with information about the ConfigMap with the specified name.

Field

Type

Description

data

dict[str,str]

ConfigMap data as key: value pairs

name

str

The name of the ConfigMap object

namespace

str

The name of the namespace in which the ConfigMap is located

Method signature and example of use

delete_configmap

Delete a ConfigMap with the specified name.

Required token role: Administrator. Learn more about token roles.

Method arguments

Argument

Type

Description

cluster_id

(required)

str

The ID of the Cloud Spark cluster.

The list of Cloud Spark clusters and their IDs can be obtained using the get_clusters method

configmap_name

(required)

str

The name of the ConfigMap.

The list of names of all ConfigMaps can be obtained using the list_configmaps method

namespace

(optional)

str

The name of the namespace in which the ConfigMap is located.

If the argument is omitted, the default value is used: default

Return value

No return value.

Method signature and example of use

Was this article helpful?