@@ -19,11 +19,13 @@ package thin
1919import (
2020 "context"
2121 "fmt"
22+
2223 "github.com/fluid-cloudnative/fluid/pkg/common"
2324 "github.com/fluid-cloudnative/fluid/pkg/utils"
2425 "github.com/fluid-cloudnative/fluid/pkg/utils/dataset/lifecycle"
2526 "github.com/fluid-cloudnative/fluid/pkg/utils/helm"
2627 "github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient"
28+
2729 corev1 "k8s.io/api/core/v1"
2830 apierrors "k8s.io/apimachinery/pkg/api/errors"
2931 "k8s.io/apimachinery/pkg/labels"
@@ -221,14 +223,21 @@ func (t *ThinEngine) cleanAll() (err error) {
221223
222224 var (
223225 valueConfigmapName = t .getHelmValuesConfigMapName ()
224- configmapName = t .name + "-config"
226+ thinConfigmapName = t .name + "-config"
225227 namespace = t .namespace
226228 )
227229
228- cms := []string {valueConfigmapName , configmapName }
230+ cmNames := []string {valueConfigmapName , thinConfigmapName }
229231
230- for _ , cm := range cms {
231- err = kubeclient .DeleteConfigMap (t .Client , cm , namespace )
232+ for _ , cmName := range cmNames {
233+ _ , err = kubeclient .GetConfigmapByName (t .Client , cmName , namespace )
234+ if err != nil {
235+ if apierrors .IsNotFound (err ) {
236+ return nil
237+ }
238+ return err
239+ }
240+ err = kubeclient .DeleteConfigMap (t .Client , cmName , namespace )
232241 if err != nil {
233242 return
234243 }
0 commit comments