apiVersion: batch/v1 kind: CronJob metadata: name: {{ .Release.Name }}-cron spec: schedule: "*/5 * * * *" failedJobsHistoryLimit: 1 successfulJobsHistoryLimit: 0 jobTemplate: spec: template: spec: affinity: podAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app.kubernetes.io/name operator: In values: - nextcloud # This is the selector for the node # So when you find a valid node - schedule the pod to the # node that matches hostname # needed for iscsi mounts topologyKey: kubernetes.io/hostname securityContext: runAsUser: 33 runAsGroup: 33 containers: - name: nextcloud image: {{ .Values.nextcloud.image }} command: - php - -f - cron.php volumeMounts: - mountPath: /var/www/html name: html - mountPath: /var/www/html/data name: data envFrom: - configMapRef: name: {{ .Release.Name }}-nextcloud - secretRef: name: {{ .Release.Name }}-nextcloud resources: requests: memory: "1Gi" cpu: "1m" limits: memory: "4Gi" cpu: "4" volumes: - name: html persistentVolumeClaim: claimName: {{ .Release.Name }}-html-iops - name: data persistentVolumeClaim: claimName: {{ .Release.Name }}-data restartPolicy: OnFailure