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

Issue-599, Handle of deleting default secret for KafkaConnect and Zookeeper resources #603

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

worryg0d
Copy link
Collaborator

@worryg0d worryg0d commented Oct 23, 2023

In our previous implementation when Zookeeper or KafkaConnect resource is deleted it keeps secret with its default user credentials in k8s. It causes problems when we create KafkaConnect cluster, delete it, and create it again.
Now controllers delete the secrets of the resources during deletion operation.

ref #599

@worryg0d worryg0d added bug Something isn't working enhancement New feature or request labels Oct 23, 2023
@worryg0d worryg0d self-assigned this Oct 23, 2023
Comment on lines 231 to 247
func (r *ZookeeperReconciler) deleteDefaultSecret(ctx context.Context, zk *v1beta1.Zookeeper) error {
secret := &v1.Secret{}
err := r.Get(ctx, types.NamespacedName{
Name: fmt.Sprintf(models.DefaultUserSecretNameTemplate, models.DefaultUserSecretPrefix, zk.Name),
Namespace: zk.Namespace,
}, secret)

if err != nil {
if k8serrors.IsNotFound(err) {
return nil
}

return err
}

return r.Delete(ctx, secret)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we implement this method as a function in helpers?

Copy link
Collaborator Author

@worryg0d worryg0d Oct 26, 2023

Choose a reason for hiding this comment

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

Maybe it makes sense because there are two the same methods but for different resources. I'll look for a solution

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Created deleteDefaultUserSecret function in helpers

@testisnullus testisnullus merged commit efeef06 into main Oct 26, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants