Skip to content

Commit af85ecf

Browse files
authored
feat(helm): Allow provisioner to be namespaced (#16091)
Signed-off-by: Ryan Brady <ryan.brady@grafana.com>
1 parent 12e436a commit af85ecf

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

‎docs/sources/setup/install/helm/reference.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,6 +3075,7 @@ null
30753075
"enabled": true,
30763076
"env": [],
30773077
"extraVolumeMounts": [],
3078+
"hookType": "post-install",
30783079
"image": {
30793080
"digest": null,
30803081
"pullPolicy": "IfNotPresent",
@@ -3263,6 +3264,7 @@ null
32633264
"enabled": true,
32643265
"env": [],
32653266
"extraVolumeMounts": [],
3267+
"hookType": "post-install",
32663268
"image": {
32673269
"digest": null,
32683270
"pullPolicy": "IfNotPresent",
@@ -3337,6 +3339,15 @@ true
33373339
<td><pre lang="json">
33383340
[]
33393341
</pre>
3342+
</td>
3343+
</tr>
3344+
<tr>
3345+
<td>enterprise.provisioner.hookType</td>
3346+
<td>string</td>
3347+
<td>Hook type(s) to customize when the job runs. defaults to post-install</td>
3348+
<td><pre lang="json">
3349+
"post-install"
3350+
</pre>
33403351
</td>
33413352
</tr>
33423353
<tr>

‎production/helm/loki/templates/provisioner/job-provisioner.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ metadata:
1414
{{- with .Values.enterprise.provisioner.annotations }}
1515
{{- toYaml . | nindent 4 }}
1616
{{- end }}
17-
"helm.sh/hook": post-install
17+
"helm.sh/hook": {{ .Values.enterprise.provisioner.hookType | default "post-install" | quote }}
1818
"helm.sh/hook-weight": "15"
1919
spec:
2020
backoffLimit: 6

‎production/helm/loki/templates/provisioner/role-provisioner.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{{ if and (and .Values.enterprise.provisioner.enabled .Values.enterprise.enabled) (not .Values.rbac.namespaced)}}
1+
{{ if and .Values.enterprise.provisioner.enabled .Values.enterprise.enabled }}
22
apiVersion: rbac.authorization.k8s.io/v1
3-
kind: ClusterRole
3+
kind: {{ if not .Values.rbac.namespaced }}Cluster{{ end }}Role
44
metadata:
55
name: {{ template "enterprise-logs.provisionerFullname" . }}
66
namespace: {{ $.Release.Namespace }}

‎production/helm/loki/templates/provisioner/rolebinding-provisioner.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{{ if and (and .Values.enterprise.provisioner.enabled .Values.enterprise.enabled) (not .Values.rbac.namespaced)}}
1+
{{ if and .Values.enterprise.provisioner.enabled .Values.enterprise.enabled}}
22
---
33
apiVersion: rbac.authorization.k8s.io/v1
4-
kind: ClusterRoleBinding
4+
kind: {{ if not .Values.rbac.namespaced }}Cluster{{ else }}Role{{ end }}Binding
55
metadata:
66
name: {{ template "enterprise-logs.provisionerFullname" . }}
77
namespace: {{ $.Release.Namespace }}
@@ -17,7 +17,7 @@ metadata:
1717
"helm.sh/hook": post-install
1818
roleRef:
1919
apiGroup: rbac.authorization.k8s.io
20-
kind: ClusterRole
20+
kind: {{ if not .Values.rbac.namespaced }}Cluster{{ end }}Role
2121
name: {{ template "enterprise-logs.provisionerFullname" . }}
2222
subjects:
2323
- kind: ServiceAccount

‎production/helm/loki/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ enterprise:
611611
enabled: true
612612
# -- Name of the secret to store provisioned tokens in
613613
provisionedSecretPrefix: null
614+
# -- Hook type(s) to customize when the job runs. defaults to post-install
615+
hookType: "post-install"
614616
# -- Additional tenants to be created. Each tenant will get a read and write policy
615617
# and associated token. Tenant must have a name and a namespace for the secret containting
616618
# the token to be created in. For example

0 commit comments

Comments
 (0)