apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: whereami-backend
  name: whereami-backend
  namespace: whereami
spec:
  replicas: 3
  selector:
    matchLabels:
      app: whereami-backend
  template:
    metadata:
      labels:
        app: whereami-backend
        version: v1
    spec:
      containers:
      - env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: POD_SERVICE_ACCOUNT
          valueFrom:
            fieldRef:
              fieldPath: spec.serviceAccountName
        - name: BACKEND_ENABLED
          valueFrom:
            configMapKeyRef:
              key: BACKEND_ENABLED
              name: whereami-configmap-backend
        - name: BACKEND_SERVICE
          valueFrom:
            configMapKeyRef:
              key: BACKEND_SERVICE
              name: whereami-configmap-backend
        - name: METADATA
          valueFrom:
            configMapKeyRef:
              key: METADATA
              name: whereami-configmap-backend
        - name: ECHO_HEADERS
          valueFrom:
            configMapKeyRef:
              key: ECHO_HEADERS
              name: whereami-configmap-backend
        - name: GRPC_ENABLED
          valueFrom:
            configMapKeyRef:
              key: GRPC_ENABLED
              name: whereami-configmap-backend
        image: gcr.io/google-samples/whereami:v1.2.4
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 15
          timeoutSeconds: 5
        name: whereami
        ports:
        - containerPort: 8080
          name: http
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 5
          timeoutSeconds: 1
      serviceAccountName: whereami-ksa-backend
