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

Add manager label to workers #38

Merged
merged 1 commit into from
Apr 23, 2021
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
3 changes: 3 additions & 0 deletions src/pod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ function worker_pod_spec!(pod::AbstractDict;
service_account_name=nothing)
pod["metadata"]["name"] = "$(driver_name)-worker-$port"

# Set a label with the manager name to support easy termination of all workers
pod["metadata"]["labels"]["manager"] = driver_name

cmd = `$cmd --bind-to=0:$port`

worker_container =
Expand Down
5 changes: 5 additions & 0 deletions test/pod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ end
@test keys(pod) == Set(["apiVersion", "kind", "metadata", "spec"])
@test pod["apiVersion"] == "v1"
@test pod["kind"] == "Pod"

@test keys(pod["metadata"]) == Set(["name", "labels"])
@test pod["metadata"]["name"] == "driver-worker-8080"
@test keys(pod["metadata"]["labels"]) == Set(["manager"])
@test pod["metadata"]["labels"]["manager"] == "driver"

@test pod["spec"]["restartPolicy"] == "Never"
@test length(pod["spec"]["containers"]) == 1

Expand Down