diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 4dacfb9..4154b99 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -1,10 +1,3 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "py-kube-downscaler.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -34,14 +27,19 @@ Create chart name and version as used by the chart label. Common labels */}} {{- define "py-kube-downscaler.labels" -}} -application: {{ include "py-kube-downscaler.name" . }} +helm.sh/chart: {{ include "py-kube-downscaler.chart" . }} +{{ include "py-kube-downscaler.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{/* Selector labels */}} {{- define "py-kube-downscaler.selectorLabels" -}} -application: {{ include "py-kube-downscaler.name" . }} +application: {{ include "py-kube-downscaler.fullname" . }} {{- end }} {{/* diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index b513217..007d081 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: labels: {{- include "py-kube-downscaler.labels" . | nindent 4 }} - name: {{ include "py-kube-downscaler.name" . }} + name: {{ include "py-kube-downscaler.fullname" . }} spec: replicas: {{ .Values.replicaCount }} selector: diff --git a/chart/templates/rbac.yaml b/chart/templates/rbac.yaml index 408a45a..bbbc161 100644 --- a/chart/templates/rbac.yaml +++ b/chart/templates/rbac.yaml @@ -9,7 +9,7 @@ metadata: {{- end }} {{- $releaseNamespace := .Release.Namespace }} -{{- $name := include "py-kube-downscaler.name" . }} +{{- $name := include "py-kube-downscaler.fullname" . }} {{- $serviceAccountName := include "py-kube-downscaler.serviceAccountName" . }} {{- range $namespace := .Values.constrainedNamespaces }} apiVersion: rbac.authorization.k8s.io/v1 @@ -130,7 +130,7 @@ subjects: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: {{ include "py-kube-downscaler.name" . }} + name: {{ include "py-kube-downscaler.fullname" . }} rules: - apiGroups: - "" @@ -281,11 +281,11 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: {{ include "py-kube-downscaler.name" . }} + name: {{ include "py-kube-downscaler.fullname" . }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: {{ include "py-kube-downscaler.name" . }} + name: {{ include "py-kube-downscaler.fullname" . }} subjects: - kind: ServiceAccount name: {{ include "py-kube-downscaler.serviceAccountName" . }}