apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "gce-ingress.fullname" . }}-backend
  labels:
    app: {{ include "gce-ingress.name" . }}
    component: backend
    chart: {{ include "gce-ingress.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    kubernetes.io/name: "GLBC"
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
spec:
  replicas: {{ .Values.defaultBackend.replicaCount }}
  selector:
    matchLabels:
      app: {{ include "gce-ingress.name" . }}
      component: backend
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ include "gce-ingress.name" . }}
        release: {{ .Release.Name }}
        component: backend
    spec:
      containers:
        - name: backend
          image: "{{ .Values.defaultBackend.image.repository }}:{{ .Values.defaultBackend.image.tag }}"
          imagePullPolicy: {{ .Values.defaultBackend.image.pullPolicy }}
          livenessProbe:
            httpGet:
              path: /healthz
              port: http
              scheme: HTTP
          readinessProbe:
            httpGet:
              path: /healthz
              port: http
              scheme: HTTP
            initialDelaySeconds: 30
            timeoutSeconds: 5
          ports:
            - name: http
              containerPort: 8080
          resources:
{{ toYaml .Values.defaultBackend.resources | indent 12 }}
    {{- with .Values.defaultBackend.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.defaultBackend.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.defaultBackend.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
