Skip to content
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

[AKS] Prompt when disabling CSI Drivers #4868

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

ZeroMagic
Copy link
Contributor

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
The precondition is to put your code inside this repository and upgrade the version in the pull request but do not modify src/index.json.

@ghost ghost requested review from zhoxing-ms and wangzelin007 May 22, 2022 17:39
@ghost ghost assigned zhoxing-ms May 22, 2022
@ghost ghost added this to the Jun 2022 (2022-07-05) milestone May 22, 2022
@ghost ghost added the Auto-Assign Auto assign by bot label May 22, 2022
@ghost ghost requested a review from yonzhan May 22, 2022 17:39
@ghost ghost added the AKS label May 22, 2022
@yonzhan
Copy link
Collaborator

yonzhan commented May 22, 2022

AKS

@wangzelin007
Copy link
Member

Please address those conflicts and the 7 failing checks.

@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch from 939ca17 to 911752e Compare May 30, 2022 15:46
@@ -907,6 +916,16 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches,
enable_apiserver_vnet_integration=False,
apiserver_subnet_id=None,
):

if disable_disk_driver or disable_file_driver:
msg = 'Did you check if the related PVs and PVCs were deleted before disabling the CSI Drivers?'
Copy link
Contributor

@andyzhangx andyzhangx May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure there are no existing Kubernetes resources that are used by the CSI driver before disabling

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olsenme are you ok with the above statement in the cli command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

if not yes and not prompt_y_n(msg, default="n"):
return None
if disable_snapshot_controller:
msg = 'Did you check if VolumeSnapshots, VolumeSnapshotClasses and VolumeSnapshotContents CRDs and their resources were deleted before disabling SnapshotController?'
Copy link
Contributor

@andyzhangx andyzhangx May 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure there are no existing Kubernetes resources that are used by the snapshot controller before disabling

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olsenme are you ok with the above statement in the cli command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch 2 times, most recently from ce74139 to 0bccf1f Compare May 31, 2022 02:10
@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch 2 times, most recently from 93ce389 to 1676ce1 Compare May 31, 2022 07:21
Comment on lines 818 to 827
if disable_disk_driver or disable_file_driver:
msg = "Please make sure there are no existing PVs and PVCs that are used by the CSI driver before disabling."
if not yes and not prompt_y_n(msg, default="n"):
return None
if disable_snapshot_controller:
msg = "Please make sure there are no existing VolumeSnapshots, VolumeSnapshotClasses and VolumeSnapshotContents " \
"that are used by the snapshot controller before disabling."
if not yes and not prompt_y_n(msg, default="n"):
return None

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put these statements below raw_parameters = locals(). Also put them into decorator.py? It's hard to test the entry function (aks_create).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 921 to 929
if disable_disk_driver or disable_file_driver:
msg = "Please make sure there are no existing PVs and PVCs that are used by the CSI driver before disabling."
if not yes and not prompt_y_n(msg, default="n"):
return None
if disable_snapshot_controller:
msg = "Please make sure there are no existing VolumeSnapshots, VolumeSnapshotClasses and VolumeSnapshotContents " \
"that are used by the snapshot controller before disabling."
if not yes and not prompt_y_n(msg, default="n"):
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch from 1676ce1 to d534ce0 Compare May 31, 2022 10:41

:return: Optional[ManagedClusterStorageProfileDiskCSIDriver]
"""
enable_disk_driver = self.raw_param.get("enable_disk_driver")
disable_disk_driver = self.raw_param.get("disable_disk_driver")
disk_driver_version = self.raw_param.get("disk_driver_version")

if disable_disk_driver:
msg = "Please make sure there are no existing PVs and PVCs that are used by AzureDisk CSI driver before disabling."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the prompt may happen in az aks create command? it should only prompt in az aks update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. Let me add it into self.decorator_mode == DecoratorMode.UPDATE

@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch from d534ce0 to de7b30b Compare May 31, 2022 13:05
@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch 3 times, most recently from cf76919 to 20ff17e Compare May 31, 2022 13:50
@ZeroMagic ZeroMagic force-pushed the jiliu8/disable-alert branch from 20ff17e to 4a5fb99 Compare May 31, 2022 14:21
Copy link
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +1763 to +1765
msg = "Please make sure there are no existing PVs and PVCs that are used by AzureDisk CSI driver before disabling."
if not self.get_yes() and not prompt_y_n(msg, default="n"):
raise DecoratorEarlyExitException()
Copy link
Contributor

@zhoxing-ms zhoxing-ms Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask will the execution of CLI scripts in the automation scenario be blocked by such interactive steps that require input?

Copy link
Contributor Author

@ZeroMagic ZeroMagic Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. but -y can be added into scripts like what we do in test_aks_command.py

Comment on lines +1798 to +1800
msg = "Please make sure there are no existing PVs and PVCs that are used by AzureFile CSI driver before disabling."
if not self.get_yes() and not prompt_y_n(msg, default="n"):
raise DecoratorEarlyExitException()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment on lines +1834 to +1837
msg = "Please make sure there are no existing VolumeSnapshots, VolumeSnapshotClasses and VolumeSnapshotContents " \
"that are used by the snapshot controller before disabling."
if not self.get_yes() and not prompt_y_n(msg, default="n"):
raise DecoratorEarlyExitException()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@zhoxing-ms zhoxing-ms merged commit d47de83 into Azure:main Jun 2, 2022
@ZeroMagic ZeroMagic deleted the jiliu8/disable-alert branch June 2, 2022 03:06
FumingZhang added a commit to FumingZhang/azure-cli-extensions that referenced this pull request Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS Auto-Assign Auto assign by bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants