summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/internal/app/instance.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/internal/app/instance.go')
-rw-r--r--src/k8splugin/internal/app/instance.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/k8splugin/internal/app/instance.go b/src/k8splugin/internal/app/instance.go
index ad36aaa5..0f1f3d7e 100644
--- a/src/k8splugin/internal/app/instance.go
+++ b/src/k8splugin/internal/app/instance.go
@@ -717,6 +717,13 @@ func (v *InstanceClient) Delete(id string) error {
if err != nil {
return pkgerrors.Wrap(err, "Getting CloudRegion Information")
}
+
+ configClient := NewConfigClient()
+ configs, err := configClient.List(id)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Getting Configs Information")
+ }
+
inst.Status = "PRE-DELETE"
inst.HookProgress = ""
err = db.DBconn.Update(v.storeName, key, v.tagInst, inst)
@@ -743,6 +750,18 @@ func (v *InstanceClient) Delete(id string) error {
if err != nil {
log.Printf("Update Instance DB Entry for release %s has error.", inst.ReleaseName)
}
+
+ if len(configs) > 0 {
+ log.Printf("Deleting config resources first")
+ for _, config := range configs {
+ log.Printf("Deleting Config %s Resources", config.ConfigName)
+ _, err = configClient.Delete(id, config.ConfigName)
+ if err != nil {
+ return pkgerrors.Wrap(err, "Deleting Config Resources")
+ }
+ }
+ }
+
err = k8sClient.deleteResources(inst.Resources, inst.Namespace)
if err != nil {
return pkgerrors.Wrap(err, "Deleting Instance Resources")