apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: spring-k8s-workshop
  name: spring-k8s-workshop
  namespace: spring-k8s-workshop
spec:
  replicas: 1
  selector:
    matchLabels:
      app: spring-k8s-workshop
  strategy: {}
  template:
    metadata:
      labels:
        app: spring-k8s-workshop
    spec:
      containers:
      - image: spring-k8s-workshop:0.0.1-SNAPSHOT
        name: spring-k8s-workshop
        lifecycle:
          preStop:
            exec:
              command: [ "sh", "-c", "sleep 10" ]
        resources:
          requests:
            cpu: 800m
        ports:
          - containerPort: 8080
        livenessProbe:
          httpGet:
            path: /actuator/health/liveness
            port: 8080
          initialDelaySeconds: 300
          timeoutSeconds: 20
        readinessProbe:
          httpGet:
            path: /actuator/health/readiness
            port: 8080
        volumeMounts:
          - name: config-volume
            mountPath: /workspace/config
          - name: secret-volume
            mountPath: "/etc/config/secrets"
            readOnly: true
      volumes:
        - name: config-volume
          configMap:
            name: spring-k8s-workshop-configmap
        - name: secret-volume
          secret:
            secretName: spring-k8s-workshop-secret
#            items:
#              - key: app.secret
#                path: app.secret


