github.cronjob.yml 2.5 KB
Newer Older
1
apiVersion: batch/v1
2
3
4
5
kind: CronJob
metadata:
  name: eclipsefdn-github-sync
  namespace: foundation-internal-webdev-apps
Mikaël Barbero's avatar
Mikaël Barbero committed
6
7
  labels:
    job: github-sync
8
spec:
Christopher Guindon's avatar
Christopher Guindon committed
9
  schedule: "5 */2 * * *"
10
11
12
13
14
15
  # 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-github-sync
            image: eclipsefdn/eclipsefdn-github-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 start -- --verbose=true --tls-min-v1.0 2>&1 | tee -a /app/logs/stdout-$(date +%Y-%m-%d).log
34
35
36
37
38
39
40
41
42
43
44
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
            volumeMounts:
            - name: logs
              mountPath: /app/logs
            - name: cache
              mountPath: /app/.cache
            - name: github-sync-secrets
              mountPath: "/run/secrets/api-token"
              readOnly: true
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              subPath: api-token
          restartPolicy: Never
          volumes:
          - name: logs
            persistentVolumeClaim:
              claimName: github-sync-logs
          - name: cache
            emptyDir: {}
          - name: github-sync-secrets
            secret:
              secretName: github-sync-secrets
              # workaround https://github.com/kubernetes/kubernetes/issues/65835
              items:
              - key: api-token
                path: api-token
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: github-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: github-sync-logs
  nfs:
74
    server: nfsmaster
75
76
77
78
79
80
81
82
83
84
85
86
    path: /opt/export/eclipsefdn-github-sync/logs
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: github-sync-logs
  namespace: foundation-internal-webdev-apps
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
87
      storage: 10Gi