github.com/diadata-org/diadata@v1.4.593/deployments/k8s-yaml/cronjob-snapshot.yaml (about)

     1  apiVersion: batch/v1
     2  kind: CronJob
     3  metadata:
     4    name: cronjob-postgresdump
     5    labels:
     6      app: cronjob-postgresdump
     7  spec:
     8    schedule: "0 0 * * *"
     9    jobTemplate:
    10      spec:
    11        template:
    12          spec:
    13            restartPolicy: Never
    14            containers:
    15              - name: cronjob-postgresdump-kaniko
    16                image: gcr.io/kaniko-project/executor:v1.6.0
    17                imagePullPolicy: IfNotPresent
    18                args:
    19                  - "--dockerfile=build/Dockerfile-postgrescronjob-Dev"
    20                  - "--context=dir:///kaniko-context"
    21                  - "--destination=registry.hub.docker.com/alex1a/diadata.postgres:latest"
    22                  - "--verbosity=debug"
    23                  - "--registry-mirror=public.ecr.aws"
    24                volumeMounts:
    25                  - name: docker-config
    26                    mountPath: /kaniko/.docker
    27                  - name: env-context
    28                    mountPath: /kaniko-context
    29                    readOnly: true
    30                  - name: env-context
    31                    mountPath: /env-workdir/00-pginitscript.sql
    32                    subPath: ./deployments/config/pginit.sql
    33                  - name: env-workdir
    34                    mountPath: /env-workdir/01-pginitscript.sql
    35                    subPath: ./pg_dump.sql
    36            initContainers:
    37              - name: check-postgres-connection
    38                image: public.ecr.aws/docker/library/postgres:15-alpine
    39                env:
    40                  - name: PGHOST
    41                    value: "data-postgres.default.svc.cluster.local"
    42                  - name: PGUSER
    43                    value: "postgres"
    44                  - name: PGDB
    45                    value: "postgres"
    46                  - name: PGPASSWORD
    47                    value: "password"
    48                command:
    49                  [
    50                    "sh",
    51                    "-c",
    52                    "until pg_isready -h $PGHOST -U $PGUSER; do sleep 1; done",
    53                  ]
    54              - name: cronjob-postgresdump-extract
    55                image: public.ecr.aws/docker/library/postgres:15-alpine
    56                command:
    57                  [
    58                    "/mnt/env-context/deployments/config/postgres-docker-entrypoint.sh",
    59                  ]
    60                args: ["postgres"]
    61                imagePullPolicy: IfNotPresent
    62                env:
    63                  - name: POSTGRES_USER
    64                    value: postgres
    65                  - name: POSTGRES_PASSWORD
    66                    value: password
    67                  - name: POSTGRES_DB
    68                    value: postgres
    69                  - name: PGHOST_EXTRACT
    70                    value: "data-postgres.default.svc.cluster.local"
    71                  - name: PGUSER_EXTRACT
    72                    value: "postgres"
    73                  - name: PGDB_EXTRACT
    74                    value: "postgres"
    75                  - name: PGPASSWORD_EXTRACT
    76                    value: "password"
    77                  - name: PGHOST_TEMP
    78                    value: "127.0.0.1"
    79                  - name: PGUSER_TEMP
    80                    value: "postgres"
    81                  - name: PGDB_TEMP
    82                    value: "postgres"
    83                  - name: PGPASSWORD_TEMP
    84                    value: "password"
    85                volumeMounts:
    86                  - name: postgres-schemma-volume
    87                    mountPath: /docker-entrypoint-initdb.d/00-pginitscript.sql
    88                    subPath: pginit.sql
    89                    readOnly: true
    90                  - name: postgres-crondump-volume
    91                    mountPath: /docker-entrypoint-initdb.d/01-pginitscript.sh
    92                    subPath: dump.sh
    93                    readOnly: true
    94                  - name: env-context
    95                    mountPath: /mnt/env-context
    96                    readOnly: true
    97                  - name: env-workdir
    98                    mountPath: /mnt/env-workdir
    99            volumes:
   100              - name: docker-config
   101                projected:
   102                  sources:
   103                    - secret:
   104                        name: regcred
   105                        items:
   106                          - key: .dockerconfigjson
   107                            path: config.json
   108              - name: postgres-schemma-volume
   109                configMap:
   110                  name: postgres-schemma
   111              - name: postgres-crondump-volume
   112                configMap:
   113                  name: postgres-crondump
   114              - name: env-context
   115                hostPath:
   116                  path: /mnt/diadata
   117              - name: env-workdir
   118                emptyDir: {}