Skip to content

ArgoCD is forever stuck on updating the Cluster resource generated by the cluster chart #426

Open

Description

I'm using the following ArgoCD application:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cloudnative-pg-cluster-something-postgres
  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: something
    name: in-cluster
  source:
    repoURL: 'https://cloudnative-pg.io/charts/'
    targetRevision: 0.1.0
    helm:
      values: |
        fullnameOverride: cluster-postgres

        version:
          postgresql: "17"

        cluster:
          instances: 3

          storage:
            size: 3Gi

          initdb:
            database: something
            owner: something

          enableSuperuserAccess: true
          superuserSecret: cluster-postgres-superuser

          walStorage:
            enabled: true
    chart: cluster
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
  sources: []
  project: common

This generates a Cluster resource with pg_hba: [] and pg_ident: []:

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  labels:
    app.kubernetes.io/instance: cloudnative-pg-cluster-something-postgres
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: cluster
    app.kubernetes.io/part-of: cloudnative-pg
    argocd.argoproj.io/instance: cloudnative-pg-cluster-something-postgres
    helm.sh/chart: cluster-0.1.0
  name: cluster-postgres
  namespace: something
spec:
  affinity:
    topologyKey: topology.kubernetes.io/zone
  bootstrap:
    initdb:
      database: something
      owner: something
      postInitApplicationSQL: null
  enableSuperuserAccess: true
  imageName: ghcr.io/cloudnative-pg/postgresql:17
  imagePullPolicy: IfNotPresent
  instances: 3
  logLevel: info
  managed: null
  monitoring:
    disableDefaultQueries: false
    enablePodMonitor: true
  postgresGID: 26
  postgresUID: 26
  postgresql:
    parameters: {}
    pg_hba: []
    pg_ident: []
    shared_preload_libraries: null
  primaryUpdateMethod: switchover
  primaryUpdateStrategy: unsupervised
  priorityClassName: null
  storage:
    size: 3Gi
    storageClass: null
  superuserSecret:
    name: cluster-postgres-superuser
  walStorage:
    size: 1Gi
    storageClass: null

ArgoCD continuously retries updating this Cluster resource, but the final result lacks the pg_hba and pg_ident keys. I suspect it's because they are empty lists.

Perhaps the code here could benefit from some if statements that exclude pg_hba and pg_ident if they would end up being empty?

pg_hba:
{{- toYaml .pg_hba | nindent 6 }}
pg_ident:
{{- toYaml .pg_ident | nindent 6 }}

This only became an issue with version 0.1.0 of the cluster chart. Downgrading to 0.0.11 (which does not have these pg_hba and pg_ident keys) fixes the problem.

Seems like pg_hba got introduced in #321 while pg_ident got introduced in #377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions