Skip to content

ConfigMap

Bases: DuploTenantResourceV3

Kubernetes ConfigMaps

This class offers methods to manage Kubernetes ConfigMaps within DuploCloud.

See more details at: https://docs.duplocloud.com/docs/kubernetes-overview/configs-and-secrets

apply

Apply a ConfigMap

Create or Update a ConfigMap resource with Duplocloud cli.

CLI Usage

duploctl configmap apply -f 'configmap.yaml'
Contents of the configmap.yaml file
metadata:
  name: duploctl
data:
  foo: bar

Parameters:

Name Type Description Default
body BODY

The resource to apply.

required
wait WAIT

Wait for the resource to be created.

False
patches PATCHES

The patches to apply to the resource.

None

Returns:

Name Type Description
message dict

Success message.

create

Create a Configmap resource.

Creates a new kubernetes ConfigMap resource with the specified metadata and data entries.

CLI Usage

duploctl configmap create -f configmap.yaml
Contents of the configmap.yaml file
metadata:
  name: duploctl
data:
  foo: bar

Create a ConfigMap using a one-liner.
echo """
metadata:
  name: duploctl
data:
  foo: bar

""" | duploctl configmap create -f -
Create a ConfigMap using a file.
duploctl configmap create -f configmap.yaml
Create a ConfigMap by specifying key-value pairs as literals.
duploctl configmap create <configmap-name> --from-literal Key1="Val1" --from-literal Key2="Val2"
Create a ConfigMap from a file.
duploctl configmap create <configmap-name> --from-file config-map.txt

Parameters:

Name Type Description Default
name NAME

Name of the ConfigMap. Required if body is not provided.

None
body BODY

The complete ConfigMap resource definition.

None
data DATAMAP

Data to merge into the ConfigMap.

None
dryrun DRYRUN

Do not submit any changes to the server.

False

Returns:

Name Type Description
message dict

The created resource or success message.

Raises:

Type Description
DuploError

If the Configmap could not be created.

delete

Delete ConfigMap

Deletes the specified ConfigMap by name.

cli
duploctl configmap delete <name>

Parameters:

Name Type Description Default
name NAME

The name of a ConfigMap to delete.

required

Returns:

Name Type Description
message dict

Returns a success message if deleted successfully; otherwise, an error.

find

Find a ConfigMap.

Retrieve details of a specific ConfigMap by name

cli usage
duploctl configmap find <name>

Parameters:

Name Type Description Default
name NAME

The name of the ConfigMap to find.

required

Returns:

Name Type Description
message dict

The resource content or success message.

Raises:

Type Description
DuploError

ConfigMap not found.

list

Retrieve a List of ConfigMap resources

cli usage
duploctl configmap list

Returns:

Name Type Description
list list

A list of ConfigMap.

update

Updates a ConfigMap resource.

This function allows you to modify the contents of a ConfigMap without deleting or recreating it.

CLI Usage

duploctl configmap update -f configmap.yaml
Contents of the configmap.yaml file
metadata:
  name: duploctl
data:
  foo: bar

Update configmap using a one-liner.
echo """
metadata:
  name: duploctl
data:
  foo: bar

""" | duploctl configmap update -f -
Add new key in the configmap.
duploctl configmap update <configmap-name> --add /data/NewKey NewValue
Update existing key from the configmap.
duploctl configmap update <configmap-name> --replace /data/ExistingKey NewValue
Delete existing key from the configmap.
duploctl configmap update <configmap-name> --remove /data/ExistingKey
Update a ConfigMap by specifying key-value pairs as literals.
duploctl configmap update <configmap-name> --from-literal Key1="Val1" --from-literal Key2="Val2"
Update a ConfigMap from a file.
duploctl configmap update <configmap-name> --from-file config-map.txt

Parameters:

Name Type Description Default
name NAME

Name of the ConfigMap. Required if body is not provided.

required
body BODY

The complete ConfigMap resource definition.

None
data DATAMAP

Data to merge into the ConfigMap.

None
patches PATCHES

A list of JSON patches as args to apply to the service. The options are --add, --remove, --replace, --move, and --copy. Then followed by <path> and <value> for --add, --replace, and --test.

None
dryrun bool

If True, return the modified ConfigMap without applying changes.

False

Returns:

Name Type Description
message dict

The updated ConfigMap or a success message.

Raises:

Type Description
DuploError

If the ConfigMap update fails.