apiVersion: batch/v1 kind: CronJob metadata: name: olake-sync namespace: olake spec: # Run every 5 minutes schedule: '*/5 * * * *' suspend: true # TODO: Set this to false in production concurrencyPolicy: Forbid # This is to prevent multiple jobs from running simultaneously successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 5 jobTemplate: spec: backoffLimit: 5 template: spec: # Add node affinity to target nodes with label {LABEL:Key}={LABEL:Value} affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: ${LABEL:Key} operator: In values: - ${LABEL:Value} containers: - name: olake image: ${IMAGE} # TODO: Change this to the database image imagePullPolicy: Always args: - 'sync' - '--config' - '/mnt/config/source.json' - '--catalog' - '/mnt/config/streams.json' - '--destination' - '/mnt/config/destination.json' volumeMounts: - name: config-volume mountPath: /mnt/config resources: requests: cpu: '20' memory: '80Gi' limits: # Set limits higher than the max_threads and server_ram in source.json cpu: '30' memory: '122Gi' # initContainer to prepare config files from ConfigMaps initContainers: - name: init-config image: busybox command: ['sh', '-c'] args: - | cp /etc/source/source.json /mnt/shared/source.json && cp /etc/catalog/streams.json /mnt/shared/streams.json && cp /etc/writer/destination.json /mnt/shared/destination.json volumeMounts: - name: source-config-volume mountPath: /etc/source readOnly: true - name: streams-config-volume mountPath: /etc/catalog readOnly: true - name: destination-config-volume mountPath: /etc/writer readOnly: true - name: config-volume mountPath: /mnt/shared volumes: - name: source-config-volume configMap: name: olake-source-config items: - key: source.json path: source.json - name: streams-config-volume configMap: name: olake-streams-config items: - key: streams.json path: streams.json - name: destination-config-volume configMap: name: olake-destination-config items: - key: destination.json path: destination.json - name: config-volume persistentVolumeClaim: claimName: olake-config-pvc restartPolicy: Never --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: olake-config-pvc namespace: olake spec: accessModes: - ReadWriteMany # Allows multiple pods to use it simultaneously resources: requests: storage: 1Gi # For AKS, use Azure Files storage class for ReadWriteMany ## https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/filestore-csi-driver#storage-class # For GKE, use gke-filestore-csi storage class for ReadWriteMany ## https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/filestore-csi-driver#storage-class # For EKS, use azure-file-csi storage class for ReadWriteMany ## https://github.com/kubernetes-sigs/aws-efs-csi-driver/blob/master/docs/efs-create-filesystem.md storageClassName: ${STORAGE_CLASS}