-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support multiple workload deletion from single workload delete command #62
Conversation
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.
Looks great! I already heard of a customer interested in using this feature so this will be eagerly used!
xpk.py
Outdated
xpk_print("There are no workloads to delete matching the filter in the cluster.") | ||
|
||
for workload in workloads: | ||
result = input(f'Do you want to delete the workload: {workload} (Y/n)? ') |
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.
I like the yes / no user feedback logic here! two suggestions:
- Can the user enter yes/no/y/n once per workload delete command, instead of once per workload. We can print out all the workloads that are planned to be deleted. (Same as https://github.com/google/xpk/blob/main/xpk.py#L1396-L1401)
I think it would be hard to ask the user to type yes several times.
- Can you refactor the user input y/yes/n/no logic we use in node pool delete into a function and use that here as well. I think we will also need it in cluster deletion as well for a new feature request. (https://github.com/google/xpk/blob/main/xpk.py#L1396-L1401)
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.
Updated!
xpk.py
Outdated
) | ||
|
||
### Optional arguments | ||
workload_delete_parser_optional_arguments.add_argument( | ||
'--workload', | ||
type=workload_name_type, | ||
default=None, | ||
help='The name of the workload to delete.', |
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.
Can you add that if the workload is not specified, the default behavior is that all workloads will be deleted from the cluster?
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.
Added!
README.md
Outdated
--cluster xpk-test | ||
``` | ||
|
||
This will delete all the workloads in `xpk-test` cluster. Deletion will only begin if you type `Y` at the prompt for every workload. |
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.
nit: to adjust the readme that users only need to type yes/y once at the prompt.
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.
Done!
required=True, | ||
) | ||
|
||
### Optional arguments |
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.
Can you add a --force
argument that skips the user prompt? This is good for automated tests for example. Or if a user really believes in themselves. You can build from https://github.com/google/xpk/blob/main/xpk.py#L2823-L2830
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.
Sure, added!
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.
LGTM, great set of changes! Thank you
Fixes / Features
Testing / Documentation
Testing details.