apiVersion: apps/v1
kind: Deployment
metadata:
  name: edge-service
spec:
  replicas: 1
  selector:
    matchLabels:
      app: edge-service
  template:
    spec:
      containers:
        - name: edge-service
          image: edge-service
          imagePullPolicy: IfNotPresent
          lifecycle:
            preStop:
              exec:
                command: [ "sh", "-c", "sleep 5" ]
          ports:
            - containerPort: 9000
          livenessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 9000
            initialDelaySeconds: 10
            periodSeconds: 5
          readinessProbe:
            httpGet:
              path: /actuator/health/readiness
              port: 9000
            initialDelaySeconds: 5
            periodSeconds: 15
          env:
            - name: CATALOG_SERVICE_URL
              value: http://catalog-service
            - name: ORDER_SERVICE_URL
              value: http://order-service
          volumeMounts:
            - name: edge-service-volume
              mountPath: /workspace/config
      volumes:
        - name: edge-service-volume
          configMap:
            name: edge-service
