Skip to content

Commit 5cd3688

Browse files
committed
mapNodeToServerID: strip any provider prefix #32962
previously we only stripped the brightbox:// prefix but would then go on to try use any other providerIDs with the api. So instead, strip all provider prefixes and trust the Brightbox API to be the authority on what is a brightbox server and what is not. This fixes using the provider with k3s, which uses a k3s:// provider prefix, but should also work for future prefixes.
1 parent 4151eaa commit 5cd3688

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

brightbox/util.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ func mapNodeToServerID(node *v1.Node) string {
8787
if node.Spec.ProviderID == "" {
8888
return node.Name
8989
}
90-
return k8ssdk.MapProviderIDToServerID(node.Spec.ProviderID)
90+
91+
parts := strings.SplitN(node.Spec.ProviderID, "://", 2)
92+
93+
if len(parts) == 2 {
94+
// some providers have 3 forward slashes so handle that
95+
return strings.TrimPrefix(parts[1], "/")
96+
}
97+
98+
return parts[0]
9199
}
92100

93101
func mapServerIDToNode(name string) *v1.Node {

0 commit comments

Comments
 (0)