From 0b766d012942deb35ec2a57ce1a32ec74a532b18 Mon Sep 17 00:00:00 2001 From: Enxebre Date: Wed, 16 Jan 2019 12:46:33 +0100 Subject: [PATCH] Convert machineSpec.Versions to a pointer --- cmd/clusterctl/clusterdeployer/clusterdeployer_test.go | 2 +- pkg/apis/cluster/v1alpha1/machine_types.go | 2 +- pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go | 6 +++++- pkg/controller/machine/machine_controller_test.go | 2 +- .../machinedeployment/machinedeployment_controller_test.go | 2 +- pkg/controller/machineset/machineset_controller_test.go | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/clusterctl/clusterdeployer/clusterdeployer_test.go b/cmd/clusterctl/clusterdeployer/clusterdeployer_test.go index bf8d8ff2c84f..653719b97e8e 100644 --- a/cmd/clusterctl/clusterdeployer/clusterdeployer_test.go +++ b/cmd/clusterctl/clusterdeployer/clusterdeployer_test.go @@ -1193,7 +1193,7 @@ func generateTestMasterMachine(name string) *clusterv1.Machine { Name: name, }, Spec: clusterv1.MachineSpec{ - Versions: clusterv1.MachineVersionInfo{ + Versions: &clusterv1.MachineVersionInfo{ ControlPlane: "1.10.1", }, }, diff --git a/pkg/apis/cluster/v1alpha1/machine_types.go b/pkg/apis/cluster/v1alpha1/machine_types.go index 5a10bba39fb0..60556916410d 100644 --- a/pkg/apis/cluster/v1alpha1/machine_types.go +++ b/pkg/apis/cluster/v1alpha1/machine_types.go @@ -70,7 +70,7 @@ type MachineSpec struct { // should populate the values it uses when persisting Machine objects. // A Machine spec missing this field at runtime is invalid. // +optional - Versions MachineVersionInfo `json:"versions,omitempty"` + Versions *MachineVersionInfo `json:"versions,omitempty"` // To populate in the associated Node for dynamic kubelet config. This // field already exists in Node, so any updates to it in the Machine diff --git a/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go index 9b0a0352080a..8131d648a058 100644 --- a/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go @@ -632,7 +632,11 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { } } in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) - out.Versions = in.Versions + if in.Versions != nil { + in, out := &in.Versions, &out.Versions + *out = new(MachineVersionInfo) + **out = **in + } if in.ConfigSource != nil { in, out := &in.ConfigSource, &out.ConfigSource *out = new(v1.NodeConfigSource) diff --git a/pkg/controller/machine/machine_controller_test.go b/pkg/controller/machine/machine_controller_test.go index 8d8b2f88e004..2af5509f1a55 100644 --- a/pkg/controller/machine/machine_controller_test.go +++ b/pkg/controller/machine/machine_controller_test.go @@ -39,7 +39,7 @@ func TestReconcile(t *testing.T) { instance := &clusterv1alpha1.Machine{ ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "default"}, Spec: clusterv1alpha1.MachineSpec{ - Versions: clusterv1alpha1.MachineVersionInfo{Kubelet: "1.10.3"}, + Versions: &clusterv1alpha1.MachineVersionInfo{Kubelet: "1.10.3"}, }, } diff --git a/pkg/controller/machinedeployment/machinedeployment_controller_test.go b/pkg/controller/machinedeployment/machinedeployment_controller_test.go index 3029309313de..d6f56eac350e 100644 --- a/pkg/controller/machinedeployment/machinedeployment_controller_test.go +++ b/pkg/controller/machinedeployment/machinedeployment_controller_test.go @@ -59,7 +59,7 @@ func TestReconcile(t *testing.T) { Labels: labels, }, Spec: clusterv1alpha1.MachineSpec{ - Versions: clusterv1alpha1.MachineVersionInfo{Kubelet: "1.10.3"}, + Versions: &clusterv1alpha1.MachineVersionInfo{Kubelet: "1.10.3"}, }, }, }, diff --git a/pkg/controller/machineset/machineset_controller_test.go b/pkg/controller/machineset/machineset_controller_test.go index 153a51e9aa11..3387375c787c 100644 --- a/pkg/controller/machineset/machineset_controller_test.go +++ b/pkg/controller/machineset/machineset_controller_test.go @@ -43,7 +43,7 @@ func TestReconcile(t *testing.T) { Replicas: &replicas, Template: clusterv1alpha1.MachineTemplateSpec{ Spec: clusterv1alpha1.MachineSpec{ - Versions: clusterv1alpha1.MachineVersionInfo{Kubelet: "1.10.3"}, + Versions: &clusterv1alpha1.MachineVersionInfo{Kubelet: "1.10.3"}, }, }, },