Ability to inject labels to Kubernetes entities generated via helm deployments
complete
U
Utrecht blue Sheep
For traceability we would like to inject labels to kubernetes entities generated via helm deployments.
We would like to be able to source the labels from harness variables or tags at the project, service, environment and pipeline level.
E.g. buildversion : <+pipeline.variables.buildVersion>
Log In
Shylaja Sundararajan
K8S deployments supports command flags as part of deployment steps as part of advanced configuration . Refer screenshot
Photo Viewer
View photos in a modal
Shylaja Sundararajan
updated the status to
complete
Shylaja Sundararajan
Following are the options that can be used to provide resource flags .
1. Label the Helm release itself
Use Command Flags on the Helm step or manifest:
```yaml
commandFlags:
- commandType: Install
flag: "--labels team=backend,env=prod"
- commandType: Upgrade
flag: "--labels team=backend,env=prod"
Command flags can be configured from Service Manifest . Refer attached screenshot
**2. Label Kubernetes resources created by the chart**
Use chart values through `--set`, but only if the chart supports label values:
```yaml
commandFlags:
- commandType: Install
flag: "--set podLabels.team=backend --set podLabels.env=prod"
- commandType: Upgrade
flag: "--set podLabels.team=backend --set podLabels.env=prod"
The exact path depends on the chart:
labels
, podLabels
, commonLabels
, extraLabels
, etc.Photo Viewer
View photos in a modal
I
Important Tiger
You can do this already in a manifest override file, no? Provide the override values from evaluated expressions at runtime to your helm chart
Sudarshan Purohit
updated the status to
under review