Skip to content

Commit

Permalink
Fix kafka E2E test uninstall function (#1025)
Browse files Browse the repository at this point in the history
* Delete annotated object of kafka in uninstall function

* Use client-go to delete configmap

* Use client-go to delete configmap

* Typo fix

* Code refactor

* Fix format error
  • Loading branch information
akankshakumari393 committed Jun 14, 2021
1 parent 2de353a commit 801d104
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/app/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"time"

"github.com/pkg/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/portforward"
Expand Down Expand Up @@ -184,6 +185,11 @@ func (kc *KafkaCluster) Uninstall(ctx context.Context) error {
return errors.Wrap(err, "failed to create helm client")
}

err = kc.cli.CoreV1().ConfigMaps(kc.namespace).Delete(ctx, configMapName, metav1.DeleteOptions{})
if err != nil && !apierrors.IsNotFound(err) {
return errors.Wrapf(err, "Error deleting ConfigMap %s", configMapName)
}

err = cli.Uninstall(ctx, kc.chart.Release, kc.namespace)
if err != nil {
log.WithError(err).Print("Failed to uninstall app, you will have to uninstall it manually.", field.M{"app": kc.name})
Expand Down

0 comments on commit 801d104

Please sign in to comment.