---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: traefik
  namespace: default
  labels:
    app: traefik
spec:
  replicas: 1
  selector:
    matchLabels:
      app: traefik
  template:
    metadata:
      labels:
        app: traefik
    spec:
      serviceAccountName: traefik-ingress-controller
      terminationGracePeriodSeconds: 60
      hostNetwork: true
      nodeSelector:
        kubernetes.io/hostname: "rpif1"
        # kubernetes.io/arch: arm
      containers:
        - image: traefik:v2.5.3
          name: traefik
          volumeMounts:
            - mountPath: "/config"
              name: "config"
            - mountPath: "/acme/acme.json"
              name: "acme"
            - mountPath: "/acme/acme-wc.json"
              name: "acme-wc"
          ports:
            - name: web
              containerPort: 80
            - name: websecure
              containerPort: 443
          env:
            - name: NAMECHEAP_API_USER
              valueFrom:
                secretKeyRef:
                  name: traefik-envariable-secrets
                  key: NAMECHEAP_API_USER
            - name: NAMECHEAP_API_KEY
              valueFrom:
                secretKeyRef:
                  name: traefik-envariable-secrets
                  key: NAMECHEAP_API_KEY
          args:
            - --configfile=/config/traefik.toml
      volumes:
        - name: config
          configMap:
            name: traefik-config
        - name: acme
          hostPath:
            type: File
            path: /srv/configs/acme/acme.json
        - name: acme-wc
          hostPath:
            type: File
            path: /srv/configs/acme/acme-wc.json
