Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Make ClusterClass generated object names consistent #9254

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/clusterctl/client/cluster/topology_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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-"},
Expand Down Expand Up @@ -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"},
},
Expand Down Expand Up @@ -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"},
},
Expand Down
6 changes: 3 additions & 3 deletions internal/controllers/topology/cluster/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading