Skip to content

Commit

Permalink
Adding custom labels to helm template for deployments (#267)
Browse files Browse the repository at this point in the history
* adding labels to helm templates
* update chart version
  • Loading branch information
s-radyuk authored Aug 2, 2023
1 parent 47d308d commit ea2b3ce
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/kangal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- performance tests
- tests runner
name: kangal
version: 2.2.4
version: 2.2.5
home: https://github.com/hellofresh/kangal
icon: https://raw.githubusercontent.com/hellofresh/kangal/master/logo.svg
maintainers:
Expand Down
7 changes: 6 additions & 1 deletion charts/kangal/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: system-controller-kangal-controller-{{ $.Release.Namespace }}
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system-controller-kangal-controller-{{ $.Release.Namespace }}
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
rules:

- apiGroups:
Expand Down
6 changes: 6 additions & 0 deletions charts/kangal/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: system-controller-kangal-{{ $key }}-{{ $.Release.Namespace }}
{{- if $.Values.labels }}
labels:
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
5 changes: 5 additions & 0 deletions charts/kangal/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ metadata:
chart: {{ template "<CHARTNAME>.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
data:
{{ toYaml .Values.configMap | indent 2 }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/kangal/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ spec:
release: {{ $.Release.Name }}
environment: {{ $.Values.environment }}
version: "{{ if $value.tag }}{{ $value.tag }}{{ else if $.Values.tag }}{{ $.Values.tag }}{{ else }}{{ $.Chart.AppVersion }}{{ end }}"
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
{{- if or ($.Values.podAnnotations) ($value.podAnnotations) }}
annotations:
{{- with $.Values.podAnnotations }}
Expand Down
5 changes: 5 additions & 0 deletions charts/kangal/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ metadata:
chart: {{ template "<CHARTNAME>.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
{{- with $value.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
Expand Down
5 changes: 5 additions & 0 deletions charts/kangal/templates/prometheus-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ metadata:
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
prometheus: kube-prometheus
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
name: {{ template "<CHARTNAME>.fullname" $ }}-{{ $key }}
spec:
endpoints:
Expand Down
5 changes: 5 additions & 0 deletions charts/kangal/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ metadata:
chart: {{ template "<CHARTNAME>.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
data:
AWS_ACCESS_KEY_ID: {{ .Values.secrets.AWS_ACCESS_KEY_ID | b64enc }}
AWS_SECRET_ACCESS_KEY: {{ .Values.secrets.AWS_SECRET_ACCESS_KEY | b64enc }}
Expand Down
5 changes: 5 additions & 0 deletions charts/kangal/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ metadata:
chart: {{ template "<CHARTNAME>.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{$.Release.Service }}
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
{{- with $value.annotations }}
annotations:
{{ toYaml . | indent 4}}
Expand Down
5 changes: 5 additions & 0 deletions charts/kangal/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ metadata:
chart: {{ template "<CHARTNAME>.chart" $ }}
release: {{ $.Release.Name }}
heritage: {{ $.Release.Service }}
{{- if $.Values.labels }}
{{- with $.Values.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
{{- if ($value.serviceAccount.annotations) }}
annotations:
{{- with $value.serviceAccount.annotations }}
Expand Down

0 comments on commit ea2b3ce

Please sign in to comment.