Skip to content

Commit

Permalink
Fix naming of isolated network if the network name contains an unders…
Browse files Browse the repository at this point in the history
…core
  • Loading branch information
vishesh92 committed May 31, 2024
1 parent 53105d4 commit 347d21b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/utils/isolated_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ import (
)

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

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

0 comments on commit 347d21b

Please sign in to comment.