﻿apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-probes-test-deployment
  labels:
    app: k8s-probes-test
spec:
  replicas: 3
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  selector:
    matchLabels:
      app: k8s-probes-test
  template:
    metadata:
      labels:
        app: k8s-probes-test
    spec:
      containers:
      - name: k8s-probes-test
        image: xxxxxxxx.azurecr.io/k8s-probes-test:1.0.0
        env:
        - name: TenantId
          value: ""
        - name: SubscriptionId
          value: ""
        - name: ClientId
          value: ""
        - name: ClientSecret
          value: ""
        - name: ResourceGroupName
          value: ""
        - name: ServiceBusNamespace
          value: ""
        - name: ServiceBusNamespaceSASKey
          value: ""
        - name: RequestQueueName
          value: "demo-request-queue"
        - name: ResponseQueueName
          value: "demo-response-queue"
        - name: LivenessSignalIntervalSeconds
          value: "5"
        # After initialDelaySeconds check (within timeoutSeconds) if pods generated ready.txt file (successThreshold many times). If they did not then recheck every periodSeconds.
        # If probes fail after failureThreshold attempts i.e. after (failureThreshold * periodSeconds) seconds then pods do not receive traffic / requests.
        startupProbe:
          failureThreshold: 1
          exec:
            command: 
            - rm
            - started.signal
          initialDelaySeconds: 30
          periodSeconds: 30
          successThreshold: 1
          timeoutSeconds: 1
        # After initialDelaySeconds check (within timeoutSeconds) if pods generated alive.txt file (successThreshold many times). If they did then recheck every periodSeconds.
        # If probes fail after failureThreshold attempts i.e. after (failureThreshold * periodSeconds) seconds then pods are rebooted.
        livenessProbe:
          failureThreshold: 1
          exec:
            command:
            - rm
            - alive.signal
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 1