Skip to content

Commit 6e2ffbc

Browse files
authored
Add helm variable for Role Labels (#367)
Provide option for users to specify Role labels in helm values This is useful when using [k8s clusterRole aggregation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles) We can use aggregation rule labels to give other applications access to ack resources (Eg: Kubeflow in our case) By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 1da44f4 commit 6e2ffbc

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

templates/helm/templates/_controller-role-kind-patch.yaml.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ kind: ClusterRole
44
metadata:
55
creationTimestamp: null
66
name: ack-{{ .ServicePackageName }}-controller
7+
labels:
8+
{{ "{{- range $key, $value := .Values.role.labels }}" }}
9+
{{ "{{ $key }}: {{ $value | quote }}" }}
10+
{{ "{{- end }}" }}
711
{{ "{{ else }}" }}
812
kind: Role
913
metadata:
1014
creationTimestamp: null
1115
name: ack-{{ .ServicePackageName }}-controller
16+
labels:
17+
{{ "{{- range $key, $value := .Values.role.labels }}" }}
18+
{{ "{{ $key }}: {{ $value | quote }}" }}
19+
{{ "{{- end }}" }}
1220
namespace: {{ "{{ .Release.Namespace }}" }}
1321
{{ "{{ end }}" }}

templates/helm/values.schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
],
6666
"type": "object"
6767
},
68+
"role": {
69+
"description": "Role settings",
70+
"properties": {
71+
"labels": {
72+
"type": "object"
73+
}
74+
}
75+
},
6876
"metrics": {
6977
"description": "Metrics settings",
7078
"properties": {

templates/helm/values.yaml.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ deployment:
2828
# Which priorityClassName to set?
2929
# See: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority
3030
priorityClassName: ""
31+
32+
# If "installScope: cluster" then these labels will be applied to ClusterRole
33+
role:
34+
labels: {}
3135

3236
metrics:
3337
service:

0 commit comments

Comments
 (0)