Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

CLUSTERMAN-812: reload k8s client only once #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clusterman/kubernetes/kubernetes_cluster_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def __init__(self, cluster: str, pool: Optional[str], init_crd: bool = False) ->
node_label_selector = self.pool_config.read_string("node_label_key", default="clusterman.com/pool")
self._label_selectors.append(f"{node_label_selector}={self.pool}")

self.reload_client()

def reload_state(self, load_pods_info: bool = True) -> None:
"""Reload information from cluster/pool

Expand All @@ -107,8 +109,6 @@ def reload_state(self, load_pods_info: bool = True) -> None:
"""
logger.info("Reloading nodes")

self.reload_client()

# store the previous _nodes_by_ip for use in get_removed_nodes_before_last_reload()
self._prev_nodes_by_ip = copy.deepcopy(self._nodes_by_ip)
self._nodes_by_ip = self._get_nodes_by_ip()
Expand Down