fix(helm): helm app deletion fix EE-1581 (#5582)
* updated helm lib to show correct error on uninstall failure * passing down helm app namespace on deletion
This commit is contained in:
@@ -38,7 +38,7 @@ require (
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/portainer/docker-compose-wrapper v0.0.0-20210906052132-ef24824f7548
|
||||
github.com/portainer/libcrypto v0.0.0-20210422035235-c652195c5c3a
|
||||
github.com/portainer/libhelm v0.0.0-20210903050903-43c3353fd37c
|
||||
github.com/portainer/libhelm v0.0.0-20210906035629-b5635edd5d97
|
||||
github.com/portainer/libhttp v0.0.0-20190806161843-ba068f58be33
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
|
||||
@@ -210,8 +210,8 @@ github.com/portainer/docker-compose-wrapper v0.0.0-20210906052132-ef24824f7548 h
|
||||
github.com/portainer/docker-compose-wrapper v0.0.0-20210906052132-ef24824f7548/go.mod h1:WxDlJWZxCnicdLCPnLNEv7/gRhjeIVuCGmsv+iOPH3c=
|
||||
github.com/portainer/libcrypto v0.0.0-20210422035235-c652195c5c3a h1:qY8TbocN75n5PDl16o0uVr5MevtM5IhdwSelXEd4nFM=
|
||||
github.com/portainer/libcrypto v0.0.0-20210422035235-c652195c5c3a/go.mod h1:n54EEIq+MM0NNtqLeCby8ljL+l275VpolXO0ibHegLE=
|
||||
github.com/portainer/libhelm v0.0.0-20210903050903-43c3353fd37c h1:KALKyW7pC75SBMpLgB0zL129OwHxYwYxVc6x0HjPFD0=
|
||||
github.com/portainer/libhelm v0.0.0-20210903050903-43c3353fd37c/go.mod h1:YvYAk7krKTzB+rFwDr0jQ3sQu2BtiXK1AR0sZH7nhJA=
|
||||
github.com/portainer/libhelm v0.0.0-20210906035629-b5635edd5d97 h1:ZcRVgWHTac8V7WU9TUBr73H3e5ajVFYTPjPl9TWULDA=
|
||||
github.com/portainer/libhelm v0.0.0-20210906035629-b5635edd5d97/go.mod h1:YvYAk7krKTzB+rFwDr0jQ3sQu2BtiXK1AR0sZH7nhJA=
|
||||
github.com/portainer/libhttp v0.0.0-20190806161843-ba068f58be33 h1:H8HR2dHdBf8HANSkUyVw4o8+4tegGcd+zyKZ3e599II=
|
||||
github.com/portainer/libhttp v0.0.0-20190806161843-ba068f58be33/go.mod h1:Y2TfgviWI4rT2qaOTHr+hq6MdKIE5YjgQAu7qwptTV0=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
|
||||
@@ -42,6 +42,7 @@ function HelmFactory($resource, API_ENDPOINT_ENDPOINTS) {
|
||||
uninstall: {
|
||||
url: `${helmUrl}/:release`,
|
||||
method: 'DELETE',
|
||||
params: { namespace: '@namespace' },
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -77,9 +77,9 @@ export function HelmService(HelmFactory) {
|
||||
* @param {Object} options - Options object, release `Name` is the only required option
|
||||
* @throws {PortainerError} - Rejects with error if helm show fails
|
||||
*/
|
||||
async function uninstall(endpointId, { Name }) {
|
||||
async function uninstall(endpointId, { Name, ResourcePool }) {
|
||||
try {
|
||||
await HelmFactory.uninstall({ endpointId, release: Name }).$promise;
|
||||
await HelmFactory.uninstall({ endpointId, release: Name, namespace: ResourcePool }).$promise;
|
||||
} catch (err) {
|
||||
throw new PortainerError('Unable to delete release', err);
|
||||
}
|
||||
|
||||
@@ -477,6 +477,9 @@ class KubernetesApplicationHelper {
|
||||
// use earliest date
|
||||
helmApp.CreationDate = applications.map((app) => app.CreationDate).sort((a, b) => new Date(a) - new Date(b))[0];
|
||||
|
||||
// use first app namespace as helm app namespace
|
||||
helmApp.ResourcePool = applications[0].ResourcePool;
|
||||
|
||||
return helmApp;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user