apiVersion: apps/v1
kind: Deployment
metadata:
  name: bind
  labels:
    name: bind
spec:
  selector:
    matchLabels:
      app: bind
  template:
    metadata:
      labels:
        app: bind
    spec:
      containers:
      - name: bind
        image: sameersbn/bind:bazel
        imagePullPolicy: Never
        command:
        - /bin/bash
        - -c
        - |
          rm -rf /etc/bind
          mkdir -p /etc/bind
          ls -lah /config/
          cp -Lr /config/* /etc/bind/
          chown -R "${BIND_USER}:${BIND_USER}" /etc/bind
          exec $(which named) -u ${BIND_USER} -g
        env:
        - name: WEBMIN_ENABLED
          value: "false"
        ports:
        - containerPort: 53
          protocol: UDP
        volumeMounts:
        - mountPath: /config
          name: data
      volumes:
      - name: data
        configMap:
          name: bind
      dnsConfig:
        options:
        - name: ndots
          value: "1"
