|
@@ -785,6 +785,18 @@ def validate_ai_statistics_plugin_content_types():
|
|
|
def initialize_gateway(cfg: Config, timeout: int = 60, interval: int = 5):
|
|
def initialize_gateway(cfg: Config, timeout: int = 60, interval: int = 5):
|
|
|
if cfg.gateway_mode == GatewayModeEnum.disabled:
|
|
if cfg.gateway_mode == GatewayModeEnum.disabled:
|
|
|
return
|
|
return
|
|
|
|
|
+ # For embedded/external mode, wait for kubeconfig file to be available
|
|
|
|
|
+ # (apiserver s6 service generates it on startup)
|
|
|
|
|
+ if cfg.gateway_mode != GatewayModeEnum.incluster:
|
|
|
|
|
+ kubeconfig_path = cfg.gateway_kubeconfig
|
|
|
|
|
+ start_time = time.time()
|
|
|
|
|
+ while not kubeconfig_path or not os.path.isfile(kubeconfig_path):
|
|
|
|
|
+ if time.time() - start_time > timeout:
|
|
|
|
|
+ logger.warning(f"Kubeconfig not found at {kubeconfig_path} after {timeout}s, skipping gateway setup")
|
|
|
|
|
+ return
|
|
|
|
|
+ logger.info(f"Waiting for kubeconfig at {kubeconfig_path}...")
|
|
|
|
|
+ time.sleep(interval)
|
|
|
|
|
+
|
|
|
init_async_k8s_config(cfg=cfg)
|
|
init_async_k8s_config(cfg=cfg)
|
|
|
# If k8s config couldn't be initialized (e.g., no valid kubeconfig), skip gateway setup
|
|
# If k8s config couldn't be initialized (e.g., no valid kubeconfig), skip gateway setup
|
|
|
if async_gateway_config is None:
|
|
if async_gateway_config is None:
|