Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit c06ed1c

Browse files
committed
fix(review/1): format message
Signed-off-by: Mateusz Urbanek <[email protected]>
1 parent 8a30877 commit c06ed1c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: pkg/bucketclaim/bucketclaim.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package bucketclaim
22

33
import (
44
"context"
5+
"fmt"
56

67
v1 "k8s.io/api/core/v1"
78
kubeerrors "k8s.io/apimachinery/pkg/api/errors"
@@ -125,7 +126,7 @@ func (b *BucketClaimListener) provisionBucketClaimOperation(ctx context.Context,
125126
bucketName = bucketClaim.Spec.ExistingBucketName
126127
bucket, err := b.buckets().Get(ctx, bucketName, metav1.GetOptions{})
127128
if kubeerrors.IsNotFound(err) {
128-
b.recordEvent(inputBucketClaim, v1.EventTypeWarning, events.ProvisioningFailed, "Bucket provided in the BucketClaim does not exist")
129+
b.recordEvent(inputBucketClaim, v1.EventTypeWarning, events.FailedCreateBucket, "Bucket %q provided in the BucketClaim does not exist.", bucketName)
129130
return err
130131
} else if err != nil {
131132
klog.V(3).ErrorS(err, "Get Bucket with ExistingBucketName error", "name", bucketClaim.Spec.ExistingBucketName)
@@ -160,7 +161,7 @@ func (b *BucketClaimListener) provisionBucketClaimOperation(ctx context.Context,
160161

161162
bucketClass, err := b.bucketClasses().Get(ctx, bucketClassName, metav1.GetOptions{})
162163
if kubeerrors.IsNotFound(err) {
163-
b.recordEvent(inputBucketClaim, v1.EventTypeWarning, events.ProvisioningFailed, "BucketClass provided in the BucketClaim does not exist")
164+
b.recordEvent(inputBucketClaim, v1.EventTypeWarning, events.FailedCreateBucket, "BucketClass %q provided in the BucketClaim does not exist.", bucketClassName)
164165
return util.ErrInvalidBucketClass
165166
} else if err != nil {
166167
klog.V(3).ErrorS(err, "Get Bucketclass Error", "name", bucketClassName)
@@ -258,9 +259,9 @@ func (b *BucketClaimListener) bucketClaims(namespace string) objectstoragev1alph
258259
}
259260

260261
// recordEvent during the processing of the objects
261-
func (b *BucketClaimListener) recordEvent(subject runtime.Object, eventtype, reason, message string) {
262+
func (b *BucketClaimListener) recordEvent(subject runtime.Object, eventtype, reason, message string, args ...any) {
262263
if b.eventRecorder == nil {
263264
return
264265
}
265-
b.eventRecorder.Event(subject, eventtype, reason, message)
266+
b.eventRecorder.Event(subject, eventtype, reason, fmt.Sprintf(message, args...))
266267
}

0 commit comments

Comments
 (0)