1
0
Fork 0

Add Listen Port to Ingress

This commit is contained in:
Joao Gilberto Magalhaes 2022-08-28 15:20:16 -05:00
parent b01ec6a09a
commit 72b40a3c66
5 changed files with 18 additions and 3 deletions

View file

@ -158,6 +158,9 @@ class Kubernetes(ProcessorInterface):
redirect_ssl = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect_ssl")
redirect = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.redirect")
mode = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.mode")
listen_port = self._check_annotation(ingress.metadata.annotations, "easyhaproxy.listen_port")
if listen_port is None:
listen_port = 80
data = {}
data["creation_timestamp"] = ingress.metadata.creation_timestamp.strftime("%x %X")
@ -191,7 +194,7 @@ class Kubernetes(ProcessorInterface):
port_number = rule.http.paths[0].backend.service.port.number
definition = "easyhaproxy.%s_%s" % (rule.host.replace(".", "-"), port_number)
rule_data["%s.host" % (definition)] = rule.host
rule_data["%s.port" % (definition)] = "80"
rule_data["%s.port" % (definition)] = listen_port
rule_data["%s.localport" % (definition)] = port_number
if rule.host in ssl_hosts:
rule_data["%s.clone_to_ssl" % (definition)] = 'true'