# Copyright 2018 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dns-perf-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dns-perf-server
  template:
    metadata:
      labels:
        app: dns-perf-server
    spec:
      terminationGracePeriodSeconds: 1
      containers:
      - name: coredns
        image: coredns/coredns:1.1.1
        imagePullPolicy: Always
        resources:
          requests:
            cpu: 100m
        livenessProbe:
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        args: [ "-conf", "/etc/coredns/Corefile" ]
        env:
        - name: PROMETHEUS_PORT
          value: "9153"
        ports:
        - containerPort: 53
          name: dns
          protocol: UDP
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
        - containerPort: 9153
          name: metrics
          protocol: TCP
        volumeMounts:
        - name: config-volume
          mountPath: /etc/coredns
      dnsPolicy: Default
      volumes:
        - name: config-volume
          configMap:
            name: dns-perf-server
            items:
            - key: Corefile
              path: Corefile