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

Add global.extraLabels values.yaml setting #1771

Merged
merged 3 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: api-gateway-controller
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.apiGateway.controller.replicas }}
selector:
Expand Down Expand Up @@ -46,6 +49,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: api-gateway-controller
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "consul.fullname" . }}-api-gateway-controller
containers:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/client-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: client
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .Values.client.updateStrategy }}
updateStrategy:
Expand All @@ -47,6 +50,9 @@ spec:
{{- if .Values.client.extraLabels }}
{{- toYaml .Values.client.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
{{- if .Values.global.secretsBackend.vault.enabled }}
"vault.hashicorp.com/agent-inject": "true"
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/cni-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: cni
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
{{- if .Values.connectInject.cni.updateStrategy }}
updateStrategy:
Expand All @@ -29,6 +32,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: cni
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
consul.hashicorp.com/connect-inject: "false"
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/connect-inject-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: connect-injector
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.connectInject.replicas }}
selector:
Expand All @@ -41,6 +44,9 @@ spec:
{{- if .Values.connectInject.extraLabels }}
{{- toYaml .Values.connectInject.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
{{- if .Values.connectInject.annotations }}
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/create-federation-secret-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: create-federation-secret
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,post-upgrade
{{- /* Hook weight needs to be 1 so that the service account is provisioned first */}}
Expand All @@ -29,6 +32,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: create-federation-secret
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/enterprise-license-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: license
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "100"
Expand All @@ -31,6 +34,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: license
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: gossip-encryption-autogenerate
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "1"
Expand All @@ -27,6 +30,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: gossip-encryption-autogenerate
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/ingress-gateways-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ metadata:
release: {{ $root.Release.Name }}
component: ingress-gateway
ingress-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }}
{{- if $root.Values.global.extraLabels }}
{{- toYaml $root.Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ default $defaults.replicas .replicas }}
selector:
Expand All @@ -66,6 +69,9 @@ spec:
component: ingress-gateway
ingress-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }}
consul.hashicorp.com/connect-inject-managed-by: consul-k8s-endpoints-controller
{{- if $root.Values.global.extraLabels }}
{{- toYaml $root.Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
"consul.hashicorp.com/gateway-kind": "ingress-gateway"
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/mesh-gateway-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: mesh-gateway
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.meshGateway.replicas }}
selector:
Expand All @@ -35,6 +38,9 @@ spec:
release: {{ .Release.Name }}
component: mesh-gateway
consul.hashicorp.com/connect-inject-managed-by: consul-k8s-endpoints-controller
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
"consul.hashicorp.com/gateway-kind": "mesh-gateway"
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/partition-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: partition-init
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "2"
Expand All @@ -28,6 +31,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: partition-init
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
{{- if (and .Values.global.secretsBackend.vault.enabled (or .Values.global.tls.enabled .Values.global.acls.manageSystemACLs)) }}
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/server-acl-init-cleanup-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: server-acl-init-cleanup
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-weight": "0"
Expand All @@ -39,6 +42,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: server-acl-init-cleanup
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/server-acl-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: server-acl-init
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
template:
metadata:
Expand All @@ -38,6 +41,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: server-acl-init
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
{{- if .Values.global.secretsBackend.vault.enabled }}
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: server
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
serviceName: {{ template "consul.fullname" . }}-server
podManagementPolicy: Parallel
Expand Down Expand Up @@ -59,6 +62,9 @@ spec:
{{- if .Values.server.extraLabels }}
{{- toYaml .Values.server.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
{{- if .Values.global.secretsBackend.vault.enabled }}
"vault.hashicorp.com/agent-inject": "true"
Expand Down
3 changes: 3 additions & 0 deletions charts/consul/templates/sync-catalog-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spec:
{{- if .Values.syncCatalog.extraLabels }}
{{- toYaml .Values.syncCatalog.extraLabels | nindent 8 }}
{{- end }}
{{- if .Values.global.extraLabels }}
Copy link
Contributor

Choose a reason for hiding this comment

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

In this file, we need to add extraLabels to .metadata.Labels as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch! I wrote tests for that bit too but my bats filtering accidentally excluded that one from running...

All tests for affected files pass on my end now, at least

{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
{{- if .Values.syncCatalog.annotations }}
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/terminating-gateways-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ metadata:
release: {{ $root.Release.Name }}
component: terminating-gateway
terminating-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }}
{{- if $root.Values.global.extraLabels }}
{{- toYaml $root.Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: {{ default $defaults.replicas .replicas }}
selector:
Expand All @@ -68,6 +71,9 @@ spec:
component: terminating-gateway
terminating-gateway-name: {{ template "consul.fullname" $root }}-{{ .name }}
consul.hashicorp.com/connect-inject-managed-by: consul-k8s-endpoints-controller
{{- if $root.Values.global.extraLabels }}
{{- toYaml $root.Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
"consul.hashicorp.com/gateway-kind": "terminating-gateway"
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/tls-init-cleanup-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: tls-init-cleanup
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded
Expand All @@ -27,6 +30,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: tls-init-cleanup
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/tls-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: tls-init
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "1"
Expand All @@ -27,6 +30,9 @@ spec:
chart: {{ template "consul.chart" . }}
release: {{ .Release.Name }}
component: tls-init
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
spec:
Expand Down
6 changes: 6 additions & 0 deletions charts/consul/templates/webhook-cert-manager-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ metadata:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: webhook-cert-manager
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
spec:
replicas: 1
selector:
Expand All @@ -28,6 +31,9 @@ spec:
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
component: webhook-cert-manager
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 8 }}
{{- end }}
annotations:
"consul.hashicorp.com/connect-inject": "false"
"consul.hashicorp.com/config-checksum": {{ include (print $.Template.BasePath "/webhook-cert-manager-configmap.yaml") . | sha256sum }}
Expand Down
Loading