Skip to content

Commit a7f5637

Browse files
committed
feat: handle region in certficate ID (#49)
Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
1 parent b4e2970 commit a7f5637

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scaleway/loadbalancers.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,17 @@ func getCertificateIDs(service *v1.Service, port int32) ([]string, error) {
14891489
ids = append(ids, strings.Split(split[1], ",")...)
14901490
}
14911491
}
1492+
// normalize the ids (ie strip the region prefix if any)
1493+
for i := range ids {
1494+
if strings.Contains(ids[i], "/") {
1495+
splitID := strings.Split(ids[i], "/")
1496+
if len(splitID) != 2 {
1497+
klog.Errorf("unable to get certificate ID from %s", ids[i])
1498+
return nil, fmt.Errorf("unable to get certificate ID from %s", ids[i])
1499+
}
1500+
ids[i] = splitID[1]
1501+
}
1502+
}
14921503

14931504
return ids, nil
14941505
}

0 commit comments

Comments
 (0)