diff --git a/autoconf/src/IngressController.py b/autoconf/src/IngressController.py index d2a1add..35c0bab 100644 --- a/autoconf/src/IngressController.py +++ b/autoconf/src/IngressController.py @@ -47,7 +47,7 @@ class IngressController(Controller.Controller) : env[prefix + annotation.replace("bunkerized-nginx.", "", 1)] = annotations[annotation] return env - def __rules_to_env(self, rules) : + def __rules_to_env(self, rules, namespace="default") : env = {} first_servers = [] for rule in rules : @@ -61,7 +61,7 @@ class IngressController(Controller.Controller) : for path in rule["http"]["paths"] : env[prefix + "USE_REVERSE_PROXY"] = "yes" env[prefix + "REVERSE_PROXY_URL"] = path["path"] - env[prefix + "REVERSE_PROXY_HOST"] = "http://" + path["backend"]["service_name"] + ":" + str(path["backend"]["service_port"]) + env[prefix + "REVERSE_PROXY_HOST"] = "http://" + path["backend"]["service_name"] + "." + namespace + ".svc.cluster.local:" + str(path["backend"]["service_port"]) env["SERVER_NAME"] = " ".join(first_servers) return env @@ -76,7 +76,7 @@ class IngressController(Controller.Controller) : if "SERVER_NAME" in env and env["SERVER_NAME"] != "" : first_servers.extend(env["SERVER_NAME"].split(" ")) for ingress in ingresses : - env.update(self.__rules_to_env(ingress.spec.rules)) + env.update(self.__rules_to_env(ingress.spec.rules, namespace=ingress.metadata.namespace)) if ingress.spec.tls : for tls_entry in ingress.spec.tls : for host in tls_entry.hosts : diff --git a/gen/main.py b/gen/main.py index 26fe003..eca33ce 100755 --- a/gen/main.py +++ b/gen/main.py @@ -53,9 +53,9 @@ if __name__ == "__main__" : # Remove old files files = glob.glob(args.output + "/*") for file in files : - if file.endswith(".conf") and os.path.isfile(file) : + if file.endswith(".conf") and os.path.isfile(file) and not os.path.islink(file) : os.remove(file) - elif os.path.isdir(file) : + elif os.path.isdir(file) and not os.path.islink(file) : shutil.rmtree(file, ignore_errors=False) # Generate the files from templates and config diff --git a/settings.json b/settings.json index 99df434..82373e9 100644 --- a/settings.json +++ b/settings.json @@ -1248,7 +1248,7 @@ "env": "DNS_RESOLVERS", "id": "dns-resolvers", "label": "DNS Resolvers", - "regex": "^(\\d+.\\d+.\\d+.\\d+ ?)*$", + "regex": "^([a-z\\-0-9]+\\.? ?)*$", "type": "text" }, {