Skip to content

Commit a3e91a4

Browse files
committed
fix: Add tls-server-name support for Teleport proxy (#495)
This patch adds support for the `tls-server-name` field from kubeconfig, which is required when connecting to Kubernetes clusters through Teleport proxy or similar services that use TLS SNI for routing. The fix follows the same pattern already used for `proxy-url` support, loading the tls-server-name from cluster config and passing it to the kubernetes client configuration. Fixes #495
1 parent 3acc116 commit a3e91a4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

robusta_krr/core/integrations/kubernetes/config_patch.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,30 @@ def _load_cluster_info(self):
1616
if "proxy-url" in self._cluster:
1717
self.proxy = self._cluster["proxy-url"]
1818

19+
# Support tls-server-name for Teleport and similar proxies
20+
# See: https://github.com/robusta-dev/krr/issues/495
21+
if "tls-server-name" in self._cluster:
22+
self.tls_server_name = self._cluster["tls-server-name"]
23+
1924
def _set_config(self, client_configuration: Configuration):
2025
super()._set_config(client_configuration)
2126

22-
key = "proxy"
23-
if key in self.__dict__:
24-
setattr(client_configuration, key, getattr(self, key))
27+
for key in ("proxy", "tls_server_name"):
28+
if key in self.__dict__:
29+
setattr(client_configuration, key, getattr(self, key))
2530

2631

2732
class Configuration(configuration.Configuration):
2833
def __init__(
2934
self,
3035
proxy: Optional[str] = None,
36+
tls_server_name: Optional[str] = None,
3137
**kwargs,
3238
):
3339
super().__init__(**kwargs)
3440

3541
self.proxy = proxy
42+
self.tls_server_name = tls_server_name
3643

3744

3845
configuration.Configuration = Configuration

0 commit comments

Comments
 (0)