cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

server,cks: check if vm is cks node during vm destroy

Open shwstppr opened this issue 1 year ago • 6 comments

Description

Fixes #8902

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
  • [ ] build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [ ] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [ ] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

shwstppr avatar May 08 '24 09:05 shwstppr

Codecov Report

Attention: Patch coverage is 29.78723% with 33 lines in your changes missing coverage. Please review.

Project coverage is 14.96%. Comparing base (87e7c57) to head (11b2156). Report is 21 commits behind head on 4.19.

Files Patch % Lines
...va/com/cloud/utils/component/ComponentContext.java 0.00% 14 Missing :warning:
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% 10 Missing :warning:
...tes/cluster/dao/KubernetesClusterVmMapDaoImpl.java 0.00% 8 Missing :warning:
...ubernetes/cluster/KubernetesClusterHelperImpl.java 93.33% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #9057      +/-   ##
============================================
- Coverage     14.96%   14.96%   -0.01%     
+ Complexity    10995    10988       -7     
============================================
  Files          5373     5373              
  Lines        469005   469071      +66     
  Branches      58953    61186    +2233     
============================================
- Hits          70198    70184      -14     
- Misses       391036   391120      +84     
+ Partials       7771     7767       -4     
Flag Coverage Δ
uitests 4.31% <ø> (ø)
unittests 15.66% <29.78%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 08 '24 09:05 codecov-commenter

@shwstppr I am not sure if we should disallow the operation.

would it be a valid use case for users to

  • drain the node in CKS
  • remove the node vm from cloudstack
  • scale the cks cluster to get a new node

for your information, in Autoscale VM group, users can destroy a specific VM when the vm group is disabled. the corresponding reference/map in database and load balancer rules are also removed. of course, cks cluster is totally different from AS vm group.

weizhouapache avatar May 08 '24 10:05 weizhouapache

@shwstppr I am not sure if we should disallow the operation.

would it be a valid use case for users to

* drain the node in CKS

* remove the node vm from cloudstack

* scale the cks cluster to get a new node

for your information, in Autoscale VM group, users can destroy a specific VM when the vm group is disabled. the corresponding reference/map in database and load balancer rules are also removed. of course, cks cluster is totally different from AS vm group.

@weizhouapache understood. Though destroying a valid cks node is also allowed right now. @Pearl1594 @nvazquez do we plan to add an API to remove a VM/node from CKS cluster? If there is, then the case mentioned by Wei should get handled? User can:

  • drain node
  • remove it from k8s cluster
  • destroy the vm

shwstppr avatar May 08 '24 11:05 shwstppr

@shwstppr I am not sure if we should disallow the operation. would it be a valid use case for users to

* drain the node in CKS

* remove the node vm from cloudstack

* scale the cks cluster to get a new node

for your information, in Autoscale VM group, users can destroy a specific VM when the vm group is disabled. the corresponding reference/map in database and load balancer rules are also removed. of course, cks cluster is totally different from AS vm group.

@weizhouapache understood. Though destroying a valid cks node is also allowed right now. @Pearl1594 @nvazquez do we plan to add an API to remove a VM/node from CKS cluster? If there is, then the case mentioned by Wei should get handled? User can:

  • drain node
  • remove it from k8s cluster
  • destroy the vm

thanks @shwstppr looks like a good idea to add a new API .

weizhouapache avatar May 08 '24 11:05 weizhouapache

@weizhouapache on the special case discussed earlier, @Pearl1594 made me aware that we already have an option with scaleKubernetesCluster API to delete a specific node using nodeids param. We also show a delete action in the UI so the use-case that you mentioned should get covered by that, image

shwstppr avatar May 09 '24 11:05 shwstppr

@weizhouapache on the special case discussed earlier, @Pearl1594 made me aware that we already have an option with scaleKubernetesCluster API to delete a specific node using nodeids param. We also show a delete action in the UI so the use-case that you mentioned should get covered by that, image

That is great, thanks @shwstppr

Overall this pr looks good to me.

Can we add the information above in the error message, if user tries to delete a cks node?

weizhouapache avatar May 09 '24 15:05 weizhouapache

@blueorangutan package

shwstppr avatar May 22 '24 06:05 shwstppr

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar May 22 '24 06:05 blueorangutan

Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9656

blueorangutan avatar May 22 '24 07:05 blueorangutan

@blueorangutan package

shwstppr avatar May 22 '24 08:05 shwstppr

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar May 22 '24 08:05 blueorangutan

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9665

blueorangutan avatar May 22 '24 10:05 blueorangutan

@blueorangutan package

shwstppr avatar May 24 '24 11:05 shwstppr

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

blueorangutan avatar May 24 '24 11:05 blueorangutan

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9695

blueorangutan avatar May 24 '24 13:05 blueorangutan

@blueorangutan test

shwstppr avatar May 27 '24 08:05 shwstppr

@shwstppr a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

blueorangutan avatar May 27 '24 08:05 blueorangutan

[SF] Trillian test result (tid-10283) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 42160 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9057-t10283-kvm-centos7.zip Smoke tests completed. 131 look OK, 0 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File

blueorangutan avatar May 27 '24 20:05 blueorangutan

Added test API calls in the PR description

shwstppr avatar Jun 05 '24 08:06 shwstppr