Azure / dev-spaces

Azure Dev Spaces is retired, please use Bridge to Kubernetes.
MIT License
136 stars 306 forks source link

Feature request: Add support for extra Labels on PODs #281

Open Eneuman opened 4 years ago

Eneuman commented 4 years ago

Use case:

AKS is a requirement for using Dev Spaces. Alot of services developed for AKS are using other resources on Azure. The prefered way of securly accessing theese resources are by using Managed Identities.

To access Azure resources from from a POD (using Managed Identities), MS has developed "AAD Pod Identity".

To use AAD Pod Identity, the POD need to have a extra label with the name "aadpodidbinding" on it.

Today, adding a extra label to a POD requires you to hard code it into deployment.yaml

It would be great if you could add extra labels in the "values.yaml" file instead.

philon-msft commented 4 years ago

@Eneuman, thank you for the suggestion! We'll look into this and let you know what we find.

DrEsteban commented 4 years ago

@Eneuman If you'd prefer a values.yaml-based strategy for customizing the labels on your Pod, you can make updates to your Helm chart to support this. (Dev Spaces shouldn't get in the way.)

For example: values.yaml

deployment:
  podLabels:
    aadpodidbinding: foo

deployment.yaml (truncated)

spec:
  template:
    metadata:
      labels:
        app: {{ template "$CHART_NAME$.name" . }}
        draft: {{ .Values.draft | default "draft-app" }}
        release: {{ .Release.Name }}
        {{- range $key, $value := .Values.deployment.podLabels }}
        {{ $key }}: {{ $value }}
        {{- end }}