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

adding the ability to define extraLabels for the kubernetes Service object #3600

Closed
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
5 changes: 5 additions & 0 deletions .changesets/feat_add_service_extraLabels_to_helm_chart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Helm: exposes extraLabels object for Service labels

You can now set extraLabels on the Service object in the helm chart.

By [@bjoernw](https://github.com/bjoernw) in https://github.com/apollographql/router/pull/3600
6 changes: 4 additions & 2 deletions helm/chart/router/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ extraLabels:
```
*/}}
{{- define "common.templatizeExtraLabels" -}}
{{- range $key, $value := .Values.extraLabels }}
{{ printf "%s: %s" $key (include "common.tplvalues.render" ( dict "value" $value "context" $))}}
{{- $extraLabels := .extraLabels -}}
{{- $ctx := .context -}}
{{- range $key, $value := $extraLabels }}
{{ printf "%s: %s" $key (include "common.tplvalues.render" (dict "value" $value "context" $ctx)) }}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions helm/chart/router/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
{{- include "router.labels" . | nindent 4 }}
{{- if .Values.extraLabels }}
{{- include "common.templatizeExtraLabels" . | nindent 4 }}
{{ include "common.templatizeExtraLabels" (dict "extraLabels" .Values.extraLabels "context" $) | nindent 4 }}
{{- end }}
{{/* There may not be much configuration so check that there is something */}}
{{- if (((((.Values.router).configuration).telemetry).metrics).prometheus).enabled }}
Expand Down Expand Up @@ -35,7 +35,7 @@ spec:
labels:
{{- include "router.selectorLabels" . | nindent 8 }}
{{- if .Values.extraLabels }}
{{- include "common.templatizeExtraLabels" . | nindent 8 }}
{{ include "common.templatizeExtraLabels" (dict "extraLabels" .Values.extraLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
Expand Down
3 changes: 3 additions & 0 deletions helm/chart/router/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ metadata:
name: {{ include "router.fullname" . }}
labels:
{{- include "router.labels" . | nindent 4 }}
{{- if .Values.service.extraLabels }}
{{ include "common.templatizeExtraLabels" (dict "extraLabels" .Values.service.extraLabels "context" $) | nindent 4 }}
{{- end }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions helm/chart/router/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ service:
type: ClusterIP
port: 80
annotations: {}
extraLabels: {}

serviceMonitor:
enabled: false
Expand Down