@@ -140,7 +140,6 @@ func (r *S3UserReconciler) handleS3ExistingUser(ctx context.Context, userResourc
140140 } else if err .Error () == "S3UserSecretNameMismatch" {
141141 logger .Info ("A secret with owner reference to the user was found, but its name doesn't match the spec. This is probably due to the S3User's spec changing (specifically spec.secretName being added, changed or removed). The \" old\" secret will be deleted." )
142142 r .deleteSecret (ctx , & userOwnedSecret )
143- // return r.handleS3ExistingUser(ctx, userResource)
144143 }
145144 }
146145
@@ -176,7 +175,6 @@ func (r *S3UserReconciler) handleS3ExistingUser(ctx context.Context, userResourc
176175 }
177176
178177 return r .handleS3NewUser (ctx , userResource )
179- //return ctrl.Result{Requeue: true}, nil
180178
181179 }
182180
@@ -251,10 +249,6 @@ func (r *S3UserReconciler) handleS3NewUser(ctx context.Context, userResource *s3
251249 fmt .Sprintf ("An error occurred when attempting to generate password for user %s" , userResource .Name ), err )
252250 }
253251
254- // TODO : catch a mismatch between the access key in secret and access key in s3user spec. If mismatch,
255- // then act according to whether it was the S3User or the Secret that changed (if said action is different in
256- // each case)
257-
258252 // Create a new K8S Secret to hold the user's accessKey and secretKey
259253 secret , err := r .newSecretForCR (ctx , userResource , map [string ][]byte {"accessKey" : []byte (userResource .Spec .AccessKey ), "secretKey" : []byte (secretKey )})
260254 if err != nil {
@@ -415,7 +409,6 @@ func (r *S3UserReconciler) getUserSecret(ctx context.Context, userResource *s3v1
415409 // TODO : check if the errors.IsNotFound makes sense for r.List
416410 // if err != nil && (errors.IsNotFound(err) || len(secretsList.Items) == 0) {
417411 if err != nil {
418- // return userSecret, utilerrors.NewAggregate([]error{fmt.Errorf("An error occurred when listing the secrets in user's namespace"), err})
419412 logger .Error (err , "An error occurred while listing the secrets in user's namespace" )
420413 return userSecret , fmt .Errorf ("SecretListingFailed" )
421414 }
@@ -430,6 +423,7 @@ func (r *S3UserReconciler) getUserSecret(ctx context.Context, userResource *s3v1
430423 // In case of mismatch, that secret is deleted (and will be recreated) ; if there is a match,
431424 // it will be used for state comparison.
432425 uid := userResource .GetUID ()
426+
433427 // cmp.Or takes the first non "zero" value, see https://pkg.go.dev/cmp#Or
434428 effectiveS3UserSecretName := cmp .Or (userResource .Spec .SecretName , userResource .Name )
435429 for _ , secret := range secretsList .Items {
@@ -465,8 +459,7 @@ func (r *S3UserReconciler) SetupWithManager(mgr ctrl.Manager) error {
465459 // by a S3User is created/updated/deleted. In other words, even when creating a single S3User,
466460 // there is going to be several iterations.
467461 Owns (& corev1.Secret {}).
468- // TODO : implement a real strategy for event filtering ; for now just using the example from OpSDK doc
469- // (https://sdk.operatorframework.io/docs/building-operators/golang/references/event-filtering/)
462+ // See : https://sdk.operatorframework.io/docs/building-operators/golang/references/event-filtering/
470463 WithEventFilter (predicate.Funcs {
471464
472465 // Ignore updates to CR status in which case metadata.Generation does not change,
0 commit comments