cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Fix NPE during kubernetes cluster creation when network has rules with ports saved as null on DB

Open GaOrtiga opened this issue 1 year ago • 32 comments

Description

During the creation of firewall rules, if one of the limits for the ports is not informed, it is saved in the database as Null, indicating that there is no starting/ending limit.

while creating a Kubernetes cluster, if the selected network has a rule that contains ports saved as null, an error is thrown, stopping the execution of the process.

This behaviour has been fixed, making it so that any port saved as null is regarded as being being on its respective limit (1 for start ports and 65535 for end ports) during the creation of a Kubernetes cluster.

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

Bug Severity

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

Screenshots (if appropriate):

How Has This Been Tested?

I created a rule in an existing network, with null starting port and ending on port 10, making it so it should not conflict with any of the ports required by the Kubernetes cluster. Before applying the changes, an error would be thrown.

I repeated the process after applying the changes and the cluster was successfully created.

GaOrtiga avatar Jun 11 '24 14:06 GaOrtiga

Codecov Report

Attention: Patch coverage is 13.63636% with 19 lines in your changes missing coverage. Please review.

Project coverage is 16.02%. Comparing base (b19c069) to head (f893bd4). Report is 317 commits behind head on main.

Files with missing lines Patch % Lines
...va/com/cloud/network/dao/FirewallRulesDaoImpl.java 0.00% 11 Missing :warning:
...KubernetesClusterResourceModifierActionWorker.java 0.00% 8 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9223      +/-   ##
============================================
+ Coverage     15.81%   16.02%   +0.21%     
- Complexity    12554    13147     +593     
============================================
  Files          5629     5658      +29     
  Lines        492028   496325    +4297     
  Branches      62750    60111    -2639     
============================================
+ Hits          77813    79538    +1725     
- Misses       405892   407938    +2046     
- Partials       8323     8849     +526     
Flag Coverage Δ
uitests 4.01% <ø> (-0.47%) :arrow_down:
unittests 16.86% <13.63%> (+0.25%) :arrow_up:

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[bot] avatar Jun 12 '24 14:06 codecov[bot]

@blueorangutan package

borisstoyanov avatar Jun 13 '24 10:06 borisstoyanov

@borisstoyanov 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 Jun 13 '24 10:06 blueorangutan

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

blueorangutan avatar Jun 13 '24 11:06 blueorangutan

thanks @GaOrtiga @blueorangutan package

borisstoyanov avatar Jun 13 '24 12:06 borisstoyanov

@borisstoyanov 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 Jun 13 '24 12:06 blueorangutan

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

blueorangutan avatar Jun 13 '24 13:06 blueorangutan

@blueorangutan package

DaanHoogland avatar Jul 16 '24 18:07 DaanHoogland

@DaanHoogland 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 Jul 16 '24 18:07 blueorangutan

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

blueorangutan avatar Jul 16 '24 20:07 blueorangutan

@blueorangutan test

DaanHoogland avatar Jul 17 '24 06:07 DaanHoogland

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

blueorangutan avatar Jul 17 '24 06:07 blueorangutan

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

