Skip to content

ConfigMap

Bases: DuploResourceV3

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

Commands

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

Returns:

Name Type Description
message dict

Success message.

Parameters:

--file, -f, --cli-input
A file to read the input from
FileType('r') action: YamlAction
--patches, --add, --remove, --copy, --replace, --test, --move
The json patch to apply
str action: JsonPatchAction

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

Returns:

Name Type Description
message dict

The created resource or success message.

Raises:

Type Description
DuploError

If the Configmap could not be created.

Model: V1ConfigMap
{
  "$defs": {
    "V1ManagedFieldsEntry": {
      "description": "V1ManagedFieldsEntry",
      "properties": {
        "apiVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Apiversion"
        },
        "fieldsType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Fieldstype"
        },
        "fieldsV1": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Fieldsv1"
        },
        "manager": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Manager"
        },
        "operation": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Operation"
        },
        "time": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Time"
        }
      },
      "title": "V1ManagedFieldsEntry",
      "type": "object"
    },
    "V1ObjectMeta": {
      "description": "V1ObjectMeta",
      "properties": {
        "annotations": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Annotations"
        },
        "clusterName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Clustername"
        },
        "creationTimestamp": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Creationtimestamp"
        },
        "deletionGracePeriodSeconds": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deletiongraceperiodseconds"
        },
        "deletionTimestamp": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deletiontimestamp"
        },
        "finalizers": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Finalizers"
        },
        "generateName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Generatename"
        },
        "generation": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Generation"
        },
        "labels": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Labels"
        },
        "managedFields": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/V1ManagedFieldsEntry"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Managedfields"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "namespace": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Namespace"
        },
        "ownerReferences": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/V1OwnerReference"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Ownerreferences"
        },
        "resourceVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Resourceversion"
        },
        "selfLink": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Selflink"
        },
        "uid": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Uid"
        }
      },
      "title": "V1ObjectMeta",
      "type": "object"
    },
    "V1OwnerReference": {
      "description": "V1OwnerReference",
      "properties": {
        "apiVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Apiversion"
        },
        "blockOwnerDeletion": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Blockownerdeletion"
        },
        "controller": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Controller"
        },
        "kind": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Kind"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "uid": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Uid"
        }
      },
      "title": "V1OwnerReference",
      "type": "object"
    }
  },
  "description": "V1ConfigMap",
  "properties": {
    "apiVersion": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Apiversion"
    },
    "binaryData": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "format": "binary",
                "type": "string"
              },
              {
                "type": "string"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Binarydata"
    },
    "data": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Data"
    },
    "immutable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Immutable"
    },
    "kind": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Kind"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/V1ObjectMeta"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "title": "V1ConfigMap",
  "type": "object"
}

Parameters:

name positional
The resource name
str
--file, -f, --cli-input
A file to read the input from
V1ConfigMap action: YamlAction
--fromfile, --from-file, --from-literal
A file or literal value to add to the data map
str action: DataMapAction
--dryrun, --dry-run
Do not submit any changes to the server, just print the data to the console.

delete

Delete ConfigMap

Deletes the specified ConfigMap by name.

cli
duploctl configmap delete <name>

Returns:

Name Type Description
message dict

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

Parameters:

name positional
The resource name
str

find

Find a ConfigMap.

Retrieve details of a specific ConfigMap by name

cli usage
duploctl configmap find <name>

Returns:

Name Type Description
message dict

The resource content or success message.

Raises:

Type Description
DuploError

ConfigMap not found.

Parameters:

name positional
The resource name
str

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

Returns:

Name Type Description
message dict

The updated ConfigMap or a success message.

Raises:

Type Description
DuploError

If the ConfigMap update fails.

Model: V1ConfigMap
{
  "$defs": {
    "V1ManagedFieldsEntry": {
      "description": "V1ManagedFieldsEntry",
      "properties": {
        "apiVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Apiversion"
        },
        "fieldsType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Fieldstype"
        },
        "fieldsV1": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Fieldsv1"
        },
        "manager": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Manager"
        },
        "operation": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Operation"
        },
        "time": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Time"
        }
      },
      "title": "V1ManagedFieldsEntry",
      "type": "object"
    },
    "V1ObjectMeta": {
      "description": "V1ObjectMeta",
      "properties": {
        "annotations": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Annotations"
        },
        "clusterName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Clustername"
        },
        "creationTimestamp": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Creationtimestamp"
        },
        "deletionGracePeriodSeconds": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deletiongraceperiodseconds"
        },
        "deletionTimestamp": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Deletiontimestamp"
        },
        "finalizers": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Finalizers"
        },
        "generateName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Generatename"
        },
        "generation": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Generation"
        },
        "labels": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Labels"
        },
        "managedFields": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/V1ManagedFieldsEntry"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Managedfields"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "namespace": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Namespace"
        },
        "ownerReferences": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/V1OwnerReference"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Ownerreferences"
        },
        "resourceVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Resourceversion"
        },
        "selfLink": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Selflink"
        },
        "uid": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Uid"
        }
      },
      "title": "V1ObjectMeta",
      "type": "object"
    },
    "V1OwnerReference": {
      "description": "V1OwnerReference",
      "properties": {
        "apiVersion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Apiversion"
        },
        "blockOwnerDeletion": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Blockownerdeletion"
        },
        "controller": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Controller"
        },
        "kind": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Kind"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "uid": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Uid"
        }
      },
      "title": "V1OwnerReference",
      "type": "object"
    }
  },
  "description": "V1ConfigMap",
  "properties": {
    "apiVersion": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Apiversion"
    },
    "binaryData": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "format": "binary",
                "type": "string"
              },
              {
                "type": "string"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Binarydata"
    },
    "data": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Data"
    },
    "immutable": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Immutable"
    },
    "kind": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Kind"
    },
    "metadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/V1ObjectMeta"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "title": "V1ConfigMap",
  "type": "object"
}

Parameters:

name positional
The resource name
str
--file, -f, --cli-input
A file to read the input from
V1ConfigMap action: YamlAction
--fromfile, --from-file, --from-literal
A file or literal value to add to the data map
str action: DataMapAction
--patches, --add, --remove, --copy, --replace, --test, --move
The json patch to apply
str action: JsonPatchAction
--dryrun, --dry-run
Do not submit any changes to the server, just print the data to the console.