Closed ryo-yamaoka closed 2 years ago
score/container: To detect duplicate defined environment variables.
Fixes #448
$ ./kube-score score ~/test.yaml apps/v1/Deployment sample-deployment 💥 [CRITICAL] Environment Variable Key Duplication · sampleA -> Environment Variable Key Duplication Container environment variable key 'SAMPLE_ENV_VAR' duplicated · sampleB -> Environment Variable Key Duplication Container environment variable key 'SAMPLE_ENV_VAR1' duplicated · sampleB -> Environment Variable Key Duplication Container environment variable key 'SAMPLE_ENV_VAR2' duplicated
apiVersion: apps/v1 kind: Deployment metadata: name: sample-deployment labels: app: sample annotations: kube-score/ignore: pod-networkpolicy,container-resources,container-image-pull-policy,container-security-context-privileged,container-security-context-user-group-id,container-security-context-readonlyrootfilesystem,container-ephemeral-storage-request-and-limit,container-image-tag spec: replicas: 1 selector: matchLabels: app: sample template: metadata: labels: app: sample spec: containers: - name: sampleA image: sample:latest ports: - containerPort: 80 env: - name: SAMPLE_ENV_VAR value: sample1 - name: SAMPLE_ENV_VAR value: sample1 - name: sampleB image: sample:latest ports: - containerPort: 80 env: - name: SAMPLE_ENV_VAR1 value: sample1 - name: SAMPLE_ENV_VAR1 value: sample1 - name: SAMPLE_ENV_VAR2 value: sample2 - name: SAMPLE_ENV_VAR2 value: sample2
@zegl @atombrella Thanks for review, I fixed those.
Build succeeded:
score/container: To detect duplicate defined environment variables.
Fixes #448
behaviour