k8up-io / k8up

Kubernetes and OpenShift Backup Operator
https://k8up.io/
Apache License 2.0
685 stars 66 forks source link

env var "PUSH_URL" does't work #357

Closed gi8lino closed 3 years ago

gi8lino commented 3 years ago

Describe the bug

I updated to v1.0.0. If i run a job (backup, check or prune), the env variable "PROM_URL" inside the pod is empty. k8up doesn't send the metrics/stats to pushgateway anymore...

Additional context

Logs

logs of the backup pod:

Removing locks...
created new cache in /root/.cache/restic
successfully removed locks
Listing all pods with annotation k8up.syn.tools/backupcommand in namespace healthchecks
Listing snapshots
snapshots command:
3 Snapshots
backing up...
Starting backup for folder healthchecks-data
done: 0.00% 
backup finished! new files: 0 changed files: 1 bytes added: 3012859
Listing snapshots
snapshots command:
4 Snapshots
sending webhook Listing snapshots
snapshots command:
4 Snapshots
Removing locks...
Listing snapshots
snapshots command:
4 Snapshots
Sending webhooks to : 

Expected behavior

The pod should send the metrics/stats to pushgateway.

To Reproduce

Steps to reproduce the behavior:

  1. Specs "k8up deployment"
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: k8up
    namespace: k8up
    spec:
    selector:
    matchLabels:
      app.kubernetes.io/instance: k8up
      app.kubernetes.io/name: k8up
    template:
    metadata:
      labels:
        app.kubernetes.io/instance: k8up
        app.kubernetes.io/name: k8up
    spec:
      containers:
      - env:
        - name: BACKUP_IMAGE
          value: quay.io/vshn/wrestic:v0.1.9
        - name: TZ
          value: Europe/Zurich
        - name: BACKUP_ENABLE_LEADER_ELECTION
          value: "true"
        - name: BACKUP_OPERATOR_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        - name: BACKUP_GLOBALREPOPASSWORD
          value: <I-LIKE_BANANAS>
        - name: BACKUP_GLOBALACCESSKEYID
          value: <Dr Denz>
        - name: BACKUP_GLOBALSECRETACCESSKEY
          value: <MAYBE-I-LIKE_BANANAS>
        - name: BACKUP_GLOBALS3ENDPOINT
          value: http://minio.minio.svc.cluster.local:9000
        - name: BACKUP_GLOBALKEEPJOBS
          value: "2"
        - name: BACKUP_PROMURL
          value: http://prometheus-pushgateway.monitoring.svc.cluster.local:9091
        image: quay.io/vshn/k8up:v1.0.0
        imagePullPolicy: IfNotPresent
  2. Specs "backup pod"
    apiVersion: v1
    kind: Pod
    metadata:
    labels:
    job-name: healthchecks-backup-dh9nj
    name: healthchecks-backup-dh9nj-l4vhn
    namespace: healthchecks
    spec:
    containers:
    - env:
    - name: BACKUPCOMMAND_ANNOTATION
      value: k8up.syn.tools/backupcommand
    - name: RESTIC_PASSWORD
      value: <I-LIKE_BANANAS>
    - name: AWS_ACCESS_KEY_ID
      value: <Dr Denz>
    - name: AWS_SECRET_ACCESS_KEY
      value: <MAYBE-I-LIKE_BANANAS>
    - name: HOSTNAME
      value: healthchecks
    - name: STATS_URL
    - name: PROM_URL
    - name: RESTIC_REPOSITORY
      value: s3:http://minio.minio.svc.cluster.local:9000/healthchecks
    - name: FILEEXTENSION_ANNOTATION
      value: k8up.syn.tools/file-extension
    image: quay.io/vshn/wrestic:v0.1.9
    imagePullPolicy: IfNotPresent
    name: healthchecks-backup-dh9nj

Environment (please complete the following information):

ccremer commented 3 years ago

Hi

Thanks for the bug report! I was able to reproduce it locally. I'm investigating now.

gi8lino commented 3 years ago

hi Thank you for the fast fix! It works now. Another suggestion for improvement would be, if "Sending webhooks to : " in the logs is also not empty...


Removing locks...
created new cache in /root/.cache/restic
successfully removed locks
Listing all pods with annotation k8up.syn.tools/backupcommand in namespace healthchecks
Listing snapshots
snapshots command:
4 Snapshots
backing up...
Starting backup for folder healthchecks-data
done: 0.00% 
backup finished! new files: 0 changed files: 1 bytes added: 3355323
Listing snapshots
snapshots command:
5 Snapshots
sending webhook Listing snapshots
snapshots command:
5 Snapshots
Removing locks...
Listing snapshots
snapshots command:
5 Snapshots
Sending webhooks to :
ccremer commented 3 years ago

@Kidswiss do you have any idea?