Skip to content

Commit 72d9a2d

Browse files
author
Joshua Reed
committed
Fixed, but not tested.
1 parent 4a1451f commit 72d9a2d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

controllers/utils/affinity_group.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
// GenerateIsolatedNetwork of the passed name that's owned by the ReconciliationSubject.
3232
func (r *ReconciliationRunner) GetOrCreateAffinityGroup(name string, affinityType string, ag *infrav1.CloudStackAffinityGroup) CloudStackReconcilerMethod {
3333
return func() (ctrl.Result, error) {
34+
3435
// Start by attempting a fetch.
3536
lowerName := strings.ToLower(name)
3637
namespace := r.ReconciliationSubject.GetNamespace()

controllers/utils/isolated_network.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package utils
1818

1919
import (
20+
"fmt"
2021
"strings"
2122

2223
infrav1 "github.com/aws/cluster-api-provider-cloudstack/api/v1beta1"
@@ -27,8 +28,9 @@ import (
2728
func (r *ReconciliationRunner) GenerateIsolatedNetwork(name string) CloudStackReconcilerMethod {
2829
return func() (ctrl.Result, error) {
2930
lowerName := strings.ToLower(name)
31+
metaName := fmt.Sprintf("%s-%s", r.CSCluster.Name, lowerName)
3032
csIsoNet := &infrav1.CloudStackIsolatedNetwork{}
31-
csIsoNet.ObjectMeta = r.NewChildObjectMeta(lowerName)
33+
csIsoNet.ObjectMeta = r.NewChildObjectMeta(metaName)
3234
csIsoNet.Spec.Name = lowerName
3335
csIsoNet.Spec.ControlPlaneEndpoint.Host = r.CSCluster.Spec.ControlPlaneEndpoint.Host
3436
csIsoNet.Spec.ControlPlaneEndpoint.Port = r.CSCluster.Spec.ControlPlaneEndpoint.Port

controllers/utils/zones.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package utils
1818

1919
import (
20+
"fmt"
2021
"strings"
2122

2223
infrav1 "github.com/aws/cluster-api-provider-cloudstack/api/v1beta1"
@@ -28,12 +29,18 @@ import (
2829
"sigs.k8s.io/controller-runtime/pkg/reconcile"
2930
)
3031

31-
// CreateZone generates a specified CloudStackZone CRD owned by the ReconcilationSubject.
32-
func (r *ReconciliationRunner) CreateZone(zoneSpec infrav1.Zone) error {
32+
// ZoneMetaName creates a meta name for a zone based on the cluster and zone information.
33+
func (r *ReconciliationRunner) ZoneMetaName(zoneSpec infrav1.Zone) string {
3334
metaName := zoneSpec.Name
3435
if metaName == "" {
3536
metaName = zoneSpec.ID
3637
}
38+
return fmt.Sprintf("%s-%s", r.CSCluster.Name, metaName)
39+
}
40+
41+
// CreateZone generates a specified CloudStackZone CRD owned by the ReconcilationSubject.
42+
func (r *ReconciliationRunner) CreateZone(zoneSpec infrav1.Zone) error {
43+
metaName := r.ZoneMetaName(zoneSpec)
3744
csZone := &infrav1.CloudStackZone{
3845
ObjectMeta: r.NewChildObjectMeta(metaName),
3946
Spec: infrav1.CloudStackZoneSpec(zoneSpec),

0 commit comments

Comments
 (0)