Skip to content

Commit

Permalink
Merge pull request #251 from vbnrh/DFBUGS-961
Browse files Browse the repository at this point in the history
Fix the length of generated OBC bucket name
  • Loading branch information
openshift-merge-bot[bot] authored Dec 19, 2024
2 parents 1f8102f + bd41376 commit 1d5f92b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion controllers/utils/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func GenerateUniqueIdForMirrorPeer(mirrorPeer multiclusterv1alpha1.MirrorPeer, h
checksum = sha1.Sum([]byte(peerAccumulator))
}
// truncate to bucketGenerateName + "-" + first 12 (out of 20) byte representations of sha1 checksum
return hex.EncodeToString(checksum[:])[0 : len(BucketGenerateName)+1+12]
return hex.EncodeToString(checksum[:])
}

func GetKey(clusterName, clientName string) string {
Expand Down
2 changes: 1 addition & 1 deletion controllers/utils/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func GetEnv(key, defaultValue string) string {
func GenerateBucketName(mirrorPeer multiclusterv1alpha1.MirrorPeer, hasStorageClientRef bool) string {
mirrorPeerId := GenerateUniqueIdForMirrorPeer(mirrorPeer, hasStorageClientRef)
bucketGenerateName := BucketGenerateName
return fmt.Sprintf("%s-%s", bucketGenerateName, mirrorPeerId)
return fmt.Sprintf("%s-%s", bucketGenerateName, mirrorPeerId)[0 : len(BucketGenerateName)+1+12]
}

func CreateOrUpdateObjectBucketClaim(ctx context.Context, c client.Client, bucketName, bucketNamespace string, annotations map[string]string) (controllerutil.OperationResult, error) {
Expand Down

0 comments on commit 1d5f92b

Please sign in to comment.