Delete process to apps that have charts disabled

Bug #2055697 reported by David Barbosa Bastos
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
David Barbosa Bastos

Bug Description

Brief Description
-----------------
When deleting an application that has one chart or more disabled, the app framework was not able to correctly delete the disabled charts from the helm repository.

If, after deleting an app, an attempt was made to upload that same app, a failure would occur, informing that the charts were already in the helm repository.

Severity
--------
Minor

Steps to Reproduce
------------------
1 - system application-upload <path>/dell-storage.tgz
2 - system application-delete dell-storage.tgz
3 - system application-upload <path>/dell-storage.tgz

Expected Behavior
------------------
Deletes an app that has charts disabled and all charts are deleted from the helm repository correctly. After deleting and trying to upload the same app, no error occurs and the upload and apply process is completed successfully

Actual Behavior
----------------
The upload process fails

Reproducibility
---------------
100% reproducible

System Configuration
--------------------
AIO-SX

Branch/Pull Time/Commit
-----------------------
SW_VERSION="23.09"
BUILD_TARGET="Host Installer"
BUILD_TYPE="Formal"
BUILD_ID="2023-11-23_19-00-40"
SRC_BUILD_ID="1535"

Last Pass
---------
n/a

Timestamp/Logs
--------------
sysinv.log:

sysinv 2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app [-] 'ingress': KeyError: 'ingress'
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app Traceback (most recent call last):
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app File "/usr/lib/python3/dist-packages/sysinv/conductor/kube_app.py", line 3172, in perform_app_delete
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app self._remove_app_charts_from_repo(app._kube_app.id, app.charts)
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app File "/usr/lib/python3/dist-packages/sysinv/conductor/kube_app.py", line 576, in _remove_app_charts_from_repo
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app self._get_charts_in_use_except([app_id])]
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app File "/usr/lib/python3/dist-packages/sysinv/conductor/kube_app.py", line 563, in _get_charts_in_use_except
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app charts_in_use = charts_in_use + self._get_list_of_charts(app)
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app File "/usr/lib/python3/dist-packages/sysinv/conductor/kube_app.py", line 1188, in _get_list_of_charts
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app return self._get_list_of_charts_fluxcd(app.sync_fluxcd_manifest)
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app File "/usr/lib/python3/dist-packages/sysinv/conductor/kube_app.py", line 1256, in _get_list_of_charts_fluxcd
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app filesystem_location = helm_utils.get_chart_tarball_path(
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app File "/usr/lib/python3/dist-packages/sysinv/helm/utils.py", line 312, in get_chart_tarball_path
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app chart_versions = root_index_yaml["entries"][chart_name]
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app KeyError: 'ingress'
2023-11-29 10:32:46.633 56272 ERROR sysinv.conductor.kube_app
sysinv 2023-11-29 10:32:46.644 56454 WARNING wsme.api [req-a066af66-2d39-4051-971d-a2abb5d862b9 admin admin] Client-side error: 'ingress'.: wsme.exc.ClientSideError: 'ingress'.

Test Activity
-------------
[Sanity, Feature Testing]

Workaround
----------
Manually delete disabled charts from helm repository

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.opendev.org/c/starlingx/config/+/910680
Committed: https://opendev.org/starlingx/config/commit/c9b71ebd65c698ff8fa6fb28b477a84c823b8203
Submitter: "Zuul (22348)"
Branch: master

commit c9b71ebd65c698ff8fa6fb28b477a84c823b8203
Author: David Bastos <email address hidden>
Date: Thu Feb 29 21:42:30 2024 -0300

    Fix delete process to apps that have charts disabled

    When deleting an application that has one chart or more disabled,
    the app framework was not able to correctly delete the disabled
    charts from the helm repository.

    If, after deleting an app, an attempt was made to upload that same
    app, a failure would occur, informing that the charts were already
    in the helm repository.

    The correction consists of using the kustomization-orig.yaml file
    instead of kustomization.yaml in the deletion process to list the
    enabled and disabled charts.

    Another fix was made in case an application has the status of
    "upload failed" and an attempt is made to delete another app. This
    caused a Python runtime error because the get_chart_tarball_path
    function tried to access the dictionary key and it wasn't there.

    The solution was to check if the key for that chart exists and only
    then try to access it. New logs are added to alert the user if the
    chart does not exist.

    Test Plan:
    PASS: Build-pkgs
    PASS: Upload, apply, remove and delete dell-storage
    PASS: Upload, apply, remove and delete oidc-auth-apps
    PASS: upload, apply, remove and delete metrics-server
    PASS: Deletes app that has charts disabled and all charts are
          deleted from the helm repository correctly.
    PASS: After deleting and trying to upload the same app, no error
          occurs and the upload and apply process is completed
          successfully.
    PASS: Deleting an app with another app with "upload failed"
          status and no Python runtime error occurs

    Closes-Bug: 2055697

    Change-Id: I22de414e8780fe3691d06bdd015e4c927dcc10f0
    Signed-off-by: David Bastos <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
tags: added: stx.10.0 stx.apps stx.config
Changed in starlingx:
assignee: nobody → David Barbosa Bastos (dbarbosa-wr)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.