gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.28k stars 1.73k forks source link

Explicit error when using application in k8s during installation of teleport-agent #35186

Open gecube opened 9 months ago

gecube commented 9 months ago

Good day!

As a DevOps engineer I am installing teleport agent by helm means. I prepared the next values file for the chart called teleport-kube-agent:

    roles: kube,app
    kubeClusterName: huntica-us
    proxyAddr: teleport.***.***.eu:443
    authToken: ****
    apps:
    - name: Weave Gitops
      uri: http://ww-gitops-weave-gitops.flux-system.svc.cluster.local:9001

When installing the helm chart I am getting failure without any meaningful error. Particularly when installing by GitOps means - like ArgoCD or FluxCD.

After small debug I understood that the issue is written in the logs:

gaal@bigsur components % kubectl logs -n teleport teleport-agent-0 
ERROR: application name "Weave GitOps" must be a valid DNS subdomain: https://goteleport.com/docs/application-access/guides/connecting-apps/#application-name

In my case the fix was easy:

So I am kindly asking to add a helm helper that will check the name for each element in apps array against the proper mask. In such a way I will get the explicit error message and the helm release won't be applied.

    roles: kube,app
    kubeClusterName: huntica-us
    proxyAddr: teleport.***.***.eu:443
    authToken: ****
    apps:
    - name: weave # change this line
      uri: http://ww-gitops-weave-gitops.flux-system.svc.cluster.local:9001

But the precious time was spent. Also I could not imagine what will happen when using massive amount of apps - any typo could ruin the whole config and lead to many hours of debug.

zmb3 commented 9 months ago

Adding validation only at the helm layer would solve a subset of use cases.

Instead, we should consider addressing #11894 and having the helm chart run a teleport configure --test.