Skip to content
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

Fix kafka E2E test uninstall function #1025

Merged
merged 7 commits into from
Jun 14, 2021
Merged

Conversation

akankshakumari393
Copy link
Contributor

@akankshakumari393 akankshakumari393 commented Jun 14, 2021

Change Overview

Add functionality to delete an annotated object {i.e Configmap } of Kafka application in uninstall function.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • #XXX

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

./build/integration-test.sh Kafka
Test log: https://gist.github.com/A-kanksh-a/c635b96f90dc67a479c8ce2d0026a6c7

pkg/app/kafka.go Outdated
Comment on lines 187 to 188
deleteConfig := []string{"delete", "-n", kc.namespace, "configmap", configMapName}
out, err := helm.RunCmdWithTimeout(ctx, "kubectl", deleteConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use client-go methods instead of calling binary?

pkg/app/kafka.go Outdated
@@ -184,6 +184,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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err != nil {
if err != nil && !apierrors.IsNotFound(err) {

Please add an exception for IsNotFound https://pkg.go.dev/k8s.io/apimachinery/pkg/api/errors#IsNotFound

@mergify mergify bot merged commit 801d104 into master Jun 14, 2021
@mergify mergify bot deleted the kafka-delete-configmap branch June 14, 2021 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants