-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SDK: fix label check for ContainerOP entities #2243
Conversation
Hi @solovyevt. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Good catch. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Ark-kun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -17,7 +17,7 @@ | |||
def add_pod_env(op: BaseOp) -> BaseOp: | |||
"""Adds pod environment info to ContainerOp. | |||
""" | |||
if isinstance(op, ContainerOp) and op.pod_labels and op.pod_labels['add-pod-env'] == 'true': | |||
if isinstance(op, ContainerOp) and op.pod_labels and 'add-pod-env' in op.pod_labels and op.pod_labels['add-pod-env'] == 'true': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be just op.get('pod_labels', None) and op.pod_labels.get('add-pod-env'], None == 'true')
BTW, what's your use case for labels? |
@Ark-kun container_op.add_pod_label(
name="io.avoidme",
value="true"
)
container_op.add_affinity(affinity=k8s_client.V1Affinity(
pod_anti_affinity=k8s_client.V1PodAntiAffinity(
required_during_scheduling_ignored_during_execution=[
k8s_client.V1PodAffinityTerm(
topology_key="kubernetes.io/hostname",
label_selector=k8s_client.V1LabelSelector(
match_expressions=[
k8s_client.V1LabelSelectorRequirement(
key="io.avoidme",
operator="In",
values=["true"]
)
]
)
)
]
)
)) |
* Add router image publish github action Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Fix model status test Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Update isvc crd for autoscaling fields Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Fix helm chart webhook configuration Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Update modelmesh serving runtime crd Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Use yaml variable for version Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Add inferencegraphs rbac Signed-off-by: Dan Sun <dsun20@bloomberg.net> * Fix watcher test Signed-off-by: Dan Sun <dsun20@bloomberg.net>
Fix ContainerOp label check during compilation step. Previously it was failing with
KeyError: 'add-pod-env'
if you added custom labels to ContainerOp object withContainerOp.add_pod_label()
function.This change is