apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rps-app # Deployment manages the pods with these labels
  name: rps-app-deployment
spec:
  replicas: 2
  selector:
    matchLabels: # This replicaSet manages the pods with these labels
      app: rps-app
  minReadySeconds: 10
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: rps-app
      name: rps-app-deployment
    spec:
      hostname: rps-app
      restartPolicy: Always
      containers:
        - image: edekargaurav88/rps2:1.4
          name: rps-app
          imagePullPolicy: Always
          resources:
            limits:
              cpu: "1"
              memory: 512M
            requests:
              cpu: "0.5"
              memory: 256M
          ports:
            - containerPort: 8080
              #hostPort: 8080
              name: http
            - containerPort: 8091
              #hostPort: 8091
              name: metrics
          env:
            - name: POSTGRES_USER
              value: postgres
            - name: POSTGRES_PASSWORD
              value: postgres
            - name: POSTGRES_URL
              value: jdbc:postgresql://192.168.10.220:5432/postgres
            - name: SPRING_PROFILES_ACTIVE
              value: prod,liquibase
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: 8091
              scheme: HTTP
            initialDelaySeconds: 60
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 6
          readinessProbe:
            httpGet:
              path: /actuator/health
              port: 8091
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
