-
Notifications
You must be signed in to change notification settings - Fork 561
eks: support nodepool labels and taints #6744
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: master
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 |
|---|---|---|
|
|
@@ -101,6 +101,22 @@ def ApplyInferenceS3PvAndPvc() -> None: | |
| logging.info('Successfully applied S3 PVC.') | ||
|
|
||
|
|
||
| def _ParseTaint(taint_str: str) -> dict[str, str]: | ||
| """Parses a taint string into eksctl's dict format. | ||
|
|
||
| Args: | ||
| taint_str: Taint in 'key=value:Effect' or 'key:Effect' format. | ||
|
|
||
| Returns: | ||
| Dict with 'key', 'value' (optional), and 'effect' keys for eksctl. | ||
| """ | ||
| key_value, effect = taint_str.rsplit(':', 1) | ||
| if '=' in key_value: | ||
| key, value = key_value.split('=', 1) | ||
| return {'key': key, 'value': value, 'effect': effect} | ||
| return {'key': key_value, 'effect': effect} | ||
|
|
||
|
|
||
| class BaseEksCluster(kubernetes_cluster.KubernetesCluster): | ||
| """Shared base class for Elastic Kubernetes Service cluster auto mode & not.""" | ||
|
|
||
|
|
@@ -195,16 +211,19 @@ def _RenderNodeGroupJson( | |
| self, nodepool: container.BaseNodePoolConfig | ||
| ) -> dict[str, Any]: | ||
| """Constructs the node group json dictionary.""" | ||
| labels = {'pkb_nodepool': nodepool.name} | ||
|
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. This will work for eksctl setup, but #6748 uses eks create-group explicitly which cannot leverage this. @ashishsuneja could we converge on the approach?
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. Thanks Ajay — agree this is worth converging on. A few things that might help: |
||
| if nodepool.node_labels: | ||
| labels.update(nodepool.node_labels) | ||
| group_json = { | ||
| 'name': nodepool.name, | ||
| 'instanceType': nodepool.machine_type, | ||
| 'desiredCapacity': nodepool.num_nodes, | ||
| 'amiFamily': 'AmazonLinux2023', | ||
| 'tags': util.MakeDefaultTags(), | ||
| 'labels': { | ||
| 'pkb_nodepool': nodepool.name, | ||
| }, | ||
| 'labels': labels, | ||
| } | ||
| if nodepool.node_taints: | ||
| group_json['taints'] = [_ParseTaint(t) for t in nodepool.node_taints] | ||
| if nodepool.min_nodes != nodepool.max_nodes: | ||
| group_json['minSize'] = nodepool.min_nodes | ||
| group_json['maxSize'] = nodepool.max_nodes | ||
|
|
||
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.
Could we add the matching GKE wiring in
_AddNodeParamsToCmdas well? It would help symmetric setup for label/taint-based pinning for cross-cloud benchmarks.. You could mergenode_labelsinto
--node-labelsand--node-taintsfromnode_taintsin google_kubernetes_engine.py.