ConfigMap or Secret
The following table compares ConfigMaps and Secrets.Path and kind rules
Place ConfigMap manifests underruntimes/<env>/configmaps/, where <env> is the runtime, such as dev or test:
- The
configmaps/folder accepts only resources withkind: ConfigMap. - The
secrets/folder accepts only resources withkind: Secret. - Use the
.yamlor.ymlfile extension. - Place manifests directly in the
configmaps/folder. Argo CD doesn’t sync subfolders.
applications-live repository fails if the configmaps/ folder contains anything other than a ConfigMap, or if the secrets/ folder contains a ConfigMap. If the check fails, don’t merge the change. Move the file to the correct folder or correct its kind, and then push again.
Argo CD syncs the configmaps/ folder automatically with pruning and self-healing. If you remove a file from the folder, Argo CD deletes the ConfigMap from the cluster. If you change a ConfigMap directly in the cluster, Argo CD reverts the change.
If you need details about how a specific installation enforces these rules, contact your Managed Hosting team representative.
Create a ConfigMap
As with Secrets, don’t set themetadata.namespace field in the manifest. The platform creates the ConfigMap in the default namespace of the runtime. For more information about namespaces, see Deployment namespace.
In the following minimal example, you save the manifest as runtimes/test/configmaps/my-connector-config.yaml. The name and keys are examples:
Use a ConfigMap in a connector
Reference the ConfigMap by itsmetadata.name from the workload that runs in the same namespace. The following snippets show the standard Kubernetes mechanisms. How you pass them through the connector’s values depends on the chart, so check the chart’s values reference for the matching fields.
To pass a single key as an environment variable, use configMapKeyRef:
envFrom:
subPath. Restart the workload after you change a ConfigMap that you consume as environment variables or through a subPath mount.
Migrate ConfigMaps out of secrets/
If you previously stored a ConfigMap under runtimes/<env>/secrets/, move it:
- Move the manifest to
runtimes/<env>/configmaps/. - Recreate the manifest as plain YAML with the same keys and values. Confirm that the manifest contains no sensitive values. If you can’t recreate the manifest, contact your Managed Hosting team representative.
- Remove any manually set
metadata.namespace. - Keep the same
metadata.nameso that references continue to work. - Open a pull request and check the sync status in Argo CD after the merge.