apiVersion: apps/v1
kind: Deployment
metadata:
  name: workspace-service
spec:
  replicas: 2
  selector:
    matchLabels:
      app: workspace-service
  template:
    metadata:
      labels:
        app: workspace-service
    spec:
      containers:
        - name: workspace-service
          image: fnhsproduction.azurecr.io/workspace-service
          ports:
            - containerPort: 3030
          env:
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: workspace-service
                  key: url
            - name: EVENTGRID_TOPIC_ENDPOINT
              valueFrom:
                secretKeyRef:
                  name: workspace-service
                  key: eventgrid_topic_endpoint
            - name: EVENTGRID_TOPIC_KEY
              valueFrom:
                secretKeyRef:
                  name: workspace-service
                  key: eventgrid_topic_key
            - name: INSTRUMENTATION_KEY
              valueFrom:
                configMapKeyRef:
                  name: telemetry
                  key: instrumentation_key
            - name: FILE_STORAGE_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  name: files-storage-account
                  key: primary_access_key
            - name: UPLOAD_CONTAINER_URL
              valueFrom:
                configMapKeyRef:
                  name: files-storage-account
                  key: upload_container_id
            - name: FILES_CONTAINER_URL
              valueFrom:
                configMapKeyRef:
                  name: files-storage-account
                  key: files_container_id
          resources:
            limits:
              cpu: 100m
              memory: 100Mi
            requests:
              cpu: 10m
              memory: 100Mi
          readinessProbe:
            httpGet:
              path: /healthz
              port: 3030
            initialDelaySeconds: 5
            periodSeconds: 15
            timeoutSeconds: 30
          livenessProbe:
            httpGet:
              path: /healthz
              port: 3030
            initialDelaySeconds: 5
            periodSeconds: 20
            timeoutSeconds: 30
