apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: traefik
  namespace: argocd
  annotations:
    argocd.argoproj.io/sync-wave: "-2"
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  source:
    repoURL: https://traefik.github.io/charts
    chart: traefik
    targetRevision: "41.0.0"
    helm:
      values: |
        deployment:
          kind: DaemonSet
          podAnnotations:
            prometheus.io/scrape: "true"
            prometheus.io/port: "9100"

        ingressClass:
          enabled: true
          isDefaultClass: true

        additionalArguments:
          - "--api.dashboard=true"
          - "--ping=true"
          - "--metrics.prometheus=true"
          - "--metrics.prometheus.entrypoint=metrics"
          - "--metrics.prometheus.addEntryPointsLabels=true"
          - "--metrics.prometheus.addRoutersLabels=true"
          - "--metrics.prometheus.addServicesLabels=true"
          - "--entryPoints.ssh.address=:2222/tcp"
          - "--entryPoints.rtc-tcp-mrt0rtikize.address=:30009/tcp"
          - "--entryPoints.rtc-udp-mrt0rtikize.address=:30008/udp"
          - "--entryPoints.rtc-tcp-t0rt1k.address=:30007/tcp"
          - "--entryPoints.rtc-udp-t0rt1k.address=:30006/udp"
          - "--entryPoints.rtc-tcp-roglog.address=:30005/tcp"
          - "--entryPoints.rtc-udp-roglog.address=:30004/udp"
          - "--providers.kubernetesingress.ingressclass=traefik"
          - "--providers.kubernetesingress.ingressendpoint.publishedservice=traefik/traefik"
          - "--providers.kubernetesingress.allowexternalnameservices=true"
          - "--accesslog=true"
          - "--log.level=INFO"

        ports:
          web:
            port: 8080
            exposedPort: 80
            http:
              redirections:
                entryPoint:
                  to: websecure
                  scheme: https
                  permanent: true
          websecure:
            port: 8443
            exposedPort: 443
          ssh:
            port: 2222
            exposedPort: 22
            protocol: TCP
            expose:
              default: true
          rtc-tcp-mrt0rtikize:
            port: 30009
            exposedPort: 30009
            protocol: TCP
            expose:
              default: true
          rtc-udp-mrt0rtikize:
            port: 30008
            exposedPort: 30008
            protocol: UDP
            expose:
              default: true
          rtc-tcp-t0rt1k:
            port: 30007
            exposedPort: 30007
            protocol: TCP
            expose:
              default: true
          rtc-udp-t0rt1k:
            port: 30006
            exposedPort: 30006
            protocol: UDP
            expose:
              default: true
          rtc-tcp-roglog:
            port: 30005
            exposedPort: 30005
            protocol: TCP
            expose:
              default: true
          rtc-udp-roglog:
            port: 30004
            exposedPort: 30004
            protocol: UDP
            expose:
              default: true
          metrics:
            port: 9100
            expose:
              default: false
          traefik:
            port: 9000
            expose:
              default: false

        service:
          type: LoadBalancer
          annotations:
            service.beta.kubernetes.io/yandex-load-balancer-name: traefik
            service.beta.kubernetes.io/yandex-load-balancer-specification: '{"type": "network-load-balancer"}'
            service.beta.kubernetes.io/yandex-load-balancer-type: external

        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 500m
            memory: 256Mi

        env:
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace

  destination:
    server: https://kubernetes.default.svc
    namespace: traefik
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
