In SAE, configuration items correspond to the Kubernetes ConfigMap resource type. This topic describes how to create, view, update, and delete ConfigMaps using saectl, along with the supported YAML configuration fields.
Prerequisites
Before you begin, make sure you have:
Installed the saectl tool and configured it with an AccessKey ID, AccessKey secret, and deployment region. For setup instructions, see Install and configure the saectl tool.
Create a ConfigMap
Create a file named
cm.yamlwith the following content. For a description of each field, see YAML configuration fields.apiVersion: v1 kind: ConfigMap metadata: name: test-cm namespace: default data: product: "sae"From the directory containing
cm.yaml, run:saectl apply -f cm.yaml
View ConfigMaps
List ConfigMaps
saectl get cm <configmap-name> -n <namespace>Omit
<configmap-name>to return all ConfigMaps in the namespace.Omit
-n <namespace>to use the default namespace.
The output is similar to:
NAMESPACE NAME DATA AGE
default test-cm 1 5mThe output includes the following fields:
| Field | Description |
|---|---|
| NAMESPACE | The namespace of the ConfigMap. |
| NAME | The name of the ConfigMap. |
| DATA | The number of key-value pairs in the ConfigMap. |
| AGE | How long the ConfigMap has existed. |
View ConfigMap details
Use either get or describe to inspect a ConfigMap's configuration.
Using `get` — returns configuration in YAML or JSON format:
saectl get cm <configmap-name> -o {yaml | json} -n <namespace>Using `describe` — returns a human-readable summary:
saectl describe cm <configmap-name> -n <namespace>The output is similar to:
Name: test-cm
Namespace: default
Labels: <none>
Annotations: <none>
Data
====
product:
----
saeFor both commands, omit -n <namespace> to use the default namespace.
Update a ConfigMap
Two commands are available: edit for inline editing, and apply for file-based updates.
Only thedatafield can be updated. Fields such asmetadata.name,metadata.namespace, andmetadata.uidare read-only after creation.
Edit a ConfigMap inline
Open the ConfigMap's configuration in your editor:
saectl edit cm <configmap-name> -n <namespace>Modify the configuration as needed. Save and close the file to apply the changes.
Update a ConfigMap from a file
Modify cm.yaml, then run:
saectl apply -f cm.yamlDelete a ConfigMap
saectl delete cm <configmap-name> -n <namespace>Omit -n <namespace> to use the default namespace.
YAML configuration fields
The following table describes the ConfigMap fields supported in SAE.
| Field | Description |
|---|---|
metadata.name | The name of the ConfigMap. Read-only after creation. |
metadata.creationTimestamp | The time when the ConfigMap was created. Read-only. |
metadata.namespace | The namespace the ConfigMap belongs to. Read-only after creation. |
metadata.uid | The unique ID of the ConfigMap. Read-only. |
data | The key-value pairs stored in the ConfigMap. This is the only field that can be updated. |