apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-ingress-lb
  namespace: gitlab
spec:
  selector:
    matchLabels:
      app: nginx-ingress-lb
  template:
    metadata:
      labels:
        app: nginx-ingress-lb
    spec:
      terminationGracePeriodSeconds: 60
      containers:
      - name: nginx-ingress-lb
        image: gcr.io/google_containers/nginx-ingress-controller:0.8.3
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
          initialDelaySeconds: 30
          timeoutSeconds: 5
        env:
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
        ports:
        - containerPort: 80
          hostPort: 80
        - containerPort: 443
          hostPort: 4443
        - containerPort: 1022
          hostPort: 1022
        args:
        - /nginx-ingress-controller
        - --default-backend-service=$(POD_NAMESPACE)/default-http-backend
        - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-ingress-configmap
        - --nginx-configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
