apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-service
  labels:
    app: demo-service
  annotations:
    prometheus.io/scrape: "true"
    prometheus.io/path: "/actuator/prometheus"
    prometheus.io/port: "8080"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo-service
  template:
    metadata:
      name: demo-service
      labels:
        app: demo-service
    spec:
      containers:
        - name: demo-service
          image: thomasvitale/demo-service-devoxx:1.0
          ports:
            - containerPort: 8080
          resources:
            requests:
              memory: "1Gi"
              cpu: "0.5"
            limits:
              memory: "1Gi"
          lifecycle:
            preStop:
              exec:
                command: [ "sh", "-c", "sleep 5" ]
          livenessProbe:
            httpGet:
              path: /actuator/health/liveness
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 5
          readinessProbe:
            httpGet:
              path: /actuator/health/readiness
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 15
          volumeMounts:
            - name: config-volume
              mountPath: /workspace/config
      volumes:
        - name: config-volume
          configMap:
            name: demo-service