From b389ac931be5cb3d3c6ece549c4c941b8295c975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BUISSON?= Date: Wed, 22 May 2024 18:07:00 +0200 Subject: [PATCH] feat: disable default helm labels (#3574) * feat: disable helm labels * fix: doc --- helm/aws-load-balancer-controller/README.md | 2 +- helm/aws-load-balancer-controller/templates/_helpers.tpl | 4 +++- helm/aws-load-balancer-controller/values.yaml | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/helm/aws-load-balancer-controller/README.md b/helm/aws-load-balancer-controller/README.md index 25638a348..56aae3d8d 100644 --- a/helm/aws-load-balancer-controller/README.md +++ b/helm/aws-load-balancer-controller/README.md @@ -277,5 +277,5 @@ The default values set by the application itself can be confirmed [here](https:/ | `autoscaling` | If `autoscaling.enabled=true`, enable the HPA on the controller mainly to survive load induced failure by the calls to the `aws-load-balancer-webhook-service`. Please keep in mind that the controller pods have `priorityClassName: system-cluster-critical`, enabling HPA may lead to the eviction of other low-priority pods in the node | `false` | | `serviceTargetENISGTags` | set of `key=value` pairs of AWS tags in addition to cluster name for finding the target ENI security group to which to add inbound rules from NLBs | None | | `loadBalancerClass` | Sets the AWS load balancer type to be used when the Kubernetes service requests an external load balancer | `service.k8s.aws/nlb` | - +| `creator` | if set to a `value!=helm`, it will disable the addition of default helm labels | `helm` | | `runtimeClassName` | Runtime class name for the controller pods , such as `gvisor` or `kata`. An unspecified `nil` or empty `""` RuntimeClassName is equivalent to the backwards-compatible default behavior as if the RuntimeClass feature is disabled. | "" | diff --git a/helm/aws-load-balancer-controller/templates/_helpers.tpl b/helm/aws-load-balancer-controller/templates/_helpers.tpl index 660f6ee9d..d916b99c4 100644 --- a/helm/aws-load-balancer-controller/templates/_helpers.tpl +++ b/helm/aws-load-balancer-controller/templates/_helpers.tpl @@ -45,12 +45,14 @@ This enables using a shorter name for the resources, for example aws-load-balanc Common labels */}} {{- define "aws-load-balancer-controller.labels" -}} +{{- if eq (default "helm" .Values.creator) "helm" -}} +app.kubernetes.io/managed-by: {{ .Release.Service }} helm.sh/chart: {{ include "aws-load-balancer-controller.chart" . }} +{{- end }} {{ include "aws-load-balancer-controller.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} {{- if .Values.additionalLabels }} {{ toYaml .Values.additionalLabels }} {{- end -}} diff --git a/helm/aws-load-balancer-controller/values.yaml b/helm/aws-load-balancer-controller/values.yaml index 6bc2b8a8f..07f5f0a6f 100644 --- a/helm/aws-load-balancer-controller/values.yaml +++ b/helm/aws-load-balancer-controller/values.yaml @@ -419,3 +419,6 @@ serviceTargetENISGTags: # Specifies the class of load balancer to use for services. This affects how services are provisioned if type LoadBalancer is used (default service.k8s.aws/nlb) loadBalancerClass: + +# creator will disable helm default labels, so you can only add yours +# creator: "me"