Skip to content

[alertmanager] Ability to pass existing persistent volume claim for a single replica statefulset #5126

Open
@NandigamAbhishek

Description

@NandigamAbhishek

Is your feature request related to a problem ?

It would be great to use an existing persistent volume (if there is) in statefulset yaml file. I know this would mean that the statefulset should have a single pod running.

Describe the solution you'd like.

  1. Add a persistentVolumeClaim block below the claimTemplate in statefulset.yaml

{{- if and ( .Values.persistence.enabled) (eq .Values.persistence.existingClaim "") }}
volumeClaimTemplates:
- metadata:
name: storage
spec:
accessModes:
{{- toYaml .Values.persistence.accessModes | nindent 10 }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
{{- end }}
{{- else if and (.Values.persistence.enabled) (not (eq .Values.persistence.existingClaim "")) (eq .Values.replicaCount 1) }}
- name: storage
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else }}
- name: storage
emptyDir: {}
{{- end }}

  1. Add a existingClaim key under persistence inside values.yaml

persistence:
enabled: true
accessModes:
- ReadWriteOnce
size: 50Mi
existingClaim: ""

Describe alternatives you've considered.

Maybe the logic of applying the condition can be better. Not sure.

Additional context.

This is a suggestion. I have tested using existing claim with azurefile-csi storage class in an aks cluster with single alertmanager pod. It works as expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions