-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kubernetes App Auto Discovery: improve protocol detection
Kubernetes App Auto Discovery iterates over all Services and tries to auto enroll them as Teleport Applications. During this process, it tries to guess the Service's port protocol to ensure we add the application only if it's either an HTTP or HTTPS capable Service. When there's not annotation configuration (which are teleport specific), we try to infer from the Service's ports. When that doesn't work out, the teleport-agent issues an HTTP HEAD request against the port. This way we detect whether the service can answer HTTP or HTTPS. This PR changes the way teleport infers the protocol using the Service's Port. It was checking for HTTPS (checking for port number and port name), then it did a HTTP HEAD request and then it was checking for HTTP (checking port number and port name). This PR changes 4 things: - checks the port, the node port and the target port against well known ports (443, 80, 8080) - checks the name of the port in bother Port.Name and Port.TargetPort - tries to do HTTPS and HTTP checks before trying an HTTP request - decreases the HTTP request timeout from 5s to 500ms With a demo cluster with 2700+ Services, the reconciliation time decreased from 2m to something very close to 0s.
- Loading branch information
1 parent
6a116c5
commit a8bd0f9
Showing
1 changed file
with
28 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters