Skip to content

Commit

Permalink
More logs for debugging traefik updating.
Browse files Browse the repository at this point in the history
  • Loading branch information
NotChristianGarcia authored Dec 8, 2023
1 parent db6eedb commit ebc4f3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion service/kubernetes_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ def update_traefik_configmap(tcp_proxy_info: Dict[str, Dict[str, str]],
proxy_info ({"pod_id1": {"routing_port": int, "url": str}, ...}): Dict of dict that
specifies routing port + url needed to create pod service.
"""
logger.debug("Top of update_traefik_configmap().")
template_env = Environment(loader=FileSystemLoader("service/templates"))
template = template_env.get_template('traefik-template.j2')
rendered_template = template.render(tcp_proxy_info = tcp_proxy_info,
Expand All @@ -563,6 +564,7 @@ def update_traefik_configmap(tcp_proxy_info: Dict[str, Dict[str, str]],
# Only update the configmap if the current configmap is out of date.
current_template = k8.read_namespaced_config_map(name='pods-traefik-conf', namespace=NAMESPACE)

logger.debug("Health checking for difference in Traefik configs.")
if not current_template.data['traefik.yml'] == rendered_template:
logger.debug("Health found difference in Traefik configs, updated configmap.")
# Update the configmap with the new template immediately.
Expand All @@ -575,4 +577,4 @@ def get_traefik_configmap():
"""
current_template = k8.read_namespaced_config_map(name='pods-traefik-conf', namespace=NAMESPACE)

return current_template
return current_template

0 comments on commit ebc4f3d

Please sign in to comment.