-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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) | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
…ect resources was implemented
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