-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
17 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ const bucketFinalizer = "s3.onyxia.sh/finalizer" | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *BucketReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("bcktCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// Checking for bucket resource existence | ||
bucketResource := &s3v1alpha1.Bucket{} | ||
|
@@ -244,7 +244,7 @@ func (r *BucketReconciler) finalizeBucket(bucketResource *s3v1alpha1.Bucket) err | |
} | ||
|
||
func (r *BucketReconciler) SetBucketStatusConditionAndUpdate(ctx context.Context, bucketResource *s3v1alpha1.Bucket, conditionType string, status metav1.ConditionStatus, reason string, message string, srcError error) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("bcktCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// We moved away from meta.SetStatusCondition, as the implementation did not allow for updating | ||
// lastTransitionTime if a Condition (as identified by Reason instead of Type) was previously | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ const pathFinalizer = "s3.onyxia.sh/finalizer" | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *PathReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("pathCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// Checking for path resource existence | ||
pathResource := &s3v1alpha1.Path{} | ||
|
@@ -184,7 +184,7 @@ func (r *PathReconciler) SetupWithManager(mgr ctrl.Manager) error { | |
} | ||
|
||
func (r *PathReconciler) finalizePath(pathResource *s3v1alpha1.Path) error { | ||
logger := log.Log.WithName("finalize") | ||
logger := log.Log.WithValues("controller", "path") | ||
if r.PathDeletion { | ||
var failedPaths []string = make([]string, 0) | ||
for _, path := range pathResource.Spec.Paths { | ||
|
@@ -210,7 +210,7 @@ func (r *PathReconciler) finalizePath(pathResource *s3v1alpha1.Path) error { | |
} | ||
|
||
func (r *PathReconciler) SetPathStatusConditionAndUpdate(ctx context.Context, pathResource *s3v1alpha1.Path, conditionType string, status metav1.ConditionStatus, reason string, message string, srcError error) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("pathCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// We moved away from meta.SetStatusCondition, as the implementation did not allow for updating | ||
// lastTransitionTime if a Condition (as identified by Reason instead of Type) was previously | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ const policyFinalizer = "s3.onyxia.sh/finalizer" | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *PolicyReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("plcyCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// Checking for policy resource existence | ||
policyResource := &s3v1alpha1.Policy{} | ||
|
@@ -218,7 +218,7 @@ func (r *PolicyReconciler) finalizePolicy(policyResource *s3v1alpha1.Policy) err | |
} | ||
|
||
func (r *PolicyReconciler) SetPolicyStatusConditionAndUpdate(ctx context.Context, policyResource *s3v1alpha1.Policy, conditionType string, status metav1.ConditionStatus, reason string, message string, srcError error) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("plcyCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// We moved away from meta.SetStatusCondition, as the implementation did not allow for updating | ||
// lastTransitionTime if a Condition (as identified by Reason instead of Type) was previously | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ const ( | |
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
func (r *S3UserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// Checking for userResource existence | ||
userResource := &s3v1alpha1.S3User{} | ||
|
@@ -120,7 +120,7 @@ func (r *S3UserReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr | |
} | ||
|
||
func (r *S3UserReconciler) handleS3ExistingUser(ctx context.Context, userResource *s3v1alpha1.S3User) (reconcile.Result, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// --- Begin Secret management section | ||
|
||
|
@@ -239,7 +239,7 @@ func (r *S3UserReconciler) handleS3ExistingUser(ctx context.Context, userResourc | |
} | ||
|
||
func (r *S3UserReconciler) handleS3NewUser(ctx context.Context, userResource *s3v1alpha1.S3User) (reconcile.Result, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// Generating a random secret key | ||
secretKey, err := password.Generate(20, true, false, true) | ||
|
@@ -357,7 +357,7 @@ func (r *S3UserReconciler) handleS3NewUser(ctx context.Context, userResource *s3 | |
} | ||
|
||
func (r *S3UserReconciler) addPoliciesToUser(ctx context.Context, userResource *s3v1alpha1.S3User) error { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
policies := userResource.Spec.Policies | ||
if policies != nil { | ||
err := r.S3Client.AddPoliciesToUser(userResource.Spec.AccessKey, policies) | ||
|
@@ -370,7 +370,7 @@ func (r *S3UserReconciler) addPoliciesToUser(ctx context.Context, userResource * | |
} | ||
|
||
func (r *S3UserReconciler) handleS3UserDeletion(ctx context.Context, userResource *s3v1alpha1.S3User) (reconcile.Result, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
if controllerutil.ContainsFinalizer(userResource, userFinalizer) { | ||
// Run finalization logic for S3UserFinalizer. If the finalization logic fails, don't remove the finalizer so that we can retry during the next reconciliation. | ||
|
@@ -397,7 +397,7 @@ func (r *S3UserReconciler) handleS3UserDeletion(ctx context.Context, userResourc | |
} | ||
|
||
func (r *S3UserReconciler) getUserSecret(ctx context.Context, userResource *s3v1alpha1.S3User) (corev1.Secret, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// Listing every secrets in the S3User's namespace, as a first step | ||
// to get the actual secret matching the S3User proper. | ||
|
@@ -443,7 +443,7 @@ func (r *S3UserReconciler) getUserSecret(ctx context.Context, userResource *s3v1 | |
} | ||
|
||
func (r *S3UserReconciler) deleteSecret(ctx context.Context, secret *corev1.Secret) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
err := r.Delete(ctx, secret) | ||
if err != nil { | ||
logger.Error(err, "an error occurred while deleting a secret") | ||
|
@@ -492,7 +492,7 @@ func (r *S3UserReconciler) SetupWithManager(mgr ctrl.Manager) error { | |
} | ||
|
||
func (r *S3UserReconciler) setS3UserStatusConditionAndUpdate(ctx context.Context, userResource *s3v1alpha1.S3User, conditionType string, status metav1.ConditionStatus, reason string, message string, srcError error) (ctrl.Result, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
// We moved away from meta.SetStatusCondition, as the implementation did not allow for updating | ||
// lastTransitionTime if a Condition (as identified by Reason instead of Type) was previously | ||
|
@@ -524,7 +524,7 @@ func (r *S3UserReconciler) finalizeS3User(userResource *s3v1alpha1.S3User) error | |
// newSecretForCR returns a secret with the same name/namespace as the CR. | ||
// The secret will include all labels and annotations from the CR. | ||
func (r *S3UserReconciler) newSecretForCR(ctx context.Context, userResource *s3v1alpha1.S3User, data map[string][]byte) (*corev1.Secret, error) { | ||
logger := log.FromContext(ctx).WithName("userCtrl") | ||
logger := log.FromContext(ctx) | ||
|
||
labels := map[string]string{} | ||
for k, v := range userResource.ObjectMeta.Labels { | ||
|