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

Patch the deleteUSers3 #46

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/crd/bases/s3.onyxia.sh_s3users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ spec:
served: true
storage: true
subresources:
status: {}
status: {}
6 changes: 3 additions & 3 deletions controllers/user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func handleReconcileS3User(ctx context.Context, err error, r *S3UserReconciler,
err = r.Get(ctx, types.NamespacedName{Name: userResource.Name, Namespace: userResource.Namespace}, secret)
if err != nil && errors.IsNotFound(err) {
logger.Info("Secret associated to user not found, user will be deleted and recreated", "user", userResource.Name)
err = r.S3Client.DeleteUser(userResource.Name)
err = r.S3Client.DeleteUser(userResource.Spec.AccessKey)
if err != nil {
logger.Error(err, "Could not delete user on S3 server", "user", userResource.Name)
return r.setS3UserStatusConditionAndUpdate(ctx, userResource, "OperatorFailed", metav1.ConditionFalse, "S3UserDeletionFailed",
Expand All @@ -144,7 +144,7 @@ func handleReconcileS3User(ctx context.Context, err error, r *S3UserReconciler,

if !secretKeyValid {
logger.Info("Secret for user is invalid")
err = r.S3Client.DeleteUser(userResource.Name)
err = r.S3Client.DeleteUser(userResource.Spec.AccessKey)
if err != nil {
logger.Error(err, "Could not delete user on S3 server", "user", userResource.Name)
return r.setS3UserStatusConditionAndUpdate(ctx, userResource, "OperatorFailed", metav1.ConditionFalse, "S3UserDeletionFailed",
Expand Down Expand Up @@ -176,7 +176,7 @@ func handleReconcileS3User(ctx context.Context, err error, r *S3UserReconciler,
if len(policyToDelete) > 0 {
r.S3Client.RemovePoliciesFromUser(userResource.Spec.AccessKey, policyToDelete)
}

if len(policyToAdd) > 0 {
r.S3Client.AddPoliciesToUser(userResource.Spec.AccessKey, policyToAdd)
}
Expand Down