---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: podinfo-green
  labels:
    app: podinfo
    color: green
spec:
  replicas: 3
  minReadySeconds: 15
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
  selector:
    matchLabels:
     app: podinfo
     color: green
  template:
    metadata:
      labels:
        app: podinfo
        color: green
      annotations:
        prometheus.io/scrape: 'true'
    spec:
      terminationGracePeriodSeconds: 30
      containers:
      - name: podinfod
        image: docker.io/richardcase/podinfo:0.6.0
        lifecycle:
          preStop:
            exec:
              command:
              - /bin/sh
              - -c
              - sleep 4
        command:
          - ./podinfo
          - -port=9898
          - -logLevel=debug
        ports:
        - name: http
          containerPort: 9898
          protocol: TCP
        readinessProbe:
          httpGet:
            path: /readyz
            port: 9898
          initialDelaySeconds: 1
          periodSeconds: 2
          failureThreshold: 1
        livenessProbe:
          httpGet:
            path: /healthz
            port: 9898
        resources:
          requests:
            memory: "32Mi"
            cpu: "10m"
        env:
          - name: color
            value: "green"
          - name: message
            value: "Greetings from podinfo green"
          - name: backendURL
            value: "http://podinfo-backend:9898/backend"
