Make service listing configurable

This commit is contained in:
Lauri Võsandi 2022-12-02 12:47:16 +02:00
parent b962f2695c
commit ef7b0f7b7c

View File

@ -24,7 +24,7 @@ if not targets:
# If no targets are specified, fall back to Kube API # If no targets are specified, fall back to Kube API
config.load_incluster_config() config.load_incluster_config()
v1 = client.CoreV1Api() v1 = client.CoreV1Api()
for i in v1.list_namespaced_service(SERVICE_NAMESPACE, label_selector=SERVICE_LABEL_SELETOR).items: for i in v1.list_namespaced_service(SERVICE_NAMESPACE, label_selector=SERVICE_LABEL_SELECTOR).items:
url = "http://%s:%d/bypass" % (i.metadata.name, i.spec.ports[0].port) url = "http://%s:%d/bypass" % (i.metadata.name, i.spec.ports[0].port)
targets.append((i.metadata.name, url)) targets.append((i.metadata.name, url))