Skip to content

Commit eb47b61

Browse files
committed
iterate
1 parent 06114e0 commit eb47b61

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

jupyterhub/files/hub/jupyterhub_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def camelCaseify(s):
128128
chart_name = get_config("Chart.Name")
129129
chart_version = get_config("Chart.Version")
130130
if chart_name and chart_version:
131-
common_labels["helm.sh/chart"] = f"{chart_name}-{chart_version.replace('+', '_')}"
131+
common_labels["helm.sh/chart"] = common_labels["chart"] = f"{chart_name}-{chart_version.replace('+', '_')}"
132132
chart_app_version = get_config("Chart.AppVersion")
133133
if chart_app_version:
134134
common_labels["app.kubernetes.io/version"] = chart_app_version

tests/test_spawn.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import subprocess
23
import time
34

@@ -22,7 +23,7 @@ def test_spawn_basic(
2223
r = api_request.post("/users/" + jupyter_user + "/server")
2324
assert r.status_code in (201, 202)
2425
try:
25-
# check successfull spawn
26+
# check successful spawn
2627
server_model = _wait_for_user_to_spawn(
2728
api_request, jupyter_user, request_data["test_timeout"]
2829
)
@@ -36,6 +37,32 @@ def test_spawn_basic(
3637
assert r.status_code == 200
3738
assert "version" in r.json()
3839

40+
# check user pod's labels
41+
pod_json = subprocess.check_output(
42+
[
43+
"kubectl",
44+
"get",
45+
"--output=json",
46+
pod_name,
47+
]
48+
)
49+
pod = json.loads(pod_json)
50+
pod_labels = pod["metadata"]["labels"]
51+
52+
# check for modern labels
53+
assert pod_labels["app.kubernetes.io/name"] == "jupyterhub"
54+
assert "app.kubernetes.io/instance" in pod_labels
55+
assert pod_labels["app.kubernetes.io/component"] == "singleuser-server"
56+
assert pod_labels["helm.sh/chart"].startswith("jupyterhub-")
57+
assert "app.kubernetes.io/version" in pod_labels
58+
assert pod_labels["app.kubernetes.io/managed-by"] == "kubespawner"
59+
60+
# check for legacy labels still meant to be around
61+
assert pod_labels["app"] == "jupyterhub"
62+
assert "release" in pod_labels
63+
assert pod_labels["chart"].startswith("jupyterhub-")
64+
assert pod_labels["component"] == "singleuser-server"
65+
3966
# check user pod's extra environment variable
4067
pod_name = server_model["state"]["pod_name"]
4168
c = subprocess.run(

0 commit comments

Comments
 (0)