Test Result Time (s) Test File
test_role_account_acls_multiple_mgmt_servers Error 2.15 test_dynamicroles.py
test_query_async_job_result Error 102.01 test_async_job.py
test_revoke_certificate Error 0.02 test_certauthority_root.py
test_configure_ha_provider_invalid Error 0.01 test_hostha_simulator.py
test_configure_ha_provider_valid Error 0.04 test_hostha_simulator.py
test_ha_configure_enabledisable_across_clusterzones Error 0.01 test_hostha_simulator.py
test_ha_disable_feature_invalid Error 0.01 test_hostha_simulator.py
test_ha_enable_feature_invalid Error 0.01 test_hostha_simulator.py
test_ha_list_providers Error 0.01 test_hostha_simulator.py
test_ha_multiple_mgmt_server_ownership Error 0.01 test_hostha_simulator.py
test_ha_verify_fsm_available Error 0.01 test_hostha_simulator.py
test_ha_verify_fsm_degraded Error 0.01 test_hostha_simulator.py
test_ha_verify_fsm_fenced Error 0.01 test_hostha_simulator.py
test_ha_verify_fsm_recovering Error 0.01 test_hostha_simulator.py
test_hostha_configure_default_driver Error 0.01 test_hostha_simulator.py
test_hostha_configure_invalid_provider Error 0.01 test_hostha_simulator.py
test_hostha_disable_feature_valid Error 0.01 test_hostha_simulator.py
test_hostha_enable_feature_valid Error 0.01 test_hostha_simulator.py
test_hostha_enable_feature_without_setting_provider Error 0.01 test_hostha_simulator.py
test_list_ha_for_host Error 0.01 test_hostha_simulator.py
test_list_ha_for_host_invalid Error 0.01 test_hostha_simulator.py
test_list_ha_for_host_valid Error 0.01 test_hostha_simulator.py
test_01_host_ping_on_alert Error 0.07 test_host_ping.py
test_01_host_ping_on_alert Error 0.07 test_host_ping.py
test_01_browser_migrate_template Error 15.30 test_image_store_object_migration.py
test_06_purge_expunged_vm_background_task Failure 340.83 test_purge_expunged_vms.py
test_hostha_enable_ha_when_host_disabled Error 5.79 test_hostha_kvm.py
test_hostha_enable_ha_when_host_in_maintenance Error 305.91 test_hostha_kvm.py

blueorangutan avatar Jul 17 '24 21:07 blueorangutan

[SF] Trillian test result (tid-10912) Environment: kvm-alma8 (x2), Advanced Networking with Mgmt server a8 Total time taken: 52725 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9223-t10912-kvm-alma8.zip Smoke tests completed. 135 look OK, 2 have errors, 0 did not run Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_06_purge_expunged_vm_background_task Failure 339.14 test_purge_expunged_vms.py
test_03_secured_to_nonsecured_vm_migration Error 396.95 test_vm_life_cycle.py

blueorangutan avatar Jul 19 '24 04:07 blueorangutan

@borisstoyanov , @FelipeM525 tested (https://github.com/apache/cloudstack/pull/9223#pullrequestreview-2180689837), do you still want to test this as well?

DaanHoogland avatar Jul 19 '24 08:07 DaanHoogland

@blueorangutan package

JoaoJandre avatar Aug 13 '24 19:08 JoaoJandre

@JoaoJandre 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 Aug 13 '24 19:08 blueorangutan

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

blueorangutan avatar Aug 13 '24 20:08 blueorangutan

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

blueorangutan avatar Aug 14 '24 14:08 blueorangutan

@GaOrtiga can you review and address build failures? Thanks.

rohityadavcloud avatar Sep 04 '24 06:09 rohityadavcloud

@blueorangutan package

GaOrtiga avatar Sep 11 '24 17:09 GaOrtiga

@GaOrtiga 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 Sep 11 '24 17:09 blueorangutan

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

blueorangutan avatar Sep 11 '24 18:09 blueorangutan

@GaOrtiga Can you update the title with short summay of the issue ?

weizhouapache avatar Sep 11 '24 19:09 weizhouapache

@GaOrtiga can you review and address build failures? Thanks.

I have rebased it, everything seems fine now.

@GaOrtiga Can you update the title with short summay of the issue ?

Title updated.

GaOrtiga avatar Sep 12 '24 16:09 GaOrtiga

@blueorangutan package

weizhouapache avatar Sep 12 '24 17:09 weizhouapache

@weizhouapache 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 Sep 12 '24 18:09 blueorangutan

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

blueorangutan avatar Sep 12 '24 19:09 blueorangutan

@blueorangutan test

DaanHoogland avatar Sep 16 '24 07:09 DaanHoogland

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

blueorangutan avatar Sep 16 '24 07:09 blueorangutan