# k8s-hs-less-dns.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: hs-net
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: config-less-dns
  namespace: hs-net
data:
  config.yml: |
    {
      "log": {
        "level": "info"
      },
      "vnet4": "100.64.0.1/10",
      "vnet6": "fc00:eeaa:0000:0000::/48",
      "redis": {
        "custom": [
          {
            "username": null,
            "password": "HybridScope0xRed1s.",
            "host": "redis-master.db-redis",
            "port": 6379,
            "tls_insecure": null,
            "db": 10
          }
        ]
      },
      "mqtt": {
        "client_id": "dns_mqtt_client",
        "protocol": "tls",
        "host": "emqx-service.db-emqx",
        "port": 1883,
        "cert": "",
        "key": "",
        "keep_alive": 60
      }
    }
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: less-dns
  namespace: hs-net
  labels:
    app: less-dns
spec:
  replicas: 1
  selector:
    matchLabels:
      app: less-dns
  template:
    metadata:
      labels:
        app: less-dns
    spec:
      topologySpreadConstraints:
      - maxSkew: 1 
        topologyKey: kubernetes.io/hostname 
        whenUnsatisfiable: ScheduleAnyway 
        labelSelector:
          matchLabels:
            app: less-dns
      containers:
      - name: less-dns
        image: hub.yizhisec.com/hybridscope/less_dns_service:latest
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: config-volume
          mountPath: /etc/less_dns_service
        securityContext:
          privileged: true
      volumes:
      - name: config-volume
        configMap:
          name: config-less-dns
          items:
          - key: config.yml
            path: config.yml
      restartPolicy: Always
