Skip to content

Commit

Permalink
fix pod spec
Browse files Browse the repository at this point in the history
  • Loading branch information
asaiacai committed Nov 22, 2024
1 parent 783792a commit f19667b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sky/provision/kubernetes/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,19 +747,17 @@ def _create_pod_thread(i: int):
pod_spec_copy['metadata']['labels'].update(head_selector)
pod_spec_copy['metadata']['name'] = f'{cluster_name_on_cloud}-head'
else:
pod_spec['metadata']['labels'].update(constants.WORKER_NODE_TAGS)
pod_name = f'{cluster_name_on_cloud}-worker{pod_id}'
if pod_id == 0 or pod_name in running_pods:
continue
pod_spec['metadata']['name'] = pod_name
pod_spec['metadata']['labels']['component'] = pod_name
pod_spec_copy['metadata']['labels'].update(constants.WORKER_NODE_TAGS)
pod_name = f'{cluster_name_on_cloud}-worker{i}'
pod_spec_copy['metadata']['name'] = pod_name
pod_spec_copy['metadata']['labels']['component'] = pod_name
# For multi-node support, we put a soft-constraint to schedule
# worker pods on different nodes than the head pod.
# This is not set as a hard constraint because if different nodes
# are not available, we still want to be able to schedule worker
# pods on larger nodes which may be able to fit multiple SkyPilot
# "nodes".
pod_spec['spec']['affinity'] = {
pod_spec_copy['spec']['affinity'] = {
'podAntiAffinity': {
# Set as a soft constraint
'preferredDuringSchedulingIgnoredDuringExecution': [{
Expand Down

0 comments on commit f19667b

Please sign in to comment.