From 7d448d1cf980ec27204bab0d7629388a6aa767b9 Mon Sep 17 00:00:00 2001 From: Radoslav Radev Date: Thu, 4 Apr 2024 23:44:51 +0200 Subject: [PATCH] making k8s work (Fixing Conul Addresses) --- Backend/Account/ConsulRegisterer.cs | 2 +- Backend/RecommendationAlgo/ConsulRegisterer.cs | 5 ++++- Backend/Render/ConsulRegisterer.cs | 2 +- Backend/Upload/ConsulRegisterer.cs | 2 +- Backend/VideoLibrary/ConsulRegisterer.cs | 2 +- Backend/VideoStreamer/ConsulRegisterer.cs | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Backend/Account/ConsulRegisterer.cs b/Backend/Account/ConsulRegisterer.cs index b905507..fcb7016 100644 --- a/Backend/Account/ConsulRegisterer.cs +++ b/Backend/Account/ConsulRegisterer.cs @@ -20,7 +20,7 @@ public static void Register(IApplicationBuilder app, IWebHostEnvironment env, IH var serviceCheck = new AgentServiceCheck() { - HTTP = $"https://{serviceIp}:{configuration.GetValue("servicePort")}/health", + HTTP = $"http://{serviceIp}:{configuration.GetValue("servicePort")}/health", Interval = TimeSpan.FromSeconds(30), }; diff --git a/Backend/RecommendationAlgo/ConsulRegisterer.cs b/Backend/RecommendationAlgo/ConsulRegisterer.cs index b905507..f331412 100644 --- a/Backend/RecommendationAlgo/ConsulRegisterer.cs +++ b/Backend/RecommendationAlgo/ConsulRegisterer.cs @@ -16,14 +16,17 @@ public static void Register(IApplicationBuilder app, IWebHostEnvironment env, IH string serviceIp = Environment.GetEnvironmentVariable("POD_IP") ?? configuration.GetValue("POD_IP"); //gets the pod ip from the environment variable {"POD_IP"} injected by kubernetes inside of the docker container passed to the app or fallback to the appsettings.json + var consulClient = new ConsulClient(x => x.Address = new Uri(configuration.GetValue("consulUri"))); var serviceCheck = new AgentServiceCheck() { - HTTP = $"https://{serviceIp}:{configuration.GetValue("servicePort")}/health", + HTTP = $"http://{serviceIp}:{configuration.GetValue("servicePort")}/health", Interval = TimeSpan.FromSeconds(30), }; + Console.WriteLine("MYHealthCheck: " + serviceCheck.HTTP); + var registration = new AgentServiceRegistration() { ID = serviceId, diff --git a/Backend/Render/ConsulRegisterer.cs b/Backend/Render/ConsulRegisterer.cs index fdea8fd..c3064b0 100644 --- a/Backend/Render/ConsulRegisterer.cs +++ b/Backend/Render/ConsulRegisterer.cs @@ -20,7 +20,7 @@ public static void Register(IApplicationBuilder app, IWebHostEnvironment env, IH var serviceCheck = new AgentServiceCheck() { - HTTP = $"https://{serviceIp}:{configuration.GetValue("servicePort")}/health", + HTTP = $"http://{serviceIp}:{configuration.GetValue("servicePort")}/health", Interval = TimeSpan.FromSeconds(30), }; diff --git a/Backend/Upload/ConsulRegisterer.cs b/Backend/Upload/ConsulRegisterer.cs index 8ac25d2..b4fc093 100644 --- a/Backend/Upload/ConsulRegisterer.cs +++ b/Backend/Upload/ConsulRegisterer.cs @@ -20,7 +20,7 @@ public static void Register(IApplicationBuilder app, IWebHostEnvironment env, IH var serviceCheck = new AgentServiceCheck() { - HTTP = $"https://{serviceIp}:{configuration.GetValue("servicePort")}/health", + HTTP = $"http://{serviceIp}:{configuration.GetValue("servicePort")}/health", Interval = TimeSpan.FromSeconds(30), }; diff --git a/Backend/VideoLibrary/ConsulRegisterer.cs b/Backend/VideoLibrary/ConsulRegisterer.cs index b905507..fcb7016 100644 --- a/Backend/VideoLibrary/ConsulRegisterer.cs +++ b/Backend/VideoLibrary/ConsulRegisterer.cs @@ -20,7 +20,7 @@ public static void Register(IApplicationBuilder app, IWebHostEnvironment env, IH var serviceCheck = new AgentServiceCheck() { - HTTP = $"https://{serviceIp}:{configuration.GetValue("servicePort")}/health", + HTTP = $"http://{serviceIp}:{configuration.GetValue("servicePort")}/health", Interval = TimeSpan.FromSeconds(30), }; diff --git a/Backend/VideoStreamer/ConsulRegisterer.cs b/Backend/VideoStreamer/ConsulRegisterer.cs index 39d8069..0dfa71a 100644 --- a/Backend/VideoStreamer/ConsulRegisterer.cs +++ b/Backend/VideoStreamer/ConsulRegisterer.cs @@ -20,7 +20,7 @@ public static void Register(IApplicationBuilder app, IWebHostEnvironment env, IH var serviceCheck = new AgentServiceCheck() { - HTTP = $"https://{serviceIp}:{configuration.GetValue("servicePort")}/health", + HTTP = $"http://{serviceIp}:{configuration.GetValue("servicePort")}/health", Interval = TimeSpan.FromSeconds(30), };