apiVersion: apps/v1
kind: Deployment
metadata:
  name: guest-service
  labels:
    app: guest-service
    version: 0.0.1-SNAPSHOT
    group: ca.zhoozhoo.spring.cloud.kubernetes
spec:
  replicas: 1
  selector:
    matchLabels:
      app: guest-service
      group: ca.zhoozhoo.spring.cloud.kubernetes
  template:
    metadata:
      labels:
        app: guest-service
        version: 0.0.1-SNAPSHOT
        group: ca.zhoozhoo.spring.cloud.kubernetes
    spec:
      containers:
      - name: guest-service
        image: zhoozhoo/spring-cloud-kubernetes-guest-service:latest
        imagePullPolicy: IfNotPresent
        resources:
          limits:
            memory: "512Mi"
            cpu: "1000m"
        env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: HOSTNAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        startupProbe:
          httpGet:
            path: /actuator/health/liveness
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 3
          timeoutSeconds: 1
          failureThreshold: 20
          successThreshold: 1
        livenessProbe:
          httpGet:
            path: /actuator/health/liveness
            port:  8080
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 15
          timeoutSeconds: 1
          failureThreshold: 3
          successThreshold: 1
        readinessProbe:
          httpGet:
            path: /actuator/health/readiness
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 30
          timeoutSeconds: 5
          failureThreshold: 3
          successThreshold: 1
        ports:
        - name: http
          containerPort: 8080
