apiVersion: apps/v1
kind: Deployment
metadata:
  name: guestbook-service
  labels:
    app: guestbook-service
    version: "1.0"
    visualize: "true"
spec:
  replicas: 2
  selector:
    matchLabels:
      app: guestbook-service
      version: "1.0"
      serving: "true"
  template:
    metadata:
      labels:
        app: guestbook-service
        serving: "true"
        version: "1.0"
        visualize: "true"
    spec:
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      containers:
      - name: guestbook-service
        image: bygui86/guestbook-service:latest
        imagePullPolicy: Always
        livenessProbe:
          exec:
            command:
              - "/app/health-check.sh"
              - "localhost"
              - "8080"
              - "actuator/health"
          initialDelaySeconds: 60
          periodSeconds: 10
          timeoutSeconds: 3
          successThreshold: 1
          failureThreshold: 3
        readinessProbe:
          exec:
            command:
              - "/app/health-check.sh"
              - "localhost"
              - "8080"
              - ""
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 3
          successThreshold: 1
          failureThreshold: 3
        ports:
        - containerPort: 8080
          name: http
        resources:
          requests:
            cpu: 400m
            memory: 500Mi
          limits:
            cpu: 1500m
            memory: 1000Mi
