From 3220eb2823ed23323f6a703d88c489d1002e8691 Mon Sep 17 00:00:00 2001 From: Maksim Fedotov Date: Thu, 12 Dec 2024 16:01:24 +0300 Subject: [PATCH] add dummy handler always returning 200 Signed-off-by: Maksim Fedotov --- .../026-add-healthz-to-virt-operator.patch | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/images/virt-artifact/patches/026-add-healthz-to-virt-operator.patch b/images/virt-artifact/patches/026-add-healthz-to-virt-operator.patch index c51b34d31..649b65395 100644 --- a/images/virt-artifact/patches/026-add-healthz-to-virt-operator.patch +++ b/images/virt-artifact/patches/026-add-healthz-to-virt-operator.patch @@ -1,28 +1,8 @@ diff --git a/pkg/virt-operator/application.go b/pkg/virt-operator/application.go -index 47b4880c38..a7f884fbdd 100644 +index 47b4880c38..7e889dd48b 100644 --- a/pkg/virt-operator/application.go +++ b/pkg/virt-operator/application.go -@@ -29,6 +29,8 @@ import ( - - kvtls "kubevirt.io/kubevirt/pkg/util/tls" - -+ "kubevirt.io/kubevirt/pkg/healthz" -+ - "github.com/emicklei/go-restful/v3" - "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/spf13/pflag" -@@ -78,6 +80,10 @@ const ( - defaultHost = "0.0.0.0" - ) - -+var ( -+ apiHealthVersion = new(healthz.KubeApiHealthzVersion) -+) -+ - type VirtOperatorApp struct { - service.ServiceListen - -@@ -341,8 +347,6 @@ func Execute() { +@@ -341,8 +341,6 @@ func Execute() { } func (app *VirtOperatorApp) Run() { @@ -31,7 +11,7 @@ index 47b4880c38..a7f884fbdd 100644 go func() { mux := http.NewServeMux() -@@ -360,15 +364,31 @@ func (app *VirtOperatorApp) Run() { +@@ -360,15 +358,34 @@ func (app *VirtOperatorApp) Run() { restfulContainer.ServeMux = mux restfulContainer.Add(webService) @@ -44,17 +24,20 @@ index 47b4880c38..a7f884fbdd 100644 + } + }() + go func() { -+ ++ var handle200 = restful.RouteFunction(func(req *restful.Request, resp *restful.Response) { ++ resp.WriteHeader(http.StatusOK) ++ }) + mux := http.NewServeMux() + + webService := new(restful.WebService) + webService.Path("/").Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON) -+ webService.Route(webService.GET("/healthz").To(healthz.KubeConnectionHealthzFuncFactory(app.clusterConfig, apiHealthVersion)).Doc("Health endpoint")) ++ webService.Route(webService.GET("/healthz").To(handle200). ++ Produces(restful.MIME_JSON). ++ Returns(200, "OK", nil)) + + restfulContainer := restful.NewContainer() + restfulContainer.ServeMux = mux + restfulContainer.Add(webService) -+ server := http.Server{ Addr: app.ServiceListen.Address(), Handler: mux,