Skip to content

Commit

Permalink
Update generate cluster config command for Tinkerbell (#8226)
Browse files Browse the repository at this point in the history
Manually merging overriding code cov as these are generate commands and do not have tests.

* Update generate cluster config command for Tinkerbell

Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>
  • Loading branch information
rahulbabu95 authored Jun 4, 2024
1 parent a209c55 commit 337d0af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/api/v1alpha1/tinkerbelldatacenterconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ func NewTinkerbellDatacenterConfigGenerate(clusterName string) *TinkerbellDatace
ObjectMeta: ObjectMeta{
Name: clusterName,
},
Spec: TinkerbellDatacenterConfigSpec{},
Spec: TinkerbellDatacenterConfigSpec{
TinkerbellIP: "",
},
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/api/v1alpha1/tinkerbellmachineconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func NewTinkerbellMachineConfigGenerate(name string, opts ...TinkerbellMachineCo
Spec: TinkerbellMachineConfigSpec{
HardwareSelector: HardwareSelector{},
OSFamily: Ubuntu,
OSImageURL: "",
Users: []UserConfiguration{
{
Name: "ec2-user",
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1alpha1/tinkerbellmachineconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type TinkerbellMachineConfigSpec struct {
// OSImageURL is a URL to the OS image used during provisioning. It must include
// the Kubernetes version(s). For example, a URL used for Kubernetes 1.27 could
// be http://localhost:8080/ubuntu-2204-1.27.tgz
OSImageURL string `json:"osImageURL,omitempty"`
OSImageURL string `json:"osImageURL"`
Users []UserConfiguration `json:"users,omitempty"`
HostOSConfiguration *HostOSConfiguration `json:"hostOSConfiguration,omitempty"`
}
Expand Down
12 changes: 12 additions & 0 deletions pkg/providers/tinkerbell/assert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ func TestAssertMachineConfigK8sVersionBRWorker_Error(t *testing.T) {
g.Expect(err).ToNot(gomega.Succeed())
}

func TestAssertMachineConfigK8sVersionBRModularWorker_Error(t *testing.T) {
g := gomega.NewWithT(t)
builder := NewDefaultValidClusterSpecBuilder()
clusterSpec := builder.Build()
kube129 := eksav1alpha1.Kube129
clusterSpec.Spec.Cluster.Spec.ExternalEtcdConfiguration = nil
clusterSpec.Spec.Cluster.Spec.WorkerNodeGroupConfigurations[0].KubernetesVersion = &kube129
clusterSpec.MachineConfigs[builder.WorkerNodeGroupMachineName].Spec.OSFamily = "bottlerocket"
err := tinkerbell.AssertOsFamilyValid(clusterSpec)
g.Expect(err).ToNot(gomega.Succeed())
}

func TestAssertMachineConfigK8sVersionBR_Success(t *testing.T) {
g := gomega.NewWithT(t)
builder := NewDefaultValidClusterSpecBuilder()
Expand Down

0 comments on commit 337d0af

Please sign in to comment.