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

DFBUGS-961: [release-4.18] Fix the length of generated OBC bucket name #252

Merged
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 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
Loading