Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Add node selector for pod_spec_mutator (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aachunella committed Aug 26, 2021
1 parent e62a6c8 commit 6aa5506
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions kubeflow/fairing/kubernetes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,20 @@ def _add_env(kube_manager, pod_spec, namespace): #pylint:disable=unused-argument
else:
pod_spec.containers[0].env = env_list
return _add_env


def get_node_selector(node_selector):
"""This function for pod_spec_mutators to designate node selector.
:param node_selector: dict of selection constraint
:return: obejct: The mutator fucntion for setting node selector
"""

def _node_selector(kube_master, pod_spec, namespace): #pylint:disable=unused-argument
if node_selector is None:
return
if pod_spec.containers and len(pod_spec.containers) >= 1:
pod_spec.node_selector = node_selector

return _node_selector

0 comments on commit 6aa5506

Please sign in to comment.