Skip to content

Migrate to Helm's recommended standard labels #273

@cognifloyd

Description

@cognifloyd

Currently we have labeled our Deployments, Pods, and Jobs and other k8s resources with:

metadata:
  labels:
    app: st2auth # or st2api, st2actionrunner, st2web, etc
    tier: backend # or frontend
    vendor: stackstorm
    chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  selector:
    matchLabels:
      app: st2auth
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        # repeat the labels from above

We should migrate to the standard labels recommend in Helm's "Best Practices" doc.
https://helm.sh/docs/chart_best_practices/labels/#standard-labels

At a glance, I think these could work:

metadata:
  labels:
    app.kubernetes.io/name: st2auth # or st2api, st2actionrunner, st2web, etc
    app.kubernetes.io/component: backend # or frontend
    app.kubernetes.io/part-of: stackstorm
    app.kubernetes.io/version: {{ .Chart.AppVersion }}
    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: st2auth
      app.kubernetes.io/instance: {{ .Release.Name }}
  template:
    metadata:
      labels:
        # repeat the labels from above

Both labels and label selectors would need to be updated.

A lot of charts define these labels in a helper template. It would be good to do the same in this chart to reduce the duplication.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions