From 337d0af135f38a0c33065208825b6bbe01346e58 Mon Sep 17 00:00:00 2001 From: Rahul Ganesh <31204974+rahulbabu95@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:17:55 -0700 Subject: [PATCH] Update generate cluster config command for Tinkerbell (#8226) 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 --- pkg/api/v1alpha1/tinkerbelldatacenterconfig.go | 4 +++- pkg/api/v1alpha1/tinkerbellmachineconfig.go | 1 + pkg/api/v1alpha1/tinkerbellmachineconfig_types.go | 2 +- pkg/providers/tinkerbell/assert_test.go | 12 ++++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pkg/api/v1alpha1/tinkerbelldatacenterconfig.go b/pkg/api/v1alpha1/tinkerbelldatacenterconfig.go index 1a2cc8fcf062..817eaca2dc8a 100644 --- a/pkg/api/v1alpha1/tinkerbelldatacenterconfig.go +++ b/pkg/api/v1alpha1/tinkerbelldatacenterconfig.go @@ -22,7 +22,9 @@ func NewTinkerbellDatacenterConfigGenerate(clusterName string) *TinkerbellDatace ObjectMeta: ObjectMeta{ Name: clusterName, }, - Spec: TinkerbellDatacenterConfigSpec{}, + Spec: TinkerbellDatacenterConfigSpec{ + TinkerbellIP: "", + }, } } diff --git a/pkg/api/v1alpha1/tinkerbellmachineconfig.go b/pkg/api/v1alpha1/tinkerbellmachineconfig.go index 6caf77e7ea0b..c952aa7e9df2 100644 --- a/pkg/api/v1alpha1/tinkerbellmachineconfig.go +++ b/pkg/api/v1alpha1/tinkerbellmachineconfig.go @@ -27,6 +27,7 @@ func NewTinkerbellMachineConfigGenerate(name string, opts ...TinkerbellMachineCo Spec: TinkerbellMachineConfigSpec{ HardwareSelector: HardwareSelector{}, OSFamily: Ubuntu, + OSImageURL: "", Users: []UserConfiguration{ { Name: "ec2-user", diff --git a/pkg/api/v1alpha1/tinkerbellmachineconfig_types.go b/pkg/api/v1alpha1/tinkerbellmachineconfig_types.go index 8de153fbeef8..68304aba1568 100644 --- a/pkg/api/v1alpha1/tinkerbellmachineconfig_types.go +++ b/pkg/api/v1alpha1/tinkerbellmachineconfig_types.go @@ -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"` } diff --git a/pkg/providers/tinkerbell/assert_test.go b/pkg/providers/tinkerbell/assert_test.go index c306360a90e0..900033f0c47b 100644 --- a/pkg/providers/tinkerbell/assert_test.go +++ b/pkg/providers/tinkerbell/assert_test.go @@ -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()