-
Notifications
You must be signed in to change notification settings - Fork 57
Workload policy label #817
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| """ | ||
|
|
||
| from ..utils.console import xpk_print | ||
| from ..utils.topology import is_topology_valid | ||
| from ..utils.execution_context import is_dry_run | ||
| from .capacity import AUTOPROVISIONING_CONFIG_MAXIMUM_KEY, AUTOPROVISIONING_CONFIG_VALUE | ||
| from .resources import CLUSTER_RESOURCES_CONFIGMAP, get_cluster_configmap | ||
|
|
@@ -303,3 +304,18 @@ def create_sub_slicing_annotations(sub_slicing_topology: str) -> list[str]: | |
| ), | ||
| f'cloud.google.com/gke-tpu-slice-topology: {sub_slicing_topology}', | ||
| ] | ||
|
|
||
|
|
||
| def create_placement_policy_label(system: SystemCharacteristics) -> str: | ||
| if system.accelerator_type != AcceleratorType.TPU: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this guard? I'm surprised that placement_policy_label can be rendered as empty string if it's not supported, but also if accelerator is not TPU. If we need to add a label whenever placement policy is supported, then I'd expect |
||
| return '' | ||
| name = get_placement_policy_name(system) | ||
| return f'cloud.google.com/placement-policy-name: {name}' | ||
|
|
||
|
|
||
| def get_placement_policy_name(system: SystemCharacteristics) -> str: | ||
| return f'{system.device_type}-{system.topology}-placement-policy' | ||
|
|
||
|
|
||
| def is_placement_policy_supported(system: SystemCharacteristics) -> bool: | ||
| return system.requires_workload_policy and is_topology_valid(system.topology) | ||
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's too bad we have no test coverage for this, no unit tests cover the actual yaml content, and goldens only capture that some change happened in the template.