Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helm): All recommended Kubernetes labels #1538

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Comment on lines +50 to +53
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I think is a good idea

{{- 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 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grafana-operator.selectorLabels don't include .Values.additionalLabels, so removing the with block is a breaking change; since this change landed, it's not possible to set additional pod labels.

I believe this can be easily fixed by including grafana-operator.labels instead:

Suggested change
{{- include "grafana-operator.selectorLabels" . | nindent 8 }}
{{- include "grafana-operator.labels" . | 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
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
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
Loading