Skip to content

Commit adc7538

Browse files
authored
feat(Helm): Update Loki Helm chart for restricted environments (#14440)
**Statefulsets for ingester and index-gateway** The change here is to make the `spec.updateStrategy.type` configurable, and to default to `RollingUpdate`. **Enterprise tokengen** For this change, if `enterprise` and `tokengen` are enabled, and `rbac.namespaced` is true, the chart will render a `Role` and `RoleBinding`. If `rbac.namespaced` is false, it will render a `ClusterRole` and `ClusterRoleBinding`.
1 parent 9618e40 commit adc7538

File tree

11 files changed

+83
-15
lines changed

11 files changed

+83
-15
lines changed

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

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4628,7 +4628,10 @@ null
46284628
"serviceAnnotations": {},
46294629
"serviceLabels": {},
46304630
"terminationGracePeriodSeconds": 300,
4631-
"tolerations": []
4631+
"tolerations": [],
4632+
"updateStrategy": {
4633+
"type": "RollingUpdate"
4634+
}
46324635
}
46334636
</pre>
46344637
</td>
@@ -4912,6 +4915,26 @@ null
49124915
<td><pre lang="json">
49134916
[]
49144917
</pre>
4918+
</td>
4919+
</tr>
4920+
<tr>
4921+
<td>indexGateway.updateStrategy</td>
4922+
<td>object</td>
4923+
<td>UpdateStrategy for the indexGateway StatefulSet.</td>
4924+
<td><pre lang="json">
4925+
{
4926+
"type": "RollingUpdate"
4927+
}
4928+
</pre>
4929+
</td>
4930+
</tr>
4931+
<tr>
4932+
<td>indexGateway.updateStrategy.type</td>
4933+
<td>string</td>
4934+
<td>One of 'OnDelete' or 'RollingUpdate'</td>
4935+
<td><pre lang="json">
4936+
"RollingUpdate"
4937+
</pre>
49154938
</td>
49164939
</tr>
49174940
<tr>
@@ -5004,6 +5027,9 @@ null
50045027
"whenUnsatisfiable": "ScheduleAnyway"
50055028
}
50065029
],
5030+
"updateStrategy": {
5031+
"type": "RollingUpdate"
5032+
},
50075033
"zoneAwareReplication": {
50085034
"enabled": true,
50095035
"maxUnavailablePct": 33,
@@ -5414,6 +5440,26 @@ false
54145440
<td><pre lang="">
54155441
Defaults to allow skew no more than 1 node
54165442
</pre>
5443+
</td>
5444+
</tr>
5445+
<tr>
5446+
<td>ingester.updateStrategy</td>
5447+
<td>object</td>
5448+
<td>UpdateStrategy for the ingester StatefulSets.</td>
5449+
<td><pre lang="json">
5450+
{
5451+
"type": "RollingUpdate"
5452+
}
5453+
</pre>
5454+
</td>
5455+
</tr>
5456+
<tr>
5457+
<td>ingester.updateStrategy.type</td>
5458+
<td>string</td>
5459+
<td>One of 'OnDelete' or 'RollingUpdate'</td>
5460+
<td><pre lang="json">
5461+
"RollingUpdate"
5462+
</pre>
54175463
</td>
54185464
</tr>
54195465
<tr>

‎production/helm/loki/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Find more information in the Loki Helm Chart [documentation](https://grafana.com
2222

2323
## Contributing and releasing
2424

25-
If you made any changes to the [Chart.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/Chart.yaml) or [values.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml) run `make helm-doc` from the root of the repository to update the documentation and commit the changed files.
25+
If you made any changes to the [Chart.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/Chart.yaml) or [values.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml) run `make helm-docs` from the root of the repository to update the documentation and commit the changed files.
2626

2727
#### Versioning
2828

‎production/helm/loki/README.md.gotmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Find more information in the Loki Helm Chart [documentation](https://grafana.com
1212

1313
## Contributing and releasing
1414

15-
If you made any changes to the [Chart.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/Chart.yaml) or [values.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml) run `make helm-doc` from the root of the repository to update the documentation and commit the changed files.
15+
If you made any changes to the [Chart.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/Chart.yaml) or [values.yaml](https://github.com/grafana/loki/blob/main/production/helm/loki/values.yaml) run `make helm-docs` from the root of the repository to update the documentation and commit the changed files.
1616

1717
#### Versioning
1818

‎production/helm/loki/templates/index-gateway/statefulset-index-gateway.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ metadata:
1212
{{- end }}
1313
spec:
1414
replicas: {{ .Values.indexGateway.replicas }}
15+
{{- with .Values.indexGateway.updateStrategy }}
1516
updateStrategy:
16-
rollingUpdate:
17-
partition: 0
17+
{{- tpl (. | toYaml) $ | nindent 4 }}
18+
{{- end }}
1819
serviceName: {{ include "loki.indexGatewayFullname" . }}-headless
1920
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
2021
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.indexGateway.persistence.enableStatefulSetAutoDeletePVC) }}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-a.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ spec:
4040
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
4141
name: ingester-zone-a
4242
rollout-group: ingester
43+
{{- with .Values.ingester.updateStrategy }}
4344
updateStrategy:
44-
type: OnDelete
45+
{{- tpl (. | toYaml) $ | nindent 4 }}
46+
{{- end }}
4547
template:
4648
metadata:
4749
annotations:

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-b.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ spec:
4040
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
4141
name: ingester-zone-b
4242
rollout-group: ingester
43+
{{- with .Values.ingester.updateStrategy }}
4344
updateStrategy:
44-
type: OnDelete
45+
{{- tpl (. | toYaml) $ | nindent 4 }}
46+
{{- end }}
4547
template:
4648
metadata:
4749
annotations:

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-c.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ spec:
4040
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
4141
name: ingester-zone-c
4242
rollout-group: ingester
43+
{{- with .Values.ingester.updateStrategy }}
4344
updateStrategy:
44-
type: OnDelete
45+
{{- tpl (. | toYaml) $ | nindent 4 }}
46+
{{- end }}
4547
template:
4648
metadata:
4749
annotations:

‎production/helm/loki/templates/ingester/statefulset-ingester.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ spec:
1717
replicas: {{ .Values.ingester.replicas }}
1818
{{- end }}
1919
podManagementPolicy: Parallel
20+
{{- with .Values.ingester.updateStrategy }}
2021
updateStrategy:
21-
rollingUpdate:
22-
partition: 0
22+
{{- tpl (. | toYaml) $ | nindent 4 }}
23+
{{- end }}
2324
serviceName: {{ include "loki.ingesterFullname" . }}-headless
2425
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
2526
{{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.ingester.persistence.enableStatefulSetAutoDeletePVC) }}

