Reorder custom_nodepool_arguments for node-pool create command #596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes / Features
As node-pool create user-provided arguments are not appended as latest to the underlaying command execution, it is impossible to override the ones that appended by the code later. For gcloud command execution order matters and even if argument is duplicated, the later one wins. By moving
custom_nodepool_argumentsat the very end, we are allowing users to override all pre-generated arguments.For instance, to override a default nodepool version argument used by XPK, we can supply an argument:
--custom-nodepool-arguments="--node-version=1.33.3-gke.1255000"This will render command:
This will result with nodepool created with
1.33.3-gke.1255000version, asgcloudpicks the value from last argument of any given name.Testing / Documentation
Tested with command:
python3 xpk.py cluster create --cluster=xpk-test-v6e-1x1-3 --project=tpu-staging-env-one-vm --tpu-type=v6e-1x1 --zone=us-central1-b --num-nodes=1 --enable-autoprovisioning --on-demand --custom-nodepool-arguments="--node-version=1.33.3-gke.1255000"