prometheus-community / helm-charts

Prometheus community Helm charts
Apache License 2.0
5.11k stars 5.02k forks source link

[prometheus-alertmanager] ArgoCD can't take a fullsync StatefulSet #4848

Open bmgeek opened 2 months ago

bmgeek commented 2 months ago

Describe the bug a clear and concise description of what the bug is.

K8s is adding automatic some strings in the volumeClaimTemplates after deploy:

StatefulSet in the cluster:

....
  volumeClaimTemplates:
    - kind: PersistentVolumeClaim
      apiVersion: v1
....

StatefulSet in the helm chart:

...
  {{- if .Values.persistence.enabled }}
  volumeClaimTemplates:
    - metadata:
        name: storage
      spec:
...
Screenshot 2024-09-11 at 12 24 32

What's your helm version?

v3.13.2

What's your kubectl version?

1.28

Which chart?

alertmanager

What's the chart version?

1.12.0

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Enter the changed values of values.yaml?

No response

Enter the command that you execute and failing/misfunctioning.

i'm using an ArgoCD

Anything else we need to know?

No response

schedin commented 1 month ago

To make it easier to test this bug without using ArgoCD I have come up with this method:

How to reproduce: Install an older alertmanager.

git clone https://github.com/prometheus-community/helm-charts.git --branch alertmanager-1.12.0
cd helm-charts
helm upgrade --install myalertmanager helm-charts/charts/alertmanager/

Compare the alertmanager StatefulSet volumeClaimTemplates: with helm template and the installed resource

helm template charts/alertmanager/ | grep volumeClaimTemplates: -A 10
kubectl get statefulset -o yaml | grep volumeClaimTemplates: -A 10

Expected: The volumeClaimTemplates: when comparing helm template and looking at the installed StatefulSet should look the same with respect to most attributes, but specifically kind and apiVersion.

Actual: The helm template output is missing the kind and apiVersion under the volumeClaimTemplates:

[vagrant@schedin-k3d helm-charts]$ helm template charts/alertmanager/ | grep volumeClaimTemplates: -A 10
  volumeClaimTemplates:
    - metadata:
        name: storage
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 50Mi
[vagrant@schedin-k3d helm-charts]$ kubectl get statefulset -o yaml | grep volumeClaimTemplates: -A 10
    volumeClaimTemplates:
    - apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        creationTimestamp: null
        name: storage
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:

Fix: I have submitted a fix for this: #4865