-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add separate healthz endpoint to virt-operator (#570)
* feat(core): add separate healthz endpoint to virt-operator --------- Signed-off-by: Maksim Fedotov <[email protected]>
- Loading branch information
1 parent
afe682a
commit af350ba
Showing
2 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
images/virt-artifact/patches/026-add-healthz-to-virt-operator.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
diff --git a/pkg/virt-operator/application.go b/pkg/virt-operator/application.go | ||
index 47b4880c38..7e889dd48b 100644 | ||
--- a/pkg/virt-operator/application.go | ||
+++ b/pkg/virt-operator/application.go | ||
@@ -341,8 +341,6 @@ func Execute() { | ||
} | ||
|
||
func (app *VirtOperatorApp) Run() { | ||
- promTLSConfig := kvtls.SetupPromTLS(app.operatorCertManager, app.clusterConfig) | ||
- | ||
go func() { | ||
|
||
mux := http.NewServeMux() | ||
@@ -360,15 +358,34 @@ func (app *VirtOperatorApp) Run() { | ||
restfulContainer.ServeMux = mux | ||
restfulContainer.Add(webService) | ||
|
||
+ server := http.Server{ | ||
+ Addr: app.ServiceListen.MetricsAddress(), | ||
+ Handler: mux, | ||
+ } | ||
+ if err := server.ListenAndServe(); err != nil { | ||
+ golog.Fatal(err) | ||
+ } | ||
+ }() | ||
+ 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(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, | ||
- TLSConfig: promTLSConfig, | ||
- // Disable HTTP/2 | ||
- // See CVE-2023-44487 | ||
- TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){}, | ||
} | ||
- if err := server.ListenAndServeTLS("", ""); err != nil { | ||
+ if err := server.ListenAndServe(); err != nil { | ||
golog.Fatal(err) | ||
} | ||
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters