Skip to main content

☑️ Ensure Deployment has a configured `env` label

Having an env label is useful for performing bulk operations in specific environments or for filtering Deployments according to their stage. Recommended values for this key are: prod / staging / qa / admin / testing.

tip

FYI

Labels' keys and values are case-sensitive!

Targeted objects by this rule (types of kind): Deployment

Complexity: medium (What does this mean?)

Policy as code identifier: DEPLOYMENT_MISSING_LABEL_ENV_VALUE


This rule will fail

If the env key is missing from the labels section

kind: Deployment
metadata:
labels:
owner: yoda-at-datree.io

Rule output in the CLI

$ datree test *.yaml

>> File: failExample.yaml
❌ Ensure Deployment has a configured `env` label [1 occurrence]
💡 Missing label object `env` - add a proper environment description (e.g. `prod`, `testing`, etc.) to the Deployment config

How to fix this failure

kind: Deployment
metadata:
labels:
env: prod
owner: yoda-at-datree.io

Read more