apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
  namespace: securityhub
  labels:
    app: backend
spec:
  replicas: 3
  selector:
    matchLabels:
      app: backend
  template:
    metadata:
      labels:
        app: backend
    spec:
      volumes:
        - name: resources
          emptyDir: {}
      containers:
      - name: backend
        image: gcr.io/mateo-burillo-ns/securityhub-backend:latest
        env:
          - name: RESOURCES_PATH
            value: /resources/resources
          - name: VENDOR_PATH
            value: /resources/vendors
        ports:
        - containerPort: 8080
        readinessProbe:
          httpGet:
            path: /health
            port: 8080
        volumeMounts:
          - name: resources
            mountPath: /resources
            readOnly: true
      - name: resources
        image: gcr.io/mateo-burillo-ns/securityhub-resources:latest
        command: ["/bin/sh", "-c", "--"]
        args: ["while true; do cp -r /resources/* /shared-resources; sleep 3600; done"]
        volumeMounts:
          - name: resources
            mountPath: /shared-resources
        readinessProbe:
          exec:
            command:
              - touch
              - /health
