maxisam / mgob

MongoDB dockerized backup agent. Runs schedule backups with retention, S3 & SFTP upload, notifications, instrumentation with Prometheus and more.
https://maxisam.github.io/mgob/
MIT License
123 stars 16 forks source link

create Pod common-mgob-0 in StatefulSet common-mgob failed error: Pod "common-mgob-0" is invalid: spec.initContainers[0].name: Duplicate value: "init-cleanup" #106

Closed fragolinux closed 2 months ago

fragolinux commented 2 months ago

hi, i got this error in cluster events while deploying mgob on our cluster, using fluxcd (the envvars you'll see are correctly assigned in the folder relative kustomization resource):

create Pod common-mgob-0 in StatefulSet common-mgob failed error: Pod "common-mgob-0" is invalid: spec.initContainers[0].name: Duplicate value: "init-cleanup"

this the helmrelease i'm using:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: common-mgob
  namespace: ${namespace}
spec:
  interval: 1m
  timeout: 10m
  releaseName: common-mgob
  test:
    enable: true
    timeout: 10m
  chart:
    spec:
      # see https://github.com/maxisam/mgob/tree/main/charts/mgob
      chart: mgob
      version: "2.1.0"
      sourceRef:
        kind: HelmRepository
        name: mgob
      interval: 24h
  valuesFrom:
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthUsername
    targetPath: config.hourly\.yml.target.username
    optional: false
  - kind: Secret
    name: ha-base-hr
    valuesKey: mongodbAuthPassword
    targetPath: config.hourly\.yml.target.password
    optional: false

  values:
    config:
      # Add each plan as per below.
      hourly.yml:
        # run every day at 6:00 and 18:00 UTC
        scheduler:
          cron: "@hourly"
          # number of backups to keep locally
          retention: 4
          # backup operation timeout in minutes
          timeout: 60
        target:
          # mongod IP or host name
          host: common-mongodb-headless.${namespace}.svc.cluster.local
          # mongodb port
          port: 27017
          # mongodb database name, leave blank to backup all databases
          database: "e4t-lab-ha"
          # add custom params to mongodump (eg. Auth or SSL support), leave blank if not needed
          params: "--ssl --authenticationDatabase admin"

    storage:
      # -- Persistent volume for backups, see `config.retention`
      longTerm:
        name: "mgob-storage"
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 10Gi
          storageClassName: ${envName}-nfs-csi-test
      # -- Persistent volume for temporary files
      tmp:
        name: "mgob-tmp"
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 1Gi
          storageClassName: ${envName}-nfs-csi-test
      restoreTmp:
        name: "mgob-restore-tmp"
        spec:
          accessModes:
            - ReadWriteOnce
          resources:
            requests:
              storage: 10Gi
          storageClassName: ${envName}-nfs-csi-test

    #  mongodb as sidecars to validate backup
    mongodb:
      image:
        tag: 5.0.10

and the helmrepository:

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
  name: mgob
  namespace: ${namespace}
spec:
  interval: 24h
  url: https://maxisam.github.io/mgob/
fragolinux commented 2 months ago

sorry, it was kyverno messing up containers and initcontainers... closing