ConfigMaps Helper
Create Kubernetes ConfigMaps using the ohMyHelm configs and config helpers, including dontOverrideOnUpdate, volume mounts, and GitOps notes.
ConfigMaps Helper
ohMyHelm provides two root-level helpers for Kubernetes ConfigMap resources: the configs list (recommended for one or more ConfigMaps) and the config single object.
1. Multiple ConfigMaps (configs)
Each entry in configs[] supports exactly the four schema fields: name (required), namespace (optional, defaults to the release namespace), dontOverrideOnUpdate (optional boolean), and values (required map of key-value pairs).
configs:
- name: acme-app-config
namespace: acme-prod
dontOverrideOnUpdate: false
values:
config.yaml: |
server:
host: 0.0.0.0
port: 8080
logging:
level: info
format: json
- name: acme-env-vars
namespace: acme-prod
dontOverrideOnUpdate: false
values:
APP_ENV: "production"
FEATURE_SEARCH: "true"
MAX_WORKERS: "8"
Behavior of dontOverrideOnUpdate
When dontOverrideOnUpdate: true is set, omh-helper-config.yaml checks via lookup whether the ConfigMap already exists in the target namespace. If it does, existing values are preserved unchanged during helm upgrade.
2. Single ConfigMap (config)
Alternatively, there is the single-object helper config (omh-helper-singelConfig.yaml). According to values.schema.json, only the four fields enabled, name, namespace, and values are permitted under config (additionalProperties: false — no dontOverrideOnUpdate key!).
config:
enabled: true
name: acme-single-config
namespace: acme-prod
values:
settings.ini: |
[app]
mode = production
Using a ConfigMap in a Chart Workload
As Environment Variables (envFrom)
configs:
- name: acme-env-vars
namespace: acme-prod
values:
APP_ENV: "production"
LOG_LEVEL: "info"
chart:
enabled: true
fullnameOverride: "acme-app"
container:
image: registry.acme.corp/app:1.2.0
envFrom:
- configMapRef:
name: acme-env-vars
As a File via deploymentVolume (or statefulsetVolume / daemonsetVolume)
configs:
- name: acme-app-config
namespace: acme-prod
values:
config.yaml: |
server:
port: 8080
chart:
enabled: true
fullnameOverride: "acme-app"
container:
image: registry.acme.corp/app:1.2.0
deploymentVolume:
volumeMounts:
- name: app-config
mountPath: /etc/acme/config.yaml
subPath: config.yaml
readOnly: true
volumes:
- name: app-config
configMap:
name: acme-app-config
Limitations of This Helper
- No
tpltemplating:{{ .Values.* }}invaluesis not evaluated. - No
immutable: true, no custom labels/annotations: If you need an immutable ConfigMap (immutable: true) or custom labels, use themanifestshelper.