apiVersion: apps/v1
kind: Deployment
metadata:
  name: visits-service
  #namespace: staging
spec:
  selector:
      matchLabels:
        app: visits-service
  replicas: 3
  template:
      metadata:
        labels:
            app: visits-service
      spec:
        containers:
        - name: visits-service
          image: image-registry.openshift-image-registry.svc:5000/${projectname}/visits-service:${IMAGE_TAG}
          imagePullPolicy: Always
          livenessProbe: # https://docs.spring.io/spring-boot/docs/2.6.3/reference/html/actuator.html#actuator.endpoints.kubernetes-probes
            initialDelaySeconds: 60
            timeoutSeconds: 2
            httpGet:
              # https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
              # management.endpoints.web.base-path=/actuator
              # https://github.com/spring-projects/spring-petclinic/blob/master/src/main/resources/application.properties
              path: /manage/health/liveness # /actuator
              port: 8081
              scheme: HTTP
          readinessProbe:
            initialDelaySeconds: 30
            timeoutSeconds: 1
            httpGet:
              path: "/manage/health/readiness"
              port: 8081           
            #tcpSocket:
            #  port: 8081
          resources:
            # https://github.com/kubernetes/kubernetes/issues/63396
            requests:
              memory: "180Mi"
              cpu: "100m"
            limits:
              memory: "360Mi"
              cpu: "300m"
          ports:
          - containerPort: 8080
            name: server
          - containerPort: 8081
            name: management