Skip to content

Commit

Permalink
Add ability to configure StatefulSet PVC retention policy (#517)
Browse files Browse the repository at this point in the history
Signed-off-by: Sam McBroom <[email protected]>
  • Loading branch information
sam-mcbr authored Jan 16, 2025
1 parent 7caefcc commit d8768ba
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* [CHANGE] Updated default `align_queries_with_step` to **false** to match documentation #513
* [ENHANCEMENT] Add `nginx.config.upstream_protocol` field to configure the upstream protocol in the nginx configuration #506
* [ENHANCEMENT] Add ability to set `persistentVolumeClaimRetentionPolicy` on alertmanager, ingester, compactor, and store-gateway StatefulSets #517
* [BUGFIX] fix: upstream_protocol reference in auth_orgs #509
* [DEPENDENCY] Update quay.io/cortexproject/cortex Docker tag to v1.18.1 #510

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Kubernetes: `^1.19.0-0`
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;accessModes | list | `["ReadWriteOnce"]` | Alertmanager data Persistent Volume access modes Must match those of existing PV or dynamic provisioner Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ |
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;annotations | object | `{}` | Alertmanager data Persistent Volume Claim annotations |
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;enabled | bool | `true` | If true and alertmanager.statefulSet.enabled is true, Alertmanager will create/use a Persistent Volume Claim If false, use emptyDir |
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;retentionPolicy | object | `{}` | StatefulSetAutoDeletePVC feature https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention |
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;size | string | `"2Gi"` | Alertmanager data Persistent Volume size |
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;storageClass | string | `nil` | Alertmanager data Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. |
| alertmanager.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;subPath | string | `""` | Subdirectory of Alertmanager data Persistent Volume to mount Useful if the volume's root directory is not empty |
Expand Down Expand Up @@ -184,6 +185,7 @@ Kubernetes: `^1.19.0-0`
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;accessModes | list | `["ReadWriteOnce"]` | compactor data Persistent Volume access modes Must match those of existing PV or dynamic provisioner Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ |
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;annotations | object | `{}` | compactor data Persistent Volume Claim annotations |
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;enabled | bool | `true` | If true compactor will create/use a Persistent Volume Claim If false, use emptyDir |
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;retentionPolicy | object | `{}` | StatefulSetAutoDeletePVC feature https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention |
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;size | string | `"2Gi"` | |
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;storageClass | string | `nil` | compactor data Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. |
| compactor.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;subPath | string | `""` | Subdirectory of compactor data Persistent Volume to mount Useful if the volume's root directory is not empty |
Expand Down Expand Up @@ -346,6 +348,7 @@ Kubernetes: `^1.19.0-0`
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;accessModes | list | `["ReadWriteOnce"]` | Ingester data Persistent Volume access modes Must match those of existing PV or dynamic provisioner Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ |
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;annotations | object | `{}` | Ingester data Persistent Volume Claim annotations |
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;enabled | bool | `true` | If true and ingester.statefulSet.enabled is true, Ingester will create/use a Persistent Volume Claim If false, use emptyDir |
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;retentionPolicy | object | `{}` | StatefulSetAutoDeletePVC feature https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention |
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;size | string | `"2Gi"` | Ingester data Persistent Volume size |
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;storageClass | string | `nil` | Ingester data Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. |
| ingester.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;subPath | string | `""` | Subdirectory of Ingester data Persistent Volume to mount Useful if the volume's root directory is not empty |
Expand Down Expand Up @@ -815,6 +818,7 @@ Kubernetes: `^1.19.0-0`
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;accessModes | list | `["ReadWriteOnce"]` | Store-gateway data Persistent Volume access modes Must match those of existing PV or dynamic provisioner Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ |
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;annotations | object | `{}` | Store-gateway data Persistent Volume Claim annotations |
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;enabled | bool | `true` | If true Store-gateway will create/use a Persistent Volume Claim If false, use emptyDir |
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;retentionPolicy | object | `{}` | StatefulSetAutoDeletePVC feature https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention |
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;size | string | `"2Gi"` | Store-gateway data Persistent Volume size |
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;storageClass | string | `nil` | Store-gateway data Persistent Volume Storage Class If defined, storageClassName: <storageClass> If set to "-", storageClassName: "", which disables dynamic provisioning If undefined (the default) or set to null, no storageClassName spec is set, choosing the default provisioner. |
| store_gateway.&ZeroWidthSpace;persistentVolume.&ZeroWidthSpace;subPath | string | `""` | Subdirectory of Store-gateway data Persistent Volume to mount Useful if the volume's root directory is not empty |
Expand Down
6 changes: 6 additions & 0 deletions templates/alertmanager/alertmanager-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ spec:
{{- toYaml .Values.alertmanager.statefulStrategy | nindent 4 }}
serviceName: {{ template "cortex.fullname" . }}-alertmanager-headless
{{- if .Values.alertmanager.persistentVolume.enabled }}
{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.alertmanager.persistentVolume.retentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: storage
Expand Down
6 changes: 6 additions & 0 deletions templates/compactor/compactor-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ spec:
{{- toYaml .Values.compactor.strategy | nindent 4 }}
serviceName: {{ template "cortex.fullname" . }}-compactor
{{- if .Values.compactor.persistentVolume.enabled }}
{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.compactor.persistentVolume.retentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: storage
Expand Down
6 changes: 6 additions & 0 deletions templates/ingester/ingester-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ spec:
podManagementPolicy: "{{ .Values.ingester.statefulSet.podManagementPolicy }}"
serviceName: {{ template "cortex.fullname" . }}-ingester-headless
{{- if .Values.ingester.persistentVolume.enabled }}
{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.ingester.persistentVolume.retentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: storage
Expand Down
6 changes: 6 additions & 0 deletions templates/store-gateway/store-gateway-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ spec:
podManagementPolicy: {{ .Values.store_gateway.podManagementPolicy | quote }}
serviceName: {{ template "cortex.fullname" . }}-store-gateway-headless
{{- if .Values.store_gateway.persistentVolume.enabled }}
{{- if semverCompare ">=1.23-0" .Capabilities.KubeVersion.Version }}
{{- with .Values.store_gateway.persistentVolume.retentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: storage
Expand Down
24 changes: 24 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ alertmanager:
# set, choosing the default provisioner.
storageClass: null

# -- StatefulSetAutoDeletePVC feature
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
retentionPolicy: {}
# whenDeleted: Retain
# whenScaled: Retain

startupProbe:
httpGet:
path: /ready
Expand Down Expand Up @@ -543,6 +549,12 @@ ingester:
# set, choosing the default provisioner.
storageClass: null

# -- StatefulSetAutoDeletePVC feature
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
retentionPolicy: {}
# whenDeleted: Retain
# whenScaled: Retain

# -- Startup/liveness probes for ingesters are not recommended.
# Ref: https://cortexmetrics.io/docs/guides/running-cortex-on-kubernetes/#take-extra-care-with-ingesters
startupProbe: {}
Expand Down Expand Up @@ -1404,6 +1416,12 @@ store_gateway:
# set, choosing the default provisioner.
storageClass: null

# -- StatefulSetAutoDeletePVC feature
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
retentionPolicy: {}
# whenDeleted: Retain
# whenScaled: Retain

startupProbe:
failureThreshold: 60
initialDelaySeconds: 120
Expand Down Expand Up @@ -1520,6 +1538,12 @@ compactor:
# set, choosing the default provisioner.
storageClass: null

# -- StatefulSetAutoDeletePVC feature
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
retentionPolicy: {}
# whenDeleted: Retain
# whenScaled: Retain

startupProbe:
failureThreshold: 60
initialDelaySeconds: 120
Expand Down

0 comments on commit d8768ba

Please sign in to comment.