Skip to content

Commit 106753b

Browse files
committed
Add http2 handling for healthcheck mode
1 parent f360561 commit 106753b

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

paasta_tools/cli/cmds/local_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def run_healthcheck_on_container(
168168
healthcheck_result = perform_cmd_healthcheck(
169169
docker_client, container_id, healthcheck_data, timeout
170170
)
171-
elif healthcheck_mode in ["http", "https", "http2"]:
171+
elif healthcheck_mode == "http" or healthcheck_mode == "https":
172172
healthcheck_result = perform_http_healthcheck(healthcheck_data, timeout)
173173
elif healthcheck_mode == "tcp":
174174
healthcheck_result = perform_tcp_healthcheck(healthcheck_data, timeout)

paasta_tools/kubernetes_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ def get_liveness_probe(
13711371
timeout_seconds=timeout_seconds,
13721372
)
13731373

1374-
if mode in ["http", "https", "http2"]:
1374+
if mode == "http" or mode == "https":
13751375
path = self.get_healthcheck_uri(service_namespace_config)
13761376
probe.http_get = V1HTTPGetAction(
13771377
path=path, port=self.get_container_port(), scheme=mode.upper()

paasta_tools/long_running_service_tools.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ def get_healthcheck_mode(self) -> str:
9393
"""
9494
healthcheck_mode = self.get("healthcheck_mode", None)
9595
if not healthcheck_mode:
96-
return self.get_mode()
97-
else:
98-
return healthcheck_mode
96+
mode = self.get_mode()
97+
if mode == "http2":
98+
healthcheck_mode = "http"
99+
else:
100+
healthcheck_mode = mode
101+
return healthcheck_mode
99102

100103
def get_mode(self) -> str:
101104
"""Get the mode that the service runs in and check that we support it.
@@ -424,7 +427,7 @@ def get_healthcheck_for_instance(
424427
mode = service_manifest.get_healthcheck_mode(smartstack_config)
425428
hostname = socket.getfqdn()
426429

427-
if mode in ["http", "https", "http2"]:
430+
if mode == "http" or mode == "https":
428431
path = service_manifest.get_healthcheck_uri(smartstack_config)
429432
healthcheck_command = "%s://%s:%d%s" % (mode, hostname, random_port, path)
430433
elif mode == "tcp":

0 commit comments

Comments
 (0)