mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
watch services for autoconf/k8s and support real IP in default http server
This commit is contained in:
parent
d3d0136bf5
commit
0b71819d22
3 changed files with 20 additions and 2 deletions
|
@ -213,6 +213,8 @@ class IngressController(Controller, ConfigCaller):
|
|||
what = self.__networkingv1.list_ingress_for_all_namespaces
|
||||
elif watch_type == "configmap":
|
||||
what = self.__corev1.list_config_map_for_all_namespaces
|
||||
elif watch_type == "service":
|
||||
what = self.__corev1.list_service_for_all_namespaces
|
||||
else:
|
||||
raise Exception(f"Unsupported watch_type {watch_type}")
|
||||
|
||||
|
@ -283,7 +285,7 @@ class IngressController(Controller, ConfigCaller):
|
|||
|
||||
def process_events(self):
|
||||
self._set_autoconf_load_db()
|
||||
watch_types = ("pod", "ingress", "configmap")
|
||||
watch_types = ("pod", "ingress", "configmap", "service")
|
||||
threads = [
|
||||
Thread(target=self.__watch, args=(watch_type,))
|
||||
for watch_type in watch_types
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{% if USE_REAL_IP == "yes" +%}
|
||||
{% for element in read_lines("/var/cache/bunkerweb/realip/combined.list") +%}
|
||||
set_real_ip_from {{ element }};
|
||||
{% endfor +%}
|
||||
{% if REAL_IP_FROM != "" %}
|
||||
{% for element in REAL_IP_FROM.split(" ") +%}
|
||||
set_real_ip_from {{ element }};
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
real_ip_header {{ REAL_IP_HEADER }};
|
||||
{% if REAL_IP_RECURSIVE == "yes" +%}
|
||||
real_ip_recursive on;
|
||||
{% else +%}
|
||||
real_ip_recursive off;
|
||||
{% endif +%}
|
||||
{% endif %}
|
|
@ -383,9 +383,9 @@ if __name__ == "__main__":
|
|||
logger.info("Successfuly sent /data/cache folder")
|
||||
|
||||
# restart nginx
|
||||
logger.info("Stopping temp nginx ...")
|
||||
if integration == "Linux":
|
||||
# Stop temp nginx
|
||||
logger.info("Stopping temp nginx ...")
|
||||
proc = subprocess_run(
|
||||
["/usr/sbin/nginx", "-s", "stop"],
|
||||
stdin=DEVNULL,
|
||||
|
|
Loading…
Reference in a new issue