Skip to content

[BUG] [transfer-pvc] getRouteHostName truncation can cause Route collisions #287

Description

@RanWurmbrand

getRouteHostName truncation can cause Route collisions

What version of crane are you running, and what are your clusters+platform

Latest main branch. Issue exists in cmd/transfer-pvc/transfer-pvc.go line 735.

What did you expect to happen?

Each PVC should get a unique Route hostname, even when PVC names are long.

What actually happened?

getRouteHostName() truncates long name-namespace prefixes to 62 chars using routeNamePrefix[:62]. Two PVCs with names that share the same first 62 characters will get the same hostname, causing a Route conflict.

Note: getValidatedResourceName() on line 485 already solves this problem using MD5 hashing: fmt.Sprintf("crane-%x", md5.Sum([]byte(name))). The same approach could be applied here.

Please include any relevant logs or errors

N/A — discovered via code review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions