Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions bindata/assets/deployments/downloads-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
memory: 50Mi
readinessProbe:
httpGet:
path: /
path: /healthz
port: 8080
scheme: HTTP
timeoutSeconds: 1
Expand All @@ -57,7 +57,7 @@ spec:
- /bin/sh
livenessProbe:
httpGet:
path: /
path: /healthz
port: 8080
scheme: HTTP
timeoutSeconds: 1
Expand All @@ -76,6 +76,7 @@ spec:
- |
cat <<EOF >>/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))

Expand All @@ -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):
Expand All @@ -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)
Expand Down