Skip to content

Commit

Permalink
feat: change component name from dind to image-builder
Browse files Browse the repository at this point in the history
In parallel of the work from jupyterhub#1531, this change will allow the use of
other builders than Docker without being tied to its nomenclature which
might make the whole a bit confusing when deploying and debugging.
  • Loading branch information
sgaist committed Oct 10, 2022
1 parent 969f2f6 commit 79dc9d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions binderhub/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,16 @@ def get_affinity(self):
"""
resp = self.api.list_namespaced_pod(
self.namespace,
label_selector="component=dind,app=binder",
label_selector="component=image-builder,app=binder",
_request_timeout=KUBE_REQUEST_TIMEOUT,
_preload_content=False,
)
dind_pods = json.loads(resp.read())
image_builder_pods = json.loads(resp.read())

if self.sticky_builds and dind_pods:
node_names = [pod["spec"]["nodeName"] for pod in dind_pods["items"]]
if self.sticky_builds and image_builder_pods:
node_names = [
pod["spec"]["nodeName"] for pod in image_builder_pods["items"]
]
ranked_nodes = rendezvous_rank(node_names, self.repo_url)
best_node_name = ranked_nodes[0]

Expand Down
8 changes: 4 additions & 4 deletions binderhub/tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async def test_build_fail(app, needs_build, needs_launch, always_build, pytestco
assert failed_events > 0, "Should have seen phase 'failed'"


def _list_dind_pods_mock():
def _list_image_builder_pods_mock():
"""Mock list of DIND pods"""
mock_response = mock.MagicMock()
mock_response.read.return_value = json.dumps(
Expand All @@ -139,7 +139,7 @@ def _list_dind_pods_mock():
def test_default_affinity():
# check that the default affinity is a pod anti-affinity

mock_k8s_api = _list_dind_pods_mock()
mock_k8s_api = _list_image_builder_pods_mock()

build = Build(
mock.MagicMock(),
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_default_affinity():

def test_sticky_builds_affinity():
# Setup some mock objects for the response from the k8s API
mock_k8s_api = _list_dind_pods_mock()
mock_k8s_api = _list_image_builder_pods_mock()

build = Build(
mock.MagicMock(),
Expand Down Expand Up @@ -205,7 +205,7 @@ def test_git_credentials_passed_to_podspec_upon_submit():
"access_token": "my_access_token",
}"""

mock_k8s_api = _list_dind_pods_mock()
mock_k8s_api = _list_image_builder_pods_mock()

build = Build(
mock.MagicMock(),
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/binderhub/templates/dind/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
labels:
name: {{ .Release.Name }}-dind
app: binder
component: dind
component: image-builder
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
Expand Down

0 comments on commit 79dc9d9

Please sign in to comment.