Skip to content

Commit

Permalink
Merge pull request #1538 from nlamirault/feat/labels
Browse files Browse the repository at this point in the history
feat(helm): All recommended Kubernetes labels
  • Loading branch information
theSuess authored Jun 3, 2024
2 parents 8bfec3f + 815c1f3 commit 46d60b0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 24 deletions.
4 changes: 4 additions & 0 deletions deploy/helm/grafana-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ helm.sh/chart: {{ include "grafana-operator.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/part-of: grafana-operator
{{- with .Values.additionalLabels }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
Expand Down
5 changes: 2 additions & 3 deletions deploy/helm/grafana-operator/templates/cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ metadata:
name: {{ include "grafana-operator.fullname" . }}
namespace: {{ include "grafana-operator.namespace" . }}
labels:
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- include "grafana-operator.labels" . | nindent 4 }}
app.kubernetes.io/component: operator
data:
controller_manager_config.yaml: |
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
Expand Down
8 changes: 2 additions & 6 deletions deploy/helm/grafana-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ metadata:
namespace: {{ include "grafana-operator.namespace" . }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: operator
spec:
replicas: 1
selector:
Expand All @@ -21,9 +19,7 @@ spec:
{{- end }}
labels:
{{- include "grafana-operator.selectorLabels" . | nindent 8 }}
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
app.kubernetes.io/component: operator
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
Expand Down
8 changes: 2 additions & 6 deletions deploy/helm/grafana-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ metadata:
name: {{ include "grafana-operator.fullname" $ }}
labels:
{{- include "grafana-operator.labels" $ | nindent 4 }}
{{- with $.Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: operator
rules:
{{- toYaml $rbac.rules | nindent 2 }}
{{- if $isOpenShift }}
Expand All @@ -39,9 +37,7 @@ metadata:
{{- end }}
labels:
{{- include "grafana-operator.labels" $ | nindent 4 }}
{{- with $.Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: operator
subjects:
- kind: ServiceAccount
name: {{ include "grafana-operator.serviceAccountName" $ }}
Expand Down
4 changes: 1 addition & 3 deletions deploy/helm/grafana-operator/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ metadata:
namespace: {{ include "grafana-operator.namespace" . }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: operator
spec:
type: {{ .Values.metricsService.type }}
ports:
Expand Down
4 changes: 1 addition & 3 deletions deploy/helm/grafana-operator/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ metadata:
namespace: {{ include "grafana-operator.namespace" . }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: operator
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
4 changes: 1 addition & 3 deletions deploy/helm/grafana-operator/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ metadata:
namespace: {{ include "grafana-operator.namespace" . }}
labels:
{{- include "grafana-operator.labels" . | nindent 4 }}
{{- with .Values.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app.kubernetes.io/component: operator
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down

0 comments on commit 46d60b0

Please sign in to comment.