Skip to content

Commit 8c58ba8

Browse files
aleolifra98
authored andcommitted
fix remote cm name
1 parent 25134cd commit 8c58ba8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/virtualKubelet/forge/configmaps.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ func LocalConfigMapName(remote string) string {
4949
// RemoteConfigMapName forges the name for the reflected configmap, remapping the one of the root CA to prevent collisions.
5050
func RemoteConfigMapName(local string) string {
5151
if local == RootCAConfigMapName {
52-
name := RootCAConfigMapName + "." + string(LocalCluster)[0:5]
52+
var suffix string
53+
if len(LocalCluster) > 5 {
54+
suffix = string(LocalCluster)[0:5]
55+
} else {
56+
suffix = string(LocalCluster)
57+
}
58+
name := RootCAConfigMapName + "." + suffix
5359
// if the last character is not alphanumeric, we add a random alphanumeric character to avoid issues with k8s
5460
if !isAlphanumeric(name[len(name)-1]) {
5561
name += "a"

0 commit comments

Comments
 (0)