From cbc34011fa5cee3a7afea2631fef323c65e35e55 Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Mon, 7 Dec 2020 16:01:21 -0700 Subject: [PATCH] :warning: Remove deprecated Bootstrap Data --- api/v1alpha3/conversion.go | 14 ++- api/v1alpha3/zz_generated.conversion.go | 90 +++++++++++++++---- api/v1alpha4/machine_types.go | 11 +-- api/v1alpha4/machine_webhook_test.go | 2 +- api/v1alpha4/zz_generated.deepcopy.go | 5 -- bootstrap/kubeadm/api/v1alpha3/conversion.go | 6 ++ .../api/v1alpha3/zz_generated.conversion.go | 18 ++-- .../v1alpha4/kubeadmbootstrapconfig_types.go | 8 -- .../api/v1alpha4/zz_generated.deepcopy.go | 5 -- ...strap.cluster.x-k8s.io_kubeadmconfigs.yaml | 4 - .../controllers/kubeadmconfig_controller.go | 3 - .../kubeadmconfig_controller_test.go | 44 --------- .../cluster.x-k8s.io_machinedeployments.yaml | 5 +- .../crd/bases/cluster.x-k8s.io_machines.yaml | 5 +- .../bases/cluster.x-k8s.io_machinesets.yaml | 5 +- .../exp.cluster.x-k8s.io_machinepools.yaml | 5 +- controllers/cluster_controller_test.go | 2 +- controllers/machine_controller_phases.go | 1 - controllers/machine_controller_phases_test.go | 5 +- controllers/machine_controller_test.go | 38 ++++---- .../machinehealthcheck_targets_test.go | 2 +- .../architecture/controllers/machine.md | 4 +- .../src/images/bootstrap-controller.plantuml | 6 +- exp/api/v1alpha4/machinepool_webhook_test.go | 2 +- .../machinepool_controller_phases.go | 2 +- .../machinepool_controller_phases_test.go | 8 +- 26 files changed, 134 insertions(+), 166 deletions(-) diff --git a/api/v1alpha3/conversion.go b/api/v1alpha3/conversion.go index feac0b4e45cd..8a99798574be 100644 --- a/api/v1alpha3/conversion.go +++ b/api/v1alpha3/conversion.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha3 import ( + apiconversion "k8s.io/apimachinery/pkg/conversion" "sigs.k8s.io/cluster-api/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/conversion" ) @@ -24,7 +25,7 @@ import ( func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*v1alpha4.Cluster) - return Convert_v1alpha3_Cluster_To_v1alpha4_Cluster(src, dst, nil) + return Convert_v1alpha3_Cluster_To_v1alpha4_Cluster(src, dst, nil) } func (dst *Cluster) ConvertFrom(srcRaw conversion.Hub) error { @@ -96,7 +97,7 @@ func (dst *MachineSetList) ConvertFrom(srcRaw conversion.Hub) error { func (src *MachineDeployment) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*v1alpha4.MachineDeployment) - return Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(src, dst, nil) + return Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(src, dst, nil) } func (dst *MachineDeployment) ConvertFrom(srcRaw conversion.Hub) error { @@ -120,7 +121,7 @@ func (dst *MachineDeploymentList) ConvertFrom(srcRaw conversion.Hub) error { func (src *MachineHealthCheck) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*v1alpha4.MachineHealthCheck) - return Convert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(src, dst, nil) + return Convert_v1alpha3_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(src, dst, nil) } func (dst *MachineHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { @@ -132,7 +133,7 @@ func (dst *MachineHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { func (src *MachineHealthCheckList) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*v1alpha4.MachineHealthCheckList) - return Convert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(src, dst, nil) + return Convert_v1alpha3_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(src, dst, nil) } func (dst *MachineHealthCheckList) ConvertFrom(srcRaw conversion.Hub) error { @@ -140,3 +141,8 @@ func (dst *MachineHealthCheckList) ConvertFrom(srcRaw conversion.Hub) error { return Convert_v1alpha4_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(src, dst, nil) } + +// Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap is an autogenerated conversion function. +func Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in *Bootstrap, out *v1alpha4.Bootstrap, s apiconversion.Scope) error { //nolint + return autoConvert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in, out, s) +} diff --git a/api/v1alpha3/zz_generated.conversion.go b/api/v1alpha3/zz_generated.conversion.go index 2458194b2b47..75fca5696625 100644 --- a/api/v1alpha3/zz_generated.conversion.go +++ b/api/v1alpha3/zz_generated.conversion.go @@ -49,11 +49,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*Bootstrap)(nil), (*v1alpha4.Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(a.(*Bootstrap), b.(*v1alpha4.Bootstrap), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1alpha4.Bootstrap)(nil), (*Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(a.(*v1alpha4.Bootstrap), b.(*Bootstrap), scope) }); err != nil { @@ -359,6 +354,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*Bootstrap)(nil), (*v1alpha4.Bootstrap)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(a.(*Bootstrap), b.(*v1alpha4.Bootstrap), scope) + }); err != nil { + return err + } return nil } @@ -386,19 +386,13 @@ func Convert_v1alpha4_APIEndpoint_To_v1alpha3_APIEndpoint(in *v1alpha4.APIEndpoi func autoConvert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in *Bootstrap, out *v1alpha4.Bootstrap, s conversion.Scope) error { out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) - out.Data = (*string)(unsafe.Pointer(in.Data)) + // WARNING: in.Data requires manual conversion: does not exist in peer-type out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) return nil } -// Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap is an autogenerated conversion function. -func Convert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in *Bootstrap, out *v1alpha4.Bootstrap, s conversion.Scope) error { - return autoConvert_v1alpha3_Bootstrap_To_v1alpha4_Bootstrap(in, out, s) -} - func autoConvert_v1alpha4_Bootstrap_To_v1alpha3_Bootstrap(in *v1alpha4.Bootstrap, out *Bootstrap, s conversion.Scope) error { out.ConfigRef = (*v1.ObjectReference)(unsafe.Pointer(in.ConfigRef)) - out.Data = (*string)(unsafe.Pointer(in.Data)) out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) return nil } @@ -696,7 +690,17 @@ func Convert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(in *v1alph func autoConvert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(in *MachineDeploymentList, out *v1alpha4.MachineDeploymentList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1alpha4.MachineDeployment)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.MachineDeployment, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_MachineDeployment_To_v1alpha4_MachineDeployment(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -707,7 +711,17 @@ func Convert_v1alpha3_MachineDeploymentList_To_v1alpha4_MachineDeploymentList(in func autoConvert_v1alpha4_MachineDeploymentList_To_v1alpha3_MachineDeploymentList(in *v1alpha4.MachineDeploymentList, out *MachineDeploymentList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]MachineDeployment)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineDeployment, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_MachineDeployment_To_v1alpha3_MachineDeployment(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -928,7 +942,17 @@ func Convert_v1alpha4_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckSta func autoConvert_v1alpha3_MachineList_To_v1alpha4_MachineList(in *MachineList, out *v1alpha4.MachineList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1alpha4.Machine)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.Machine, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_Machine_To_v1alpha4_Machine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -939,7 +963,17 @@ func Convert_v1alpha3_MachineList_To_v1alpha4_MachineList(in *MachineList, out * func autoConvert_v1alpha4_MachineList_To_v1alpha3_MachineList(in *v1alpha4.MachineList, out *MachineList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]Machine)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_Machine_To_v1alpha3_Machine(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -1004,7 +1038,17 @@ func Convert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(in *v1alpha4.MachineSet, func autoConvert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(in *MachineSetList, out *v1alpha4.MachineSetList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1alpha4.MachineSet)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha4.MachineSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_MachineSet_To_v1alpha4_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -1015,7 +1059,17 @@ func Convert_v1alpha3_MachineSetList_To_v1alpha4_MachineSetList(in *MachineSetLi func autoConvert_v1alpha4_MachineSetList_To_v1alpha3_MachineSetList(in *v1alpha4.MachineSetList, out *MachineSetList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]MachineSet)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_MachineSet_To_v1alpha3_MachineSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } diff --git a/api/v1alpha4/machine_types.go b/api/v1alpha4/machine_types.go index ce0efd57c438..be51ed5dcfd8 100644 --- a/api/v1alpha4/machine_types.go +++ b/api/v1alpha4/machine_types.go @@ -214,20 +214,11 @@ func (m *MachineStatus) GetTypedPhase() MachinePhase { type Bootstrap struct { // ConfigRef is a reference to a bootstrap provider-specific resource // that holds configuration details. The reference is optional to - // allow users/operators to specify Bootstrap.Data without + // allow users/operators to specify Bootstrap.DataSecretName without // the need of a controller. // +optional ConfigRef *corev1.ObjectReference `json:"configRef,omitempty"` - // Data contains the bootstrap data, such as cloud-init details scripts. - // If nil, the Machine should remain in the Pending state. - // - // Deprecated: This field has been deprecated in v1alpha4 and - // will be removed in a future version. Switch to DataSecretName. - // - // +optional - Data *string `json:"data,omitempty"` - // DataSecretName is the name of the secret that stores the bootstrap data script. // If nil, the Machine should remain in the Pending state. // +optional diff --git a/api/v1alpha4/machine_webhook_test.go b/api/v1alpha4/machine_webhook_test.go index e4996d3a7962..4f4daf344391 100644 --- a/api/v1alpha4/machine_webhook_test.go +++ b/api/v1alpha4/machine_webhook_test.go @@ -65,7 +65,7 @@ func TestMachineBootstrapValidation(t *testing.T) { }, { name: "should not return error if config ref is set", - bootstrap: Bootstrap{ConfigRef: &corev1.ObjectReference{}, Data: nil}, + bootstrap: Bootstrap{ConfigRef: &corev1.ObjectReference{}, DataSecretName: nil}, expectErr: false, }, } diff --git a/api/v1alpha4/zz_generated.deepcopy.go b/api/v1alpha4/zz_generated.deepcopy.go index 3557cbf49259..bc241ddd9e2d 100644 --- a/api/v1alpha4/zz_generated.deepcopy.go +++ b/api/v1alpha4/zz_generated.deepcopy.go @@ -51,11 +51,6 @@ func (in *Bootstrap) DeepCopyInto(out *Bootstrap) { *out = new(v1.ObjectReference) **out = **in } - if in.Data != nil { - in, out := &in.Data, &out.Data - *out = new(string) - **out = **in - } if in.DataSecretName != nil { in, out := &in.DataSecretName, &out.DataSecretName *out = new(string) diff --git a/bootstrap/kubeadm/api/v1alpha3/conversion.go b/bootstrap/kubeadm/api/v1alpha3/conversion.go index 6e77a1d20983..a6a511566a59 100644 --- a/bootstrap/kubeadm/api/v1alpha3/conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/conversion.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha3 import ( + apiconversion "k8s.io/apimachinery/pkg/conversion" kubeadmbootstrapv1alpha4 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4" "sigs.k8s.io/controller-runtime/pkg/conversion" ) @@ -68,3 +69,8 @@ func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*kubeadmbootstrapv1alpha4.KubeadmConfigTemplateList) return Convert_v1alpha4_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil) } + +// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus is an autogenerated conversion function. +func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *KubeadmConfigStatus, out *kubeadmbootstrapv1alpha4.KubeadmConfigStatus, s apiconversion.Scope) error { //nolint + return autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in, out, s) +} diff --git a/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go b/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go index 959b32538146..85ab5e760650 100644 --- a/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go +++ b/bootstrap/kubeadm/api/v1alpha3/zz_generated.conversion.go @@ -108,11 +108,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*KubeadmConfigStatus)(nil), (*v1alpha4.KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(a.(*KubeadmConfigStatus), b.(*v1alpha4.KubeadmConfigStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1alpha4.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*v1alpha4.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) }); err != nil { @@ -198,6 +193,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*KubeadmConfigStatus)(nil), (*v1alpha4.KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(a.(*KubeadmConfigStatus), b.(*v1alpha4.KubeadmConfigStatus), scope) + }); err != nil { + return err + } return nil } @@ -430,7 +430,7 @@ func Convert_v1alpha4_KubeadmConfigSpec_To_v1alpha3_KubeadmConfigSpec(in *v1alph func autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *KubeadmConfigStatus, out *v1alpha4.KubeadmConfigStatus, s conversion.Scope) error { out.Ready = in.Ready out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) - out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) + // WARNING: in.BootstrapData requires manual conversion: does not exist in peer-type out.FailureReason = in.FailureReason out.FailureMessage = in.FailureMessage out.ObservedGeneration = in.ObservedGeneration @@ -448,15 +448,9 @@ func autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in return nil } -// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus is an autogenerated conversion function. -func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *KubeadmConfigStatus, out *v1alpha4.KubeadmConfigStatus, s conversion.Scope) error { - return autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in, out, s) -} - func autoConvert_v1alpha4_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *v1alpha4.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { out.Ready = in.Ready out.DataSecretName = (*string)(unsafe.Pointer(in.DataSecretName)) - out.BootstrapData = *(*[]byte)(unsafe.Pointer(&in.BootstrapData)) out.FailureReason = in.FailureReason out.FailureMessage = in.FailureMessage out.ObservedGeneration = in.ObservedGeneration diff --git a/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go b/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go index ddb6ac2c6f79..c5a75937d1a0 100644 --- a/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go +++ b/bootstrap/kubeadm/api/v1alpha4/kubeadmbootstrapconfig_types.go @@ -106,14 +106,6 @@ type KubeadmConfigStatus struct { // +optional DataSecretName *string `json:"dataSecretName,omitempty"` - // BootstrapData will be a cloud-init script for now. - // - // Deprecated: This field has been deprecated in v1alpha3 and - // will be removed in a future version. Switch to DataSecretName. - // - // +optional - BootstrapData []byte `json:"bootstrapData,omitempty"` - // FailureReason will be set on non-retryable errors // +optional FailureReason string `json:"failureReason,omitempty"` diff --git a/bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go b/bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go index 623a45c762b5..48dda858793a 100644 --- a/bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go +++ b/bootstrap/kubeadm/api/v1alpha4/zz_generated.deepcopy.go @@ -273,11 +273,6 @@ func (in *KubeadmConfigStatus) DeepCopyInto(out *KubeadmConfigStatus) { *out = new(string) **out = **in } - if in.BootstrapData != nil { - in, out := &in.BootstrapData, &out.BootstrapData - *out = make([]byte, len(*in)) - copy(*out, *in) - } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make(apiv1alpha4.Conditions, len(*in)) diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml index 991c5bab6f7e..9730b265b56d 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml @@ -1359,10 +1359,6 @@ spec: status: description: KubeadmConfigStatus defines the observed state of KubeadmConfig properties: - bootstrapData: - description: "BootstrapData will be a cloud-init script for now. \n Deprecated: This field has been deprecated in v1alpha3 and will be removed in a future version. Switch to DataSecretName." - format: byte - type: string conditions: description: Conditions defines current service state of the KubeadmConfig. items: diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go index 2a22eef5341a..ba40fef78100 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller.go @@ -212,9 +212,6 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques log.Info("Cluster infrastructure is not ready, waiting") conditions.MarkFalse(config, bootstrapv1.DataSecretAvailableCondition, bootstrapv1.WaitingForClusterInfrastructureReason, clusterv1.ConditionSeverityInfo, "") return ctrl.Result{}, nil - // Migrate plaintext data to secret. - case config.Status.BootstrapData != nil && config.Status.DataSecretName == nil: - return ctrl.Result{}, r.storeBootstrapData(ctx, scope, config.Status.BootstrapData) // Reconcile status for machines that already have a secret reference, but our status isn't up to date. // This case solves the pivoting scenario (or a backup restore) which doesn't preserve the status subresource on objects. case configOwner.DataSecretName() != nil && (!config.Status.Ready || config.Status.DataSecretName == nil): diff --git a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go index 523e49edd65d..06135ceb2bc3 100644 --- a/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go +++ b/bootstrap/kubeadm/controllers/kubeadmconfig_controller_test.go @@ -184,50 +184,6 @@ func TestKubeadmConfigReconciler_Reconcile_ReturnEarlyIfMachineHasDataSecretName g.Expect(result.RequeueAfter).To(Equal(time.Duration(0))) } -// Test the logic to migrate plaintext bootstrap data to a field. -func TestKubeadmConfigReconciler_Reconcile_MigrateToSecret(t *testing.T) { - g := NewWithT(t) - - cluster := newCluster("cluster") - cluster.Status.InfrastructureReady = true - machine := newMachine(cluster, "machine") - config := newKubeadmConfig(machine, "cfg") - config.Status.Ready = true - config.Status.BootstrapData = []byte("test") - objects := []client.Object{ - cluster, - machine, - config, - } - myclient := helpers.NewFakeClientWithScheme(setupScheme(), objects...) - - k := &KubeadmConfigReconciler{ - Client: myclient, - } - - request := ctrl.Request{ - NamespacedName: client.ObjectKey{ - Namespace: "default", - Name: "cfg", - }, - } - - result, err := k.Reconcile(ctx, request) - g.Expect(err).NotTo(HaveOccurred()) - g.Expect(result.Requeue).To(BeFalse()) - g.Expect(result.RequeueAfter).To(Equal(time.Duration(0))) - - g.Expect(k.Client.Get(ctx, client.ObjectKey{Name: config.Name, Namespace: config.Namespace}, config)).To(Succeed()) - g.Expect(config.Status.DataSecretName).NotTo(BeNil()) - - secret := &corev1.Secret{} - g.Expect(k.Client.Get(ctx, client.ObjectKey{Namespace: config.Namespace, Name: *config.Status.DataSecretName}, secret)).To(Succeed()) - g.Expect(secret.Data["value"]).NotTo(Equal("test")) - g.Expect(secret.Type).To(Equal(clusterv1.ClusterSecretType)) - clusterName := secret.Labels[clusterv1.ClusterLabelName] - g.Expect(clusterName).To(Equal("cluster")) -} - func TestKubeadmConfigReconciler_ReturnEarlyIfClusterInfraNotReady(t *testing.T) { g := NewWithT(t) diff --git a/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml b/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml index c28488a54d7e..289fb2f50f38 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml @@ -498,7 +498,7 @@ spec: description: Bootstrap is a reference to a local struct which encapsulates fields to configure the Machine’s bootstrapping mechanism. properties: configRef: - description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.Data without the need of a controller. + description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.DataSecretName without the need of a controller. properties: apiVersion: description: API version of the referent. @@ -522,9 +522,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." - type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string diff --git a/config/crd/bases/cluster.x-k8s.io_machines.yaml b/config/crd/bases/cluster.x-k8s.io_machines.yaml index 5b425d15db8a..5d6f007cfdaa 100644 --- a/config/crd/bases/cluster.x-k8s.io_machines.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machines.yaml @@ -278,7 +278,7 @@ spec: description: Bootstrap is a reference to a local struct which encapsulates fields to configure the Machine’s bootstrapping mechanism. properties: configRef: - description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.Data without the need of a controller. + description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.DataSecretName without the need of a controller. properties: apiVersion: description: API version of the referent. @@ -302,9 +302,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." - type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string diff --git a/config/crd/bases/cluster.x-k8s.io_machinesets.yaml b/config/crd/bases/cluster.x-k8s.io_machinesets.yaml index 57d0c176515e..110b66d0caaa 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinesets.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinesets.yaml @@ -425,7 +425,7 @@ spec: description: Bootstrap is a reference to a local struct which encapsulates fields to configure the Machine’s bootstrapping mechanism. properties: configRef: - description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.Data without the need of a controller. + description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.DataSecretName without the need of a controller. properties: apiVersion: description: API version of the referent. @@ -449,9 +449,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." - type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string diff --git a/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml b/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml index 1b5a6eee6978..2656d171f1ed 100644 --- a/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml +++ b/config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml @@ -457,7 +457,7 @@ spec: description: Bootstrap is a reference to a local struct which encapsulates fields to configure the Machine’s bootstrapping mechanism. properties: configRef: - description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.Data without the need of a controller. + description: ConfigRef is a reference to a bootstrap provider-specific resource that holds configuration details. The reference is optional to allow users/operators to specify Bootstrap.DataSecretName without the need of a controller. properties: apiVersion: description: API version of the referent. @@ -481,9 +481,6 @@ spec: description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' type: string type: object - data: - description: "Data contains the bootstrap data, such as cloud-init details scripts. If nil, the Machine should remain in the Pending state. \n Deprecated: This field has been deprecated in v1alpha4 and will be removed in a future version. Switch to DataSecretName." - type: string dataSecretName: description: DataSecretName is the name of the secret that stores the bootstrap data script. If nil, the Machine should remain in the Pending state. type: string diff --git a/controllers/cluster_controller_test.go b/controllers/cluster_controller_test.go index dda9bc670a1f..d65d27d81591 100644 --- a/controllers/cluster_controller_test.go +++ b/controllers/cluster_controller_test.go @@ -287,7 +287,7 @@ var _ = Describe("Cluster Reconciler", func() { ClusterName: cluster.Name, ProviderID: pointer.StringPtr("aws:///id-node-1"), Bootstrap: clusterv1.Bootstrap{ - Data: pointer.StringPtr(""), + DataSecretName: pointer.StringPtr(""), }, }, } diff --git a/controllers/machine_controller_phases.go b/controllers/machine_controller_phases.go index 017d90d49e26..a0cd730f1b7f 100644 --- a/controllers/machine_controller_phases.go +++ b/controllers/machine_controller_phases.go @@ -228,7 +228,6 @@ func (r *MachineReconciler) reconcileBootstrap(ctx context.Context, cluster *clu return ctrl.Result{}, errors.Errorf("retrieved empty dataSecretName from bootstrap provider for Machine %q in namespace %q", m.Name, m.Namespace) } - m.Spec.Bootstrap.Data = nil m.Spec.Bootstrap.DataSecretName = pointer.StringPtr(secretName) m.Status.BootstrapReady = true return ctrl.Result{}, nil diff --git a/controllers/machine_controller_phases_test.go b/controllers/machine_controller_phases_test.go index c36b3228d572..1b1bf416705d 100644 --- a/controllers/machine_controller_phases_test.go +++ b/controllers/machine_controller_phases_test.go @@ -622,7 +622,7 @@ func TestReconcileBootstrap(t *testing.T) { expectError: true, expected: func(g *WithT, m *clusterv1.Machine) { g.Expect(m.Status.BootstrapReady).To(BeFalse()) - g.Expect(m.Spec.Bootstrap.Data).To(BeNil()) + g.Expect(m.Spec.Bootstrap.DataSecretName).To(BeNil()) }, }, { @@ -701,7 +701,7 @@ func TestReconcileBootstrap(t *testing.T) { Kind: "BootstrapMachine", Name: "bootstrap-config1", }, - Data: pointer.StringPtr("#!/bin/bash ... data"), + DataSecretName: pointer.StringPtr("secret-data"), }, }, Status: clusterv1.MachineStatus{ @@ -711,7 +711,6 @@ func TestReconcileBootstrap(t *testing.T) { expectError: false, expected: func(g *WithT, m *clusterv1.Machine) { g.Expect(m.Status.BootstrapReady).To(BeTrue()) - g.Expect(m.Spec.Bootstrap.Data).To(BeNil()) g.Expect(*m.Spec.Bootstrap.DataSecretName).To(BeEquivalentTo("secret-data")) }, }, diff --git a/controllers/machine_controller_test.go b/controllers/machine_controller_test.go index 73a89800ed24..d0ca798f50d8 100644 --- a/controllers/machine_controller_test.go +++ b/controllers/machine_controller_test.go @@ -367,7 +367,7 @@ func TestMachineFinalizer(t *testing.T) { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - Data: &bootstrapData, + DataSecretName: &bootstrapData, }, ClusterName: "valid-cluster", }, @@ -381,7 +381,7 @@ func TestMachineFinalizer(t *testing.T) { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - Data: &bootstrapData, + DataSecretName: &bootstrapData, }, ClusterName: "valid-cluster", }, @@ -463,7 +463,7 @@ func TestMachineOwnerReference(t *testing.T) { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - Data: &bootstrapData, + DataSecretName: &bootstrapData, }, ClusterName: "test-cluster", }, @@ -487,7 +487,7 @@ func TestMachineOwnerReference(t *testing.T) { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - Data: &bootstrapData, + DataSecretName: &bootstrapData, }, ClusterName: "test-cluster", }, @@ -512,7 +512,7 @@ func TestMachineOwnerReference(t *testing.T) { }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ - Data: &bootstrapData, + DataSecretName: &bootstrapData, }, ClusterName: "test-cluster", }, @@ -1127,7 +1127,7 @@ func TestRemoveMachineFinalizerAfterDeleteReconcile(t *testing.T) { Kind: "InfrastructureMachine", Name: "infra-config1", }, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, } key := client.ObjectKey{Namespace: m.Namespace, Name: m.Name} @@ -1247,7 +1247,7 @@ func TestIsNodeDrainedAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{}, }, @@ -1264,7 +1264,7 @@ func TestIsNodeDrainedAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, NodeDrainTimeout: &metav1.Duration{Duration: time.Second * 60}, }, @@ -1291,7 +1291,7 @@ func TestIsNodeDrainedAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, NodeDrainTimeout: &metav1.Duration{Duration: time.Second * 60}, }, Status: clusterv1.MachineStatus{ @@ -1317,7 +1317,7 @@ func TestIsNodeDrainedAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ Conditions: clusterv1.Conditions{ @@ -1370,7 +1370,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{}, }, @@ -1388,7 +1388,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1415,7 +1415,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1440,7 +1440,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1484,7 +1484,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1518,7 +1518,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1552,7 +1552,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1614,7 +1614,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ @@ -1634,7 +1634,7 @@ func TestIsDeleteNodeAllowed(t *testing.T) { Spec: clusterv1.MachineSpec{ ClusterName: "test-cluster", InfrastructureRef: corev1.ObjectReference{}, - Bootstrap: clusterv1.Bootstrap{Data: pointer.StringPtr("data")}, + Bootstrap: clusterv1.Bootstrap{DataSecretName: pointer.StringPtr("data")}, }, Status: clusterv1.MachineStatus{ NodeRef: &corev1.ObjectReference{ diff --git a/controllers/machinehealthcheck_targets_test.go b/controllers/machinehealthcheck_targets_test.go index 8d5da75ad239..bde9d827e59d 100644 --- a/controllers/machinehealthcheck_targets_test.go +++ b/controllers/machinehealthcheck_targets_test.go @@ -352,7 +352,7 @@ func newTestMachine(name, namespace, clusterName, nodeName string, labels map[st Spec: clusterv1.MachineSpec{ ClusterName: clusterName, Bootstrap: clusterv1.Bootstrap{ - Data: &bootstrap, + DataSecretName: &bootstrap, }, }, Status: clusterv1.MachineStatus{ diff --git a/docs/book/src/developer/architecture/controllers/machine.md b/docs/book/src/developer/architecture/controllers/machine.md index 758145a7d474..8efbfc99e3bf 100644 --- a/docs/book/src/developer/architecture/controllers/machine.md +++ b/docs/book/src/developer/architecture/controllers/machine.md @@ -8,8 +8,8 @@ The Machine controller's main responsibilities are: * Each Machine object to the Cluster object. * The associated BootstrapConfig object. * The associated InfrastructureMachine object. -* Copy data from `BootstrapConfig.Status.BootstrapData` to `Machine.Spec.Bootstrap.Data` if -`Machine.Spec.Bootstrap.Data` is empty. +* Copy data from `BootstrapConfig.Status.DataSecretName` to `Machine.Spec.Bootstrap.DataSecretName` if +`Machine.Spec.Bootstrap.DataSecretName` is empty. * Setting NodeRefs to be able to associate machines and kubernetes nodes. * Deleting Nodes in the target cluster when the associated machine is deleted. * Cleanup of related objects. diff --git a/docs/book/src/images/bootstrap-controller.plantuml b/docs/book/src/images/bootstrap-controller.plantuml index 2fa8d45fe08a..ec7694e7242b 100644 --- a/docs/book/src/images/bootstrap-controller.plantuml +++ b/docs/book/src/images/bootstrap-controller.plantuml @@ -5,10 +5,10 @@ title Figure 1: State diagram with a generic provider note right - Bootstrap provider watches Machines in "pending" state, - generates //BootstrapConfig.Status.BootstrapData// and sets + generates //BootstrapConfig.Status.DataSecretName// and sets //BootstrapConfig.Status.Ready// = true. -- Machine controller sets //Machine.Spec.Bootstrap.Data// - from //BootstrapConfig.Status.BootstrapData//. +- Machine controller sets //Machine.Spec.Bootstrap.DataSecretName// + from //BootstrapConfig.Status.DataSecretName//. - Machine controller can now transition to the next state. end note diff --git a/exp/api/v1alpha4/machinepool_webhook_test.go b/exp/api/v1alpha4/machinepool_webhook_test.go index 82fa1f7c5006..21e914613bef 100644 --- a/exp/api/v1alpha4/machinepool_webhook_test.go +++ b/exp/api/v1alpha4/machinepool_webhook_test.go @@ -70,7 +70,7 @@ func TestMachinePoolBootstrapValidation(t *testing.T) { }, { name: "should not return error if config ref is set", - bootstrap: clusterv1.Bootstrap{ConfigRef: &corev1.ObjectReference{}, Data: nil}, + bootstrap: clusterv1.Bootstrap{ConfigRef: &corev1.ObjectReference{}, DataSecretName: nil}, expectErr: false, }, } diff --git a/exp/controllers/machinepool_controller_phases.go b/exp/controllers/machinepool_controller_phases.go index faf417dcee8a..7c4522ad6ad8 100644 --- a/exp/controllers/machinepool_controller_phases.go +++ b/exp/controllers/machinepool_controller_phases.go @@ -184,7 +184,7 @@ func (r *MachinePoolReconciler) reconcileBootstrap(ctx context.Context, cluster } // If the bootstrap data secret is populated, set ready and return. - if m.Spec.Template.Spec.Bootstrap.Data != nil || m.Spec.Template.Spec.Bootstrap.DataSecretName != nil { + if m.Spec.Template.Spec.Bootstrap.DataSecretName != nil { m.Status.BootstrapReady = true conditions.MarkTrue(m, clusterv1.BootstrapReadyCondition) return ctrl.Result{}, nil diff --git a/exp/controllers/machinepool_controller_phases_test.go b/exp/controllers/machinepool_controller_phases_test.go index 9744c247e6b3..960ba06194fc 100644 --- a/exp/controllers/machinepool_controller_phases_test.go +++ b/exp/controllers/machinepool_controller_phases_test.go @@ -522,7 +522,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { expectError: true, expected: func(g *WithT, m *expv1.MachinePool) { g.Expect(m.Status.BootstrapReady).To(BeFalse()) - g.Expect(m.Spec.Template.Spec.Bootstrap.Data).To(BeNil()) + g.Expect(m.Spec.Template.Spec.Bootstrap.DataSecretName).To(BeNil()) }, }, { @@ -603,7 +603,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { Kind: "BootstrapConfig", Name: "bootstrap-config1", }, - Data: pointer.StringPtr("#!/bin/bash ... data"), + DataSecretName: pointer.StringPtr("data"), }, }, }, @@ -615,7 +615,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { expectError: false, expected: func(g *WithT, m *expv1.MachinePool) { g.Expect(m.Status.BootstrapReady).To(BeTrue()) - g.Expect(*m.Spec.Template.Spec.Bootstrap.Data).To(Equal("#!/bin/bash ... data")) + g.Expect(*m.Spec.Template.Spec.Bootstrap.DataSecretName).To(Equal("data")) }, }, { @@ -647,7 +647,7 @@ func TestReconcileMachinePoolBootstrap(t *testing.T) { Kind: "BootstrapConfig", Name: "bootstrap-config1", }, - Data: pointer.StringPtr("#!/bin/bash ... data"), + DataSecretName: pointer.StringPtr("data"), }, }, },