Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change component name from dind to image-builder #1543

Merged
merged 1 commit into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
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
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