Skip to content

Commit a20fc0b

Browse files
authored
feat(helm): Allow specifying podAnnotations per deployment (#13388)
Fixes #13389 Values added: - `destinationController.podAnnotations` - annotations only for `linkerd-destination` - `identity.podAnnotations` - annotations only for `linkerd-identity` - `proxyInjector.podAnnotations` - annotations only for `linkerd-proxy-injector` Each deployment's podAnnotations take precedence over global one by means of [mergeOverwrite](https://helm.sh/docs/chart_template_guide/function_list/#mergeoverwrite-mustmergeoverwrite). Signed-off-by: Takumi Sue <[email protected]>
1 parent 396af7c commit a20fc0b

27 files changed

+103
-126
lines changed

charts/linkerd-control-plane/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Kubernetes: `>=1.22.0-0`
163163
| destinationController.meshedHttp2ClientProtobuf.keep_alive.interval.seconds | int | `10` | |
164164
| destinationController.meshedHttp2ClientProtobuf.keep_alive.timeout.seconds | int | `3` | |
165165
| destinationController.meshedHttp2ClientProtobuf.keep_alive.while_idle | bool | `true` | |
166+
| destinationController.podAnnotations | object | `{}` | Additional annotations to add to destination pods |
166167
| destinationController.readinessProbe.timeoutSeconds | int | `1` | |
167168
| disableHeartBeat | bool | `false` | Set to true to not start the heartbeat cronjob |
168169
| disableIPv6 | bool | `true` | disables routing IPv6 traffic in addition to IPv4 traffic through the proxy (IPv6 routing only available as of proxy-init v2.3.0 and linkerd-cni v1.4.0) |
@@ -183,6 +184,7 @@ Kubernetes: `>=1.22.0-0`
183184
| identity.kubeAPI.clientBurst | int | `200` | Burst value over clientQPS |
184185
| identity.kubeAPI.clientQPS | int | `100` | Maximum QPS sent to the kube-apiserver before throttling. See [token bucket rate limiter implementation](https://github.com/kubernetes/client-go/blob/v12.0.0/util/flowcontrol/throttle.go) |
185186
| identity.livenessProbe.timeoutSeconds | int | `1` | |
187+
| identity.podAnnotations | object | `{}` | Additional annotations to add to identity pods |
186188
| identity.readinessProbe.timeoutSeconds | int | `1` | |
187189
| identity.serviceAccountTokenProjection | bool | `true` | Use [Service Account token Volume projection](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#service-account-token-volume-projection) for pod validation instead of the default token |
188190
| identityTrustAnchorsPEM | string | `""` | Trust root certificate (ECDSA). It must be provided during install. |
@@ -311,6 +313,7 @@ Kubernetes: `>=1.22.0-0`
311313
| proxyInjector.livenessProbe.timeoutSeconds | int | `1` | |
312314
| proxyInjector.namespaceSelector | object | `{"matchExpressions":[{"key":"config.linkerd.io/admission-webhooks","operator":"NotIn","values":["disabled"]},{"key":"kubernetes.io/metadata.name","operator":"NotIn","values":["kube-system","cert-manager"]}]}` | Namespace selector used by admission webhook. |
313315
| proxyInjector.objectSelector | object | `{"matchExpressions":[{"key":"linkerd.io/control-plane-component","operator":"DoesNotExist"},{"key":"linkerd.io/cni-resource","operator":"DoesNotExist"}]}` | Object selector used by admission webhook. |
316+
| proxyInjector.podAnnotations | object | `{}` | Additional annotations to add to proxy-injector pods |
314317
| proxyInjector.readinessProbe.timeoutSeconds | int | `1` | |
315318
| proxyInjector.timeoutSeconds | int | `10` | Timeout in seconds before the API Server cancels a request to the proxy injector. If timeout is exceeded, the webhookfailurePolicy is used. |
316319
| revisionHistoryLimit | int | `10` | Specifies the number of old ReplicaSets to retain to allow rollback. |

charts/linkerd-control-plane/templates/destination.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ spec:
163163
checksum/config: {{ include (print $.Template.BasePath "/destination-rbac.yaml") . | sha256sum }}
164164
{{ include "partials.annotations.created-by" . }}
165165
{{- include "partials.proxy.annotations" . | nindent 8}}
166-
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
166+
{{- with (mergeOverwrite (deepCopy .Values.podAnnotations) .Values.destinationController.podAnnotations) }}{{ toYaml . | trim | nindent 8 }}{{- end }}
167167
config.linkerd.io/default-inbound-policy: "all-unauthenticated"
168168
labels:
169169
linkerd.io/control-plane-component: destination

charts/linkerd-control-plane/templates/identity.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ spec:
136136
annotations:
137137
{{ include "partials.annotations.created-by" . }}
138138
{{- include "partials.proxy.annotations" . | nindent 8}}
139-
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
139+
{{- with (mergeOverwrite (deepCopy .Values.podAnnotations) .Values.identity.podAnnotations) }}{{ toYaml . | trim | nindent 8 }}{{- end }}
140140
config.linkerd.io/default-inbound-policy: "all-unauthenticated"
141141
labels:
142142
linkerd.io/control-plane-component: identity

charts/linkerd-control-plane/templates/proxy-injector.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
checksum/config: {{ include (print $.Template.BasePath "/proxy-injector-rbac.yaml") . | sha256sum }}
4343
{{ include "partials.annotations.created-by" . }}
4444
{{- include "partials.proxy.annotations" . | nindent 8}}
45-
{{- with .Values.podAnnotations }}{{ toYaml . | trim | nindent 8 }}{{- end }}
45+
{{- with (mergeOverwrite (deepCopy .Values.podAnnotations) .Values.identity.podAnnotations) }}{{ toYaml . | trim | nindent 8 }}{{- end }}
4646
config.linkerd.io/opaque-ports: "8443"
4747
config.linkerd.io/default-inbound-policy: "all-unauthenticated"
4848
labels:

charts/linkerd-control-plane/values.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ destinationController:
384384
timeout:
385385
seconds: 3
386386
while_idle: true
387+
# -- Additional annotations to add to destination pods
388+
podAnnotations: {}
387389
livenessProbe:
388390
timeoutSeconds: 1
389391
readinessProbe:
@@ -428,6 +430,9 @@ identity:
428430
429431
kubeAPI: *kubeapi
430432

433+
# -- Additional annotations to add to identity pods
434+
podAnnotations: {}
435+
431436
livenessProbe:
432437
timeoutSeconds: 1
433438
readinessProbe:
@@ -505,6 +510,9 @@ proxyInjector:
505510
# for more information.
506511
injectCaFromSecret: ""
507512

513+
# -- Additional annotations to add to proxy-injector pods
514+
podAnnotations: {}
515+
508516
livenessProbe:
509517
timeoutSeconds: 1
510518
readinessProbe:
@@ -668,4 +676,3 @@ podMonitor:
668676
egress:
669677
# -- The namespace that is used to store egress configuration that affects all client workloads in the cluster
670678
globalEgressNetworkNamespace: linkerd-egress
671-

cli/cmd/install_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestRender(t *testing.T) {
6060
CNIEnabled: false,
6161
IdentityTrustDomain: defaultValues.IdentityTrustDomain,
6262
IdentityTrustAnchorsPEM: defaultValues.IdentityTrustAnchorsPEM,
63-
DestinationController: map[string]any{},
63+
DestinationController: defaultValues.DestinationController,
6464
PodAnnotations: map[string]string{},
6565
PodLabels: map[string]string{},
6666
PriorityClassName: "PriorityClassName",

cli/cmd/testdata/install_controlplane_tracing_output.golden

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_custom_domain.golden

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_custom_registry.golden

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/cmd/testdata/install_default.golden

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)