diff --git a/bindata/assets/deployments/downloads-deployment.yaml b/bindata/assets/deployments/downloads-deployment.yaml index 428865a65..2688f6d28 100644 --- a/bindata/assets/deployments/downloads-deployment.yaml +++ b/bindata/assets/deployments/downloads-deployment.yaml @@ -39,7 +39,7 @@ spec: memory: 50Mi readinessProbe: httpGet: - path: / + path: /healthz port: 8080 scheme: HTTP timeoutSeconds: 1 @@ -57,7 +57,7 @@ spec: - /bin/sh livenessProbe: httpGet: - path: / + path: /healthz port: 8080 scheme: HTTP timeoutSeconds: 1 @@ -76,6 +76,7 @@ spec: - | cat <>/tmp/serve.py import errno, http.server, os, re, signal, socket, sys, tarfile, tempfile, threading, time, zipfile + from http import HTTPStatus signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0)) @@ -94,6 +95,15 @@ spec: '', ]).encode('utf-8')) + class HealthzSimpleHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): + def do_GET(self): + if self.path == '/healthz': + self.send_response_only(HTTPStatus.OK) + self.send_header("Content-Length", '0') + self.end_headers() + return + return http.server.SimpleHTTPRequestHandler.do_GET(self) + # Launch multiple listeners as threads class Thread(threading.Thread): def __init__(self, i, socket): @@ -104,7 +114,7 @@ spec: self.start() def run(self): - server = http.server.SimpleHTTPRequestHandler + server = HealthzSimpleHTTPRequestHandler server.server_version = "OpenShift Downloads Server" server.sys_version = "" httpd = http.server.HTTPServer(addr, server, False) diff --git a/pkg/console/subresource/deployment/deployment_test.go b/pkg/console/subresource/deployment/deployment_test.go index fd0caedb6..90e593b43 100644 --- a/pkg/console/subresource/deployment/deployment_test.go +++ b/pkg/console/subresource/deployment/deployment_test.go @@ -1649,7 +1649,7 @@ func TestDefaultDownloadsDeployment(t *testing.T) { ReadinessProbe: &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ - Path: "/", + Path: "/healthz", Port: intstr.FromInt(api.DownloadsPort), Scheme: corev1.URIScheme("HTTP"), }, @@ -1662,7 +1662,7 @@ func TestDefaultDownloadsDeployment(t *testing.T) { LivenessProbe: &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ - Path: "/", + Path: "/healthz", Port: intstr.FromInt(api.DownloadsPort), Scheme: corev1.URIScheme("HTTP"), },