One of the most common uses of ConfigMap is to mount it to a container file system or use it as environment variables. This validator detects when a ConfigMap is not mounted to a volume and not used as container environment variables. That can be an indication of a typo in a ConfigMap name or ConfigMap references in volume mount, projections, or environment variables.
Affected Resources: ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: config-foo # This ConfigMap is not used elsewhere
data:
my-key: my-value
kind: Deployment
spec:
template:
spec:
containers:
- name: my-container
env:
- name: MY_ENV_VAR
valueFrom:
configMapKeyRef:
name: config-foo-1 # This ConfigMap is not present
key: my-key
envFrom:
- configMapRef:
name: config-foo-2 # This ConfigMap is not present
kind: Deployment
spec:
template:
spec:
volumes:
- name: my-config-volume
configMap:
name: config-bar # This ConfigMap is not present
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.