apiVersion: apps/v1
kind: Deployment
metadata:
  name: book-service
spec:
  selector:
    matchLabels:
      app: book-service
  template:
    spec:
      containers:
        - name: book-service
          image: book-service:0.0.1-SNAPSHOT
          ports:
            - containerPort: 8080
          resources:
            requests:
              memory: "756Mi"
              cpu: "1.0"
            limits:
              memory: "756Mi"
          lifecycle:
            preStop:
              exec:
                command: [ "sh", "-c", "sleep 5" ]
          livenessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 8080
            initialDelaySeconds: 10
            periodSeconds: 5
          readinessProbe:
            httpGet:
              path: /actuator/health/readiness
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 15
          volumeMounts:
            - name: book-service-volume
              mountPath: /workspace/config
      volumes:
        - name: book-service-volume
          configMap:
            name: book-service
