Skip to content

Commit

Permalink
[alertmanager] Add support for PVC retention policy in statefulset
Browse files Browse the repository at this point in the history
Fix

Fix PVC policy

Fix fmt

Signed-off-by: peterabarr <[email protected]>
  • Loading branch information
peterabarr committed Sep 28, 2023
1 parent 3c17050 commit 5fb7272
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/alertmanager/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/a
sources:
- https://github.com/prometheus/alertmanager
type: application
version: 1.7.0
version: 1.8.0
appVersion: v0.26.0
kubeVersion: ">=1.19.0-0"
keywords:
Expand Down
5 changes: 5 additions & 0 deletions charts/alertmanager/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ metadata:
{{- end }}
namespace: {{ include "alertmanager.namespace" . }}
spec:
{{- if semverCompare ">= 1.27.x" (include "alertmanager.kubeVersion" .) }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ ternary "Delete" "Retain" .Values.server.statefulSet.pvcDeleteOnStsDelete }}
whenScaled: {{ ternary "Delete" "Retain" .Values.server.statefulSet.pvcDeleteOnStsScale }}
{{- end }}
replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
selector:
Expand Down
42 changes: 41 additions & 1 deletion charts/alertmanager/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,48 @@
"properties": {
"annotations": {
"type": "object"
},
"enabled": {
"type": "boolean"
},
"headless": {
"type": "object",
"properties": {
"annotations": {
"type": "object"
},
"gRPC": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"servicePort": {
"type": "integer"
}
}
},
"labels": {
"type": "object"
},
"servicePort": {
"type": "integer"
}
}
},
"labels": {
"type": "object"
},
"podManagementPolicy": {
"type": "string"
},
"pvcDeleteOnStsDelete": {
"type": "boolean"
},
"pvcDeleteOnStsScale": {
"type": "boolean"
}
}
}
},
"podAnnotations": {
Expand Down Expand Up @@ -912,4 +953,3 @@
}
}
}
}
10 changes: 10 additions & 0 deletions charts/alertmanager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ topologySpreadConstraints: []
statefulSet:
annotations: {}

## Statefulset's persistent volume claim retention policy
## pvcDeleteOnStsDelete and pvcDeleteOnStsScale determine whether
## statefulset's PVCs are deleted (true) or retained (false) on scaling down
## and deleting statefulset, respectively. Requires 1.27.0+.
## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
##
persistentVolumeClaimRetentionPolicy:
whenDeleted: Delete
whenScaled: Delete

podAnnotations: {}
podLabels: {}

Expand Down

0 comments on commit 5fb7272

Please sign in to comment.