gitlab.cronjob.yml 3.11 KB
Newer Older
1
apiVersion: batch/v1
2
3
4
5
kind: CronJob
metadata:
  name: eclipsefdn-gitlab-sync
  namespace: foundation-internal-webdev-apps
Mikaël Barbero's avatar
Mikaël Barbero committed
6
7
  labels:
    job: gitlab-sync
8
9
10
11
12
13
14
15
spec:
  schedule: "5 */2 * * *"
  # 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:
16
17
18
19
20
21
22
23
24
25
          affinity:
            nodeAffinity:
              preferredDuringSchedulingIgnoredDuringExecution:
              - preference:
                  matchExpressions:
                  - key: speed
                    operator: NotIn
                    values:
                    - fast
                weight: 1
26
27
28
29
30
31
32
          containers:
          - name: eclipsefdn-gitlab-sync
            image: eclipsefdn/eclipsefdn-gitlab-sync:latest
            imagePullPolicy: Always # TODO: change to IfNotPresent once the deploy step is integrated into CD
            args:
            - /bin/sh
            - -c
Martin Lowe's avatar
Martin Lowe committed
33
            - npm run lab-sync -- --verbose=true --tls-min-v1.0 --host=https://gitlab.eclipse.org 2>&1 | tee -a /app/logs/gitlab-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: gitlab-sync-secrets
              mountPath: "/run/secrets/access-token"
              readOnly: true
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              subPath: access-token
44
            - name: gitlab-sync-secrets-oauth
45
46
47
48
              mountPath: "/run/secrets/eclipse-oauth-config"
              readOnly: true
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              subPath: eclipse-oauth-config
49
50
51
52
53
54
55
56
57
58
59
60
61
62
          restartPolicy: Never
          volumes:
          - name: logs
            persistentVolumeClaim:
              claimName: gitlab-sync-logs
          - name: cache
            emptyDir: {}
          - name: gitlab-sync-secrets
            secret:
              secretName: gitlab-sync-secrets
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              items:
              - key: access-token
                path: access-token
63
64
          - name: gitlab-sync-secrets-oauth
            secret:
65
              secretName: gitlab-sync-secrets-oauth
66
67
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              items:
68
69
              - key: eclipse-oauth-config
                path: eclipse-oauth-config
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: gitlab-sync-logs
  annotations:
    volume.beta.kubernetes.io/mount-options: rw,nfsvers=3,noexec
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  claimRef:
    namespace: foundation-internal-webdev-apps
    name: gitlab-sync-logs
  nfs:
86
    server: nfsmaster
87
88
89
90
91
92
93
94
95
96
97
98
    path: /opt/export/eclipsefdn-gitlab-sync/logs
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: gitlab-sync-logs
  namespace: foundation-internal-webdev-apps
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
99
      storage: 10Gi