-
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-469, delete all users from deleted cluster #481
issue-469, delete all users from deleted cluster #481
Conversation
2b057d8
to
2ec620f
Compare
2ec620f
to
7c3c9eb
Compare
f614e6b
to
6729b4f
Compare
58cb36a
to
8861645
Compare
err = r.detachUserFromDeletedCluster(ctx, clusterID, user, l) | ||
if err != nil { | ||
l.Error(err, "Cannot delete Redis user resource", | ||
"secret name", secret.Name, | ||
"secret namespace", secret.Namespace) | ||
r.EventRecorder.Eventf(user, models.Warning, models.PatchFailed, | ||
"Resource deleting is failed. Reason: %v", err) |
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.
- it's not a patch operation
- typos in the logs. deleting -> detach
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.
Fixed
return err | ||
} | ||
|
||
patch = user.NewPatch() |
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.
I don't think we need to reinitialize a patch
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.
Fixed
for _, ref := range redis.Spec.UserRefs { | ||
err = r.detachUserResource(ctx, logger, redis, ref) | ||
if err != nil { | ||
logger.Error(err, "Cannot delete Redis user cluster", |
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.
delete -> detach
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.
Fixed
8861645
to
3dd3402
Compare
"secret name", secret.Name, | ||
"secret namespace", secret.Namespace) | ||
r.EventRecorder.Eventf(user, models.Warning, models.UpdatedEvent, | ||
"Cannot assign Cassandra user to a k8s secret. Reason: %v", err) | ||
"Cannot assign Redis user to a k8s secret. Reason: %v", err) |
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.
Cannot assign k8s secret to a Redis user
maybe?
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.
Yes, you are right, thank you!
Fixed
@@ -174,9 +174,9 @@ func (r *RedisUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( | |||
userID := fmt.Sprintf(instaclustr.RedisUserIDFmt, clusterID, user.Namespace) | |||
err = r.API.DeleteRedisUser(userID) | |||
if err != nil { | |||
l.Error(err, "Cannot delete Redis user", "user", user.Name) | |||
l.Error(err, "Cannot delete Redis user on Instaclustr", "user", user.Name) |
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.
What does Cannot delete Redis user on Instaclustr
mean? We delete users from a cluster, isn't it?
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.
Yes, fixed
return err | ||
} | ||
|
||
controllerutil.RemoveFinalizer(user, user.DeletionUserFinalizer(clusterID, user.Namespace)) |
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.
DeletionUserFinalizer
-> DeletionFinalizer
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.
It's a separate method for user, DeletionFinalizer used for secrets
for _, ref := range redis.Spec.UserRefs { | ||
err = r.detachUserResource(ctx, logger, redis, ref) | ||
if err != nil { | ||
logger.Error(err, "Cannot detach Redis user cluster", |
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.
Cannot detach Redis user cluster
-> Cannot detach Redis user
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.
fixed
3dd3402
to
9430e84
Compare
@@ -174,9 +174,9 @@ func (r *RedisUserReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( | |||
userID := fmt.Sprintf(instaclustr.RedisUserIDFmt, clusterID, user.Namespace) | |||
err = r.API.DeleteRedisUser(userID) | |||
if err != nil { | |||
l.Error(err, "Cannot delete Redis user", "user", user.Name) | |||
l.Error(err, "Cannot delete Redis user on cluster. Cluster ID: %s.", "user", clusterID, user.Name) |
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.
Cannot delete Redis user on cluster -> Cannot delete Redis user from the cluster
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.
Fixed
|
||
l.Error(err, "Cannot get Redis user", "user", u.Spec) | ||
r.EventRecorder.Eventf(redis, models.Warning, models.DeletionFailed, | ||
"Cannot get Redis user. user reference: %v", uRef) |
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.
Cannot get Redis user. user reference -> Cannot get Redis user. User reference
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.
Fixed
9430e84
to
53cbdd7
Compare
No description provided.