Skip to content

Commit

Permalink
Merge pull request #9254 from sbueringer/pr-cc-consistent-obj-names
Browse files Browse the repository at this point in the history
🌱 Make ClusterClass generated object names consistent
  • Loading branch information
k8s-ci-robot committed Aug 22, 2023
2 parents 46412f0 + 7bc1644 commit 937af16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 937af16

Please sign in to comment.