Skip to content

Commit 347d21b

Browse files
committed
Fix naming of isolated network if the network name contains an underscore
1 parent 53105d4 commit 347d21b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

controllers/utils/isolated_network.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ import (
2525
)
2626

2727
func (r *ReconciliationRunner) IsoNetMetaName(name string) string {
28-
return fmt.Sprintf("%s-%s", r.CSCluster.Name, strings.ToLower(name))
28+
return strings.ReplaceAll(fmt.Sprintf("%s-%s", r.CSCluster.Name, strings.ToLower(name)), "_", "-")
2929
}
3030

3131
// GenerateIsolatedNetwork of the passed name that's owned by the ReconciliationSubject.
3232
func (r *ReconciliationRunner) GenerateIsolatedNetwork(name string, fdNameFunc func() string) CloudStackReconcilerMethod {
3333
return func() (ctrl.Result, error) {
3434
lowerName := strings.ToLower(name)
35-
metaName := fmt.Sprintf("%s-%s", r.CSCluster.Name, lowerName)
35+
metaName := r.IsoNetMetaName(lowerName)
3636
csIsoNet := &infrav1.CloudStackIsolatedNetwork{}
3737
csIsoNet.ObjectMeta = r.NewChildObjectMeta(metaName)
3838
csIsoNet.Spec.Name = lowerName

0 commit comments

Comments
 (0)