‎production/helm/loki/templates/tokengen/clusterrole-tokengen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
{{ if and (and .Values.enterprise.tokengen.enabled .Values.enterprise.enabled) (not .Values.rbac.namespaced)}}
1+
{{ if and .Values.enterprise.tokengen.enabled .Values.enterprise.enabled }}
22
---
33
apiVersion: rbac.authorization.k8s.io/v1
4-
kind: ClusterRole
4+
kind: {{ if not .Values.rbac.namespaced }}Cluster{{ end }}Role
55
metadata:
66
name: {{ template "enterprise-logs.tokengenFullname" . }}
77
labels:

‎production/helm/loki/templates/tokengen/clusterrolebinding-tokengen.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.tokengen.enabled .Values.enterprise.enabled) (not .Values.rbac.namespaced)}}
1+
{{ if and .Values.enterprise.tokengen.enabled .Values.enterprise.enabled }}
22
---
33
apiVersion: rbac.authorization.k8s.io/v1
4-
kind: ClusterRoleBinding
4+
kind: {{ if not .Values.rbac.namespaced }}Cluster{{ end }}RoleBinding
55
metadata:
66
name: {{ template "enterprise-logs.tokengenFullname" . }}
77
labels:
@@ -16,7 +16,7 @@ metadata:
1616
"helm.sh/hook": post-install
1717
roleRef:
1818
apiGroup: rbac.authorization.k8s.io
19-
kind: ClusterRole
19+
kind: {{ if not .Values.rbac.namespaced }}Cluster{{ end }}Role
2020
name: {{ template "enterprise-logs.tokengenFullname" . }}
2121
subjects:
2222
- kind: ServiceAccount

‎production/helm/loki/values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,13 @@ ingester:
17961796
readinessProbe: {}
17971797
# -- liveness probe settings for ingester pods. If empty use `loki.livenessProbe`
17981798
livenessProbe: {}
1799+
# -- UpdateStrategy for the ingester StatefulSets.
1800+
updateStrategy:
1801+
# -- One of 'OnDelete' or 'RollingUpdate'
1802+
type: RollingUpdate
1803+
# -- Optional for updateStrategy.type=RollingUpdate. See [Partitioned rolling updates](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions) in the StatefulSet docs for details.
1804+
# rollingUpdate:
1805+
# partition: 0
17991806
persistence:
18001807
# -- Enable creating PVCs which is required when using boltdb-shipper
18011808
enabled: false
@@ -2313,6 +2320,13 @@ indexGateway:
23132320
# -- Set the optional grpc service protocol. Ex: "grpc", "http2" or "https"
23142321
appProtocol:
23152322
grpc: ""
2323+
# -- UpdateStrategy for the indexGateway StatefulSet.
2324+
updateStrategy:
2325+
# -- One of 'OnDelete' or 'RollingUpdate'
2326+
type: RollingUpdate
2327+
# -- Optional for updateStrategy.type=RollingUpdate. See [Partitioned rolling updates](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions) in the StatefulSet docs for details.
2328+
# rollingUpdate:
2329+
# partition: 0
23162330
# -- Configuration for the compactor
23172331
compactor:
23182332
# -- Number of replicas for the compactor

0 commit comments

Comments
 (0)