From c16f08cd151ed00bdba4764779549ce0f1150b9b Mon Sep 17 00:00:00 2001 From: omer2500 <29802207+omer2500@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:50:55 +0200 Subject: [PATCH] feat(viz): add option to add labels to web service (#13305) Problem There is no option to add labels to the dashboard service (web) specifically for example, the use case of service mirror the dashboard service to make it accessible in another cluster needs the label: ``` mirror.linkerd.io/exported: 'true' ``` Solution Add option to add labels to dashboard service only Validation Run helm templates with couple of use cases to verify it adds new properties while not overwrite others. I agree to the DCO for all the commits in this PR. Signed-off-by: Alex Leong Co-authored-by: omer nitzan Co-authored-by: Alex Leong --- charts/linkerd2-cni/README.md | 2 +- viz/charts/linkerd-viz/README.md | 3 ++- viz/charts/linkerd-viz/templates/web.yaml | 1 + viz/charts/linkerd-viz/values.yaml | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/linkerd2-cni/README.md b/charts/linkerd2-cni/README.md index c5eea5f36991a..6e7ff10d5ab3c 100644 --- a/charts/linkerd2-cni/README.md +++ b/charts/linkerd2-cni/README.md @@ -68,4 +68,4 @@ Kubernetes: `>=1.22.0-0` | useWaitFlag | bool | `false` | Configures the CNI plugin to use the -w flag for the iptables command | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/viz/charts/linkerd-viz/README.md b/viz/charts/linkerd-viz/README.md index bb55c23deb19f..be55fbb8fe62e 100644 --- a/viz/charts/linkerd-viz/README.md +++ b/viz/charts/linkerd-viz/README.md @@ -86,8 +86,9 @@ Kubernetes: `>=1.22.0-0` | dashboard.resources.memory.limit | string | `nil` | Maximum amount of memory that web container can use | | dashboard.resources.memory.request | string | `nil` | Amount of memory that the web container requests | | dashboard.restrictPrivileges | bool | `false` | Restrict the Linkerd Dashboard's default privileges to disallow Tap and Check | -| dashboard.service | object | `{"annotations":{}}` | dashboard service configuration | +| dashboard.service | object | `{"annotations":{},"labels":{}}` | dashboard service configuration | | dashboard.service.annotations | object | `{}` | Additional annotations to add to dashboard service | +| dashboard.service.labels | object | `{}` | Additional labels to add to dashboard service | | defaultGID | int | `2103` | GID for all the viz components | | defaultImagePullPolicy | string | `"IfNotPresent"` | Docker imagePullPolicy for all viz components | | defaultLogFormat | string | `"plain"` | Log format (`plain` or `json`) for all the viz components. | diff --git a/viz/charts/linkerd-viz/templates/web.yaml b/viz/charts/linkerd-viz/templates/web.yaml index 32a58469ea89e..b63a267efcaca 100644 --- a/viz/charts/linkerd-viz/templates/web.yaml +++ b/viz/charts/linkerd-viz/templates/web.yaml @@ -12,6 +12,7 @@ metadata: component: web namespace: {{.Release.Namespace}} {{- with .Values.commonLabels }}{{ toYaml . | trim | nindent 4 }}{{- end }} + {{- with .Values.dashboard.service.labels }}{{ toYaml . | trim | nindent 4 }}{{ end }} annotations: {{ include "partials.annotations.created-by" . }} {{ with .Values.dashboard.service.annotations }}{{ toYaml . | trim | nindent 4 }}{{ end }} diff --git a/viz/charts/linkerd-viz/values.yaml b/viz/charts/linkerd-viz/values.yaml index 008e207b497ef..feea92a6cfade 100644 --- a/viz/charts/linkerd-viz/values.yaml +++ b/viz/charts/linkerd-viz/values.yaml @@ -405,6 +405,8 @@ dashboard: service: # -- Additional annotations to add to dashboard service annotations: {} + # -- Additional labels to add to dashboard service + labels: {} namespaceMetadata: image: