From 1a3ee22def1c9c0b4540861cc84ceaca34815568 Mon Sep 17 00:00:00 2001 From: michaelhtm <98621731+michaelhtm@users.noreply.github.com> Date: Wed, 14 May 2025 13:30:16 -0700 Subject: [PATCH] feat: Make helm chart names dynamic extra changes: add labels to roles/rolebindings --- templates/helm/templates/caches-role-binding.yaml.tpl | 8 ++++---- templates/helm/templates/caches-role.yaml.tpl | 4 ++-- templates/helm/templates/cluster-role-binding.yaml.tpl | 2 +- templates/helm/templates/cluster-role-controller.yaml.tpl | 4 ++-- .../helm/templates/leader-election-role-binding.yaml.tpl | 4 ++-- templates/helm/templates/leader-election-role.yaml.tpl | 2 +- templates/helm/templates/role-reader.yaml.tpl | 2 +- templates/helm/templates/role-writer.yaml.tpl | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/templates/helm/templates/caches-role-binding.yaml.tpl b/templates/helm/templates/caches-role-binding.yaml.tpl index 57b753f7..e4e7761e 100644 --- a/templates/helm/templates/caches-role-binding.yaml.tpl +++ b/templates/helm/templates/caches-role-binding.yaml.tpl @@ -1,11 +1,11 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: ack-namespaces-cache-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-namespaces-cache roleRef: kind: ClusterRole apiGroup: rbac.authorization.k8s.io - name: ack-namespaces-cache-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-namespaces-cache subjects: - kind: ServiceAccount name: {{ IncludeTemplate "service-account.name" }} @@ -14,12 +14,12 @@ subjects: apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: ack-configmaps-cache-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-configmaps-cache namespace: {{ "{{ .Release.Namespace }}" }} roleRef: kind: Role apiGroup: rbac.authorization.k8s.io - name: ack-configmaps-cache-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-configmaps-cache subjects: - kind: ServiceAccount name: {{ IncludeTemplate "service-account.name" }} diff --git a/templates/helm/templates/caches-role.yaml.tpl b/templates/helm/templates/caches-role.yaml.tpl index 9451709b..7f4a679d 100644 --- a/templates/helm/templates/caches-role.yaml.tpl +++ b/templates/helm/templates/caches-role.yaml.tpl @@ -1,7 +1,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: ack-namespaces-cache-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-namespaces-cache rules: - apiGroups: - "" @@ -15,7 +15,7 @@ rules: apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: ack-configmaps-cache-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-configmaps-cache namespace: {{ "{{ .Release.Namespace }}" }} rules: - apiGroups: diff --git a/templates/helm/templates/cluster-role-binding.yaml.tpl b/templates/helm/templates/cluster-role-binding.yaml.tpl index 78e50682..d9eb0bb4 100644 --- a/templates/helm/templates/cluster-role-binding.yaml.tpl +++ b/templates/helm/templates/cluster-role-binding.yaml.tpl @@ -27,7 +27,7 @@ metadata: roleRef: kind: Role apiGroup: rbac.authorization.k8s.io - name: ack-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-controller subjects: - kind: ServiceAccount name: {{ "{{ $serviceAccountName }}" }} diff --git a/templates/helm/templates/cluster-role-controller.yaml.tpl b/templates/helm/templates/cluster-role-controller.yaml.tpl index 378b284f..0da69cab 100644 --- a/templates/helm/templates/cluster-role-controller.yaml.tpl +++ b/templates/helm/templates/cluster-role-controller.yaml.tpl @@ -4,7 +4,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: ack-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-controller labels: {{ "{{- range $key, $value := $labels }}" }} {{ "{{ $key }}: {{ $value | quote }}" }} @@ -18,7 +18,7 @@ metadata: apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: ack-{{ .ControllerName }}-controller + name: {{ IncludeTemplate "app.fullname" }}-controller namespace: {{ "{{ . }}" }} labels: {{ "{{- range $key, $value := $labels }}" }} diff --git a/templates/helm/templates/leader-election-role-binding.yaml.tpl b/templates/helm/templates/leader-election-role-binding.yaml.tpl index 005c1820..0c8833a5 100644 --- a/templates/helm/templates/leader-election-role-binding.yaml.tpl +++ b/templates/helm/templates/leader-election-role-binding.yaml.tpl @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: {{.ControllerName}}-leader-election-rolebinding + name: {{ IncludeTemplate "app.fullname" }}-leader-election-rolebinding {{ "{{ if .Values.leaderElection.namespace }}" }} namespace: {{ "{{ .Values.leaderElection.namespace }}" }} {{ "{{ else }}" }} @@ -11,7 +11,7 @@ metadata: roleRef: apiGroup: rbac.authorization.k8s.io kind: Role - name: {{.ControllerName}}-leader-election-role + name: {{ IncludeTemplate "app.fullname" }}-leader-election-role subjects: - kind: ServiceAccount name: {{ IncludeTemplate "service-account.name" }} diff --git a/templates/helm/templates/leader-election-role.yaml.tpl b/templates/helm/templates/leader-election-role.yaml.tpl index a21a5277..a07c9212 100644 --- a/templates/helm/templates/leader-election-role.yaml.tpl +++ b/templates/helm/templates/leader-election-role.yaml.tpl @@ -2,7 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: - name: {{.ControllerName}}-leader-election-role + name: {{ IncludeTemplate "app.fullname" }}-leader-election-role {{ "{{ if .Values.leaderElection.namespace }}" }} namespace: {{ "{{ .Values.leaderElection.namespace }}" }} {{ "{{ else }}" }} diff --git a/templates/helm/templates/role-reader.yaml.tpl b/templates/helm/templates/role-reader.yaml.tpl index 39b369f3..8ceb9777 100644 --- a/templates/helm/templates/role-reader.yaml.tpl +++ b/templates/helm/templates/role-reader.yaml.tpl @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: creationTimestamp: null - name: ack-{{ .ControllerName }}-reader + name: {{ IncludeTemplate "app.fullname" }}-reader namespace: {{ "{{ .Release.Namespace }}" }} rules: - apiGroups: diff --git a/templates/helm/templates/role-writer.yaml.tpl b/templates/helm/templates/role-writer.yaml.tpl index 6745ada7..6db6855d 100644 --- a/templates/helm/templates/role-writer.yaml.tpl +++ b/templates/helm/templates/role-writer.yaml.tpl @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: creationTimestamp: null - name: ack-{{ .ControllerName }}-writer + name: {{ IncludeTemplate "app.fullname" }}-writer namespace: {{ "{{ .Release.Namespace }}" }} rules: - apiGroups: