From 7bc164495ca72fefbb4ccce4abfa41bacc61c3e4 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 21 Aug 2023 11:52:56 +0200 Subject: [PATCH] Make ClusterClass generated object names consistent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- cmd/clusterctl/client/cluster/topology_test.go | 10 +++++----- internal/controllers/topology/cluster/util.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/clusterctl/client/cluster/topology_test.go b/cmd/clusterctl/client/cluster/topology_test.go index 6b5b5f6a4a24..ac8a88903cab 100644 --- a/cmd/clusterctl/client/cluster/topology_test.go +++ b/cmd/clusterctl/client/cluster/topology_test.go @@ -96,9 +96,9 @@ func Test_topologyClient_Plan(t *testing.T) { {kind: "DockerCluster", namespace: "default", namePrefix: "my-cluster-"}, {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-md-0-"}, {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-md-1-"}, - {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-control-plane-"}, - {kind: "KubeadmConfigTemplate", namespace: "default", namePrefix: "my-cluster-md-0-bootstrap-"}, - {kind: "KubeadmConfigTemplate", namespace: "default", namePrefix: "my-cluster-md-1-bootstrap-"}, + {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-"}, + {kind: "KubeadmConfigTemplate", namespace: "default", namePrefix: "my-cluster-md-0-"}, + {kind: "KubeadmConfigTemplate", namespace: "default", namePrefix: "my-cluster-md-1-"}, {kind: "KubeadmControlPlane", namespace: "default", namePrefix: "my-cluster-"}, {kind: "MachineDeployment", namespace: "default", namePrefix: "my-cluster-md-0-"}, {kind: "MachineDeployment", namespace: "default", namePrefix: "my-cluster-md-1-"}, @@ -170,7 +170,7 @@ func Test_topologyClient_Plan(t *testing.T) { created: []item{ // Modifying the DockerClusterTemplate will result in template rotation. A new template will be created // and used by KCP. - {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-control-plane-"}, + {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-"}, }, reconciledCluster: &client.ObjectKey{Namespace: "default", Name: "my-cluster"}, }, @@ -235,7 +235,7 @@ func Test_topologyClient_Plan(t *testing.T) { created: []item{ // Modifying the DockerClusterTemplate will result in template rotation. A new template will be created // and used by KCP. - {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-control-plane-"}, + {kind: "DockerMachineTemplate", namespace: "default", namePrefix: "my-cluster-"}, }, reconciledCluster: &client.ObjectKey{Namespace: "default", Name: "my-cluster"}, }, diff --git a/internal/controllers/topology/cluster/util.go b/internal/controllers/topology/cluster/util.go index 1a5f6ddd8fe5..ecbb68c91ed7 100644 --- a/internal/controllers/topology/cluster/util.go +++ b/internal/controllers/topology/cluster/util.go @@ -29,17 +29,17 @@ import ( // bootstrapTemplateNamePrefix calculates the name prefix for a BootstrapTemplate. func bootstrapTemplateNamePrefix(clusterName, machineDeploymentTopologyName string) string { - return fmt.Sprintf("%s-%s-bootstrap-", clusterName, machineDeploymentTopologyName) + return fmt.Sprintf("%s-%s-", clusterName, machineDeploymentTopologyName) } // infrastructureMachineTemplateNamePrefix calculates the name prefix for a InfrastructureMachineTemplate. func infrastructureMachineTemplateNamePrefix(clusterName, machineDeploymentTopologyName string) string { - return fmt.Sprintf("%s-%s-infra-", clusterName, machineDeploymentTopologyName) + return fmt.Sprintf("%s-%s-", clusterName, machineDeploymentTopologyName) } // infrastructureMachineTemplateNamePrefix calculates the name prefix for a InfrastructureMachineTemplate. func controlPlaneInfrastructureMachineTemplateNamePrefix(clusterName string) string { - return fmt.Sprintf("%s-control-plane-", clusterName) + return fmt.Sprintf("%s-", clusterName) } // getReference gets the object referenced in ref.