Repository navigation
fix: remove Kubernetes resources on app management uninstall and daemon removal #1210
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| use OC\App\Platform; | ||
| use OCA\AppAPI\AppInfo\Application; | ||
| use OCA\AppAPI\DeployActions\DockerActions; | ||
| use OCA\AppAPI\DeployActions\KubernetesActions; | ||
| use OCA\AppAPI\Fetcher\ExAppFetcher; | ||
| use OCA\AppAPI\ResponseDefinitions; | ||
| use OCA\AppAPI\Service\AppAPIService; | ||
|
|
@@ -52,6 +53,7 @@ public function __construct( | |
| private readonly AppAPIService $service, | ||
| private readonly DaemonConfigService $daemonConfigService, | ||
| private readonly DockerActions $dockerActions, | ||
| private readonly KubernetesActions $kubernetesActions, | ||
| private readonly CategoryFetcher $categoryFetcher, | ||
| private readonly IFactory $l10nFactory, | ||
| private readonly ExAppFetcher $exAppFetcher, | ||
|
|
@@ -512,6 +514,11 @@ public function uninstallApp(string $appId, bool $removeContainer = true, bool $ | |
| } | ||
| } | ||
| } | ||
| } elseif ($daemonConfig->getAcceptsDeployId() === $this->kubernetesActions->getAcceptsDeployId()) { | ||
| $removeError = $this->kubernetesActions->removeExAppResources($daemonConfig, $exApp->getAppid(), removeData: $removeData); | ||
| if ($removeData && $removeError === '') { | ||
| $this->exAppService->logExAppDataDeleted($exApp); | ||
| } | ||
|
Comment on lines
+519
to
+521
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preserve the registration when Kubernetes cleanup fails. If HaRP is unavailable or one role cannot be removed, Return an error before unregistration when cleanup fails. Retain the registration and deployment options for a retry. |
||
| } | ||
| $this->exAppService->unregisterExApp($appId); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -867,6 +867,10 @@ public function removeExAppsByDaemonConfigName(DaemonConfig $daemonConfig): void | |
| if ($dataDeleted) { | ||
| $this->exAppService->logExAppDataDeleted($exApp); | ||
| } | ||
| } elseif ($daemonConfig->getAcceptsDeployId() === $this->kubernetesActions->getAcceptsDeployId()) { | ||
| if ($this->kubernetesActions->removeExAppResources($daemonConfig, $exApp->getAppid(), true) === '') { | ||
| $this->exAppService->logExAppDataDeleted($exApp); | ||
| } | ||
|
Comment on lines
+871
to
+873
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep failed Kubernetes ExApps and their role list when cleanup fails. When Keeping the ExApp registered alone does not allow a retry, because the daemon config is also deleted. A safe fix needs these changes:
|
||
| } | ||
| $this->exAppService->unregisterExApp($exApp->getAppid()); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honor
removeContainerbefore deleting Kubernetes deployments.uninstallApp()documents$removeContaineras whether to remove the ExApp container. The Kubernetes branch removes the ExApp deployments without checking that flag. A caller that passesremoveContainer: falsestill loses the running workload.The non-harp Docker branch guards its container removal with
$removeContainer. Apply the same guard to the Kubernetes branch.Suggested fix