diff --git a/controllers/utils/hash.go b/controllers/utils/hash.go index 98dd0693..faf488dc 100644 --- a/controllers/utils/hash.go +++ b/controllers/utils/hash.go @@ -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 { diff --git a/controllers/utils/s3.go b/controllers/utils/s3.go index b1e1e062..fbcd7f3c 100644 --- a/controllers/utils/s3.go +++ b/controllers/utils/s3.go @@ -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) {