import.cronjob.yml 3.08 KB
Newer Older
1
apiVersion: batch/v1
2
3
4
5
kind: CronJob
metadata:
  name: eclipsefdn-import-backup
  namespace: foundation-internal-webdev-apps
Mikaël Barbero's avatar
Mikaël Barbero committed
6
7
  labels:
    job: github-org-backup
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
spec:
  schedule: "0 1 * * 0"
  # if it is time for a new job run and the previous job run hasn’t finished yet, the cron job skips the new job run
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          affinity:
            nodeAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - preference:
                  matchExpressions:
                  - key: speed
                    operator: NotIn
                    values:
                    - fast
                weight: 1
          containers:
          - name: eclipsefdn-import-backup
            image: eclipsefdn/eclipsefdn-import-backup:latest
            imagePullPolicy: Always # TODO: change to IfNotPresent once the deploy step is integrated into CD
            args:
            - /bin/sh
            - -c
33
            - npm run import-backup -- --verbose=true --host="https://gitlab.eclipse.org" --target="264" --tls-min-v1.0 --organization=openhwgroup 2>&1 | tee -a /app/logs/import-stdout-$(date +%Y-%m-%d).log
34
35
36
37
38
39
40
41
42
43
            volumeMounts:
            - name: logs
              mountPath: /app/logs
            - name: cache
              mountPath: /app/.cache
            - name: import-backup-secrets
              mountPath: "/run/secrets/access-token"
              readOnly: true
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              subPath: access-token
44
            - name: import-backup-secrets
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
              mountPath: "/run/secrets/github-access-token"
              readOnly: true
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              subPath: github-access-token
          restartPolicy: Never
          volumes:
          - name: logs
            persistentVolumeClaim:
              claimName: import-backup-logs
          - name: cache
            emptyDir: {}
          - name: import-backup-secrets
            secret:
              secretName: import-backup-secrets
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              items:
              - key: access-token
                path: access-token
              - key: github-access-token
                path: github-access-token
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: import-backup-logs
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
    namespace: foundation-internal-webdev-apps
    name: import-backup-logs
  nfs:
79
    server: nfsmaster
80
    path: /opt/export/eclipsefdn-import-backup/logs
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  mountOptions:
    - vers=4.2
    - rw
    - proto=tcp
    - rsize=32768
    - wsize=32768
    - timeo=600
    - fg
    - hard
    - retrans=10
    - intr
    - relatime
    - nodiratime
    - async
95
96
97
98
99
100
101
102
103
104
105
106
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: import-backup-logs
  namespace: foundation-internal-webdev-apps
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi