apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: nginx-ingress-controller
  name: nginx-ingress-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      name: nginx-ingress-controller
  template:
    metadata:
      annotations:
        prometheus.io/path: /metrics
        prometheus.io/port: "10254"
        prometheus.io/scrape: "true"
      labels:
        name: nginx-ingress-controller
    spec:
      serviceAccountName: nginx-ingress-controller
      containers:
      - name: nginx
        args:
        - --configmap=$(POD_NAMESPACE)/$(NGINX_INGRESS_CONFIGMAP)
        - --ingress-class=nginx
        - --publish-service=$(POD_NAMESPACE)/$(NGINX_INGRESS_CONFIGMAP)
        - --tcp-services-configmap=$(POD_NAMESPACE)/$(TCP_SERVICES_CONFIGMAP)
        - --udp-services-configmap=$(POD_NAMESPACE)/$(UDP_SERVICES_CONFIGMAP)
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.namespace
        image: bitnami/nginx-ingress-controller:0.22.0
        livenessProbe:
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
          initialDelaySeconds: 10
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
        - containerPort: 443
          name: https
          protocol: TCP
        readinessProbe:
          httpGet:
            path: /healthz
            port: 10254
            scheme: HTTP
        resources:
          requests:
            cpu: 100m
        securityContext:
          capabilities:
            add:
            - NET_BIND_SERVICE
            drop:
            - ALL
          runAsUser: 1001
