You can use ConfigMaps as values for container environment variables. This validator detects a condition when a ConfigMap data key used as a source for environment variables in the container spec is not found. That can happen if the ConfigMap data key was deleted or renamed, or there was a typo in the envFrom.configMapKeyRef. Note that this check is skipped when the reference is marked as optional.
Affected Resources: Deployment, DaemonSet, StatefulSet, CronJob, Job, ReplicaSet, Pod
kind: Deployment
spec:
template:
spec:
containers:
- name: my-container
env:
- name: MY_ENV_VAR
valueFrom:
configMapKeyRef:
name: my-config-map
key: bar # Key bar not present in the configMap
optional: false
kind: ConfigMap
metadata:
name: my-config-map
data:
foo: bar
Please let us know if there are other built-in validation rules you would like to see in Kubevious to detect misconfigurations and violations to best practices. Optionally, you can provide your details so we can reach out to you with follow-up questions.