You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: remove Kubernetes resources on app management uninstall and daemon removal - #1210
Removing an ExApp in the app management unregistered it but left its Kubernetes Deployment, Service and volume in the cluster, and so did removing its Kubernetes deploy daemon in the admin settings. Only occ app_api:app:unregister removed them.
Changes
KubernetesActions::removeExAppResources() removes an ExApp's Kubernetes resources, for every role of a multi-role ExApp, and keeps the volume unless data removal is asked for. The occ command, the uninstall route and the daemon removal use it.
A multi-role ExApp whose first role fails to be removed still has its other roles removed.
Kubernetes resource removal now uses a shared method that reads saved service roles and removes each configured deployment, or removes the single deployment when no roles are saved. Role removal continues after a failure and returns the first error. The unregister command, app management controller, and daemon-removal service call the shared method. The controller and service log data deletion after successful removal. Tests cover role removal and Kubernetes cleanup through these paths. The changelog records the cleanup fix.
Merge Risk: Moderate · up to 26220
Removing an ExApp or its Kubernetes daemon can report success while some deployments or volumes remain in the cluster, with no registration left to retry the cleanup. Fix the failure handling before merging. The removeContainer=false case only affects direct API callers.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the change: removing Kubernetes resources on app management uninstall and on daemon removal. The raw summary confirms the uninstall route and the daemon removal path both call the new …
Description check
The description states the bug: unregistering an ExApp in app management, or removing its Kubernetes deploy daemon, left Kubernetes Deployment, Service and volume behind. It also lists the new Kuberne…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the change: removing Kubernetes resources on app management uninstall and on daemon removal. The raw summary confirms the uninstall route and the daemon removal path both call the new removal logic, so the title matches the main change.
Full details: Description check
Explanation
The description states the bug: unregistering an ExApp in app management, or removing its Kubernetes deploy daemon, left Kubernetes Deployment, Service and volume behind. It also lists the new KubernetesActions::removeExAppResources() method, the callers, volume retention, and multi-role removal. This matches the changeset.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 59ab8663-3c42-49da-809f-9e7a7c5e1699
Commits
Reviewing files that changed from the base of the PR and between 072b6b4 and 26220bc.
Files selected for processing: 10
CHANGELOG.md
lib/Command/ExApp/Unregister.php
lib/Controller/ExAppsPageController.php
lib/DeployActions/KubernetesActions.php
lib/Service/AppAPIService.php
tests/php/Command/ExApp/UnregisterTest.php
tests/php/Controller/ExAppsPageControllerTest.php
tests/php/DeployActions/KubernetesActionsTest.php
tests/php/Service/AppAPIServiceTest.php
tests/psalm-baseline.xml
Files with no reviewable changes: 1
tests/psalm-baseline.xml
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Honor removeContainer before deleting Kubernetes deployments.
uninstallApp() documents $removeContainer as whether to remove the ExApp container. The Kubernetes branch removes the ExApp deployments without checking that flag. A caller that passes removeContainer: false still loses the running workload.
The non-harp Docker branch guards its container removal with $removeContainer. Apply the same guard to the Kubernetes branch.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Quick win
Preserve the registration when Kubernetes cleanup fails.
If HaRP is unavailable or one role cannot be removed, $removeError is nonempty. The controller still calls unregisterExApp() at Line 523 and returns success. ExAppService::unregisterExApp() also deletes k8s_service_roles, so remaining deployments lose their cleanup metadata and the administrator cannot retry removal through AppAPI.
Return an error before unregistration when cleanup fails. Retain the registration and deployment options for a retry.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Heavy lift
Keep failed Kubernetes ExApps and their role list when cleanup fails.
When removeExAppResources() returns an error, the loop skips logExAppDataDeleted(), but the following unregisterExApp() still runs. That call removes the ExApp's deploy options, including k8s_service_roles, and the ExApp row. A partial multi-role failure can leave role resources in the cluster with no record of their roles. unregisterDaemonConfig() then deletes the daemon config and reports success, so the failure is silent.
Keeping the ExApp registered alone does not allow a retry, because the daemon config is also deleted. A safe fix needs these changes:
Skip unregisterExApp() for an ExApp whose removal returned an error, so its deploy options stay in place.
Return the failure from removeExAppsByDaemonConfigName() instead of void. The controller must not delete the daemon config or report success when a cleanup failed.
Decide whether the Docker branches need the same rule, because they also unregister after a failed removal.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removing an ExApp in the app management unregistered it but left its Kubernetes Deployment, Service and volume in the cluster, and so did removing its Kubernetes deploy daemon in the admin settings. Only
occ app_api:app:unregisterremoved them.Changes
KubernetesActions::removeExAppResources()removes an ExApp's Kubernetes resources, for every role of a multi-role ExApp, and keeps the volume unless data removal is asked for. The occ command, the uninstall route and the daemon removal use it.