apiVersion: apps/v1
kind: Deployment
metadata:
  name: worker-deployment
  namespace: volume-sync-gcp-k8s
  labels:
    app: worker
spec:
  selector:
    matchLabels:
      app: worker
  replicas: 3
  template:
    metadata:
      labels:
        app: worker
    spec:
      volumes:
        - name: sync-volume
          persistentVolumeClaim:
            claimName: sync-pv-claim
        - name: google-cloud-key
          secret:
            secretName: gcp-sync-account
      containers:
      - name: worker-container
        image: dewaldops/volume-sync-worker-gcp:1.0
        env:
          - name: BASE_DIR
            value: "/mnt/syncdir/"
          - name: PROJECT_ID
            valueFrom:
              configMapKeyRef:
                key: GCP_PROJECT_ID
                name: sync-config
          - name: BUCKET_NAME
            valueFrom:
              configMapKeyRef:
                key: GCP_BUCKET_NAME
                name: sync-config
          - name: GOOGLE_APPLICATION_CREDENTIALS
            value: /var/secrets/google/sync-service-account.json
        volumeMounts:
          - name: sync-volume
            mountPath: "/mnt"
          - name: google-cloud-key
            mountPath: /var/secrets/google
        resources:
          limits:
            memory: "128Mi"
            cpu: "0.5"
        
