From af864a8d538b42a75107e42926233596a922e605 Mon Sep 17 00:00:00 2001 From: Enxebre Date: Mon, 29 Apr 2019 12:52:13 +0200 Subject: [PATCH] Revendor for cluster-api https://github.com/openshift/cluster-api/pull/34 --- Gopkg.lock | 12 ++- .../cluster-api-actuator-pkg/Gopkg.lock | 4 +- .../pkg/manifests/manifests.go | 12 --- .../config/crds/machine_v1beta1_cluster.yaml | 14 ---- .../config/crds/machine_v1beta1_machine.yaml | 73 ----------------- .../machine_v1beta1_machinedeployment.yaml | 43 ---------- .../crds/machine_v1beta1_machineset.yaml | 43 ---------- .../pkg/apis/machine/v1beta1/common_types.go | 26 +----- .../pkg/apis/machine/v1beta1/machine_types.go | 59 +------------- .../machine/v1beta1/zz_generated.deepcopy.go | 81 ------------------- .../pkg/controller/machine/BUILD.bazel | 3 + .../pkg/controller/machine/controller.go | 33 +++----- 12 files changed, 29 insertions(+), 374 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 2ed1a29a8b..8d349b1b5e 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -485,7 +485,7 @@ [[projects]] branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" - digest = "1:22cd3b43b4d813a4961b8774e13f7c8b7a8a3d0bfd6246290e956667a03d8086" + digest = "1:43b90c55a82c4be0bb8524534a92f2c7bd909e041a51e7b1ed6d52300978ef6a" name = "github.com/openshift/cluster-api" packages = [ "pkg/apis", @@ -505,11 +505,11 @@ "pkg/util", ] pruneopts = "T" - revision = "88d73f06ea7453ec900d043a2c4c35794abf4998" + revision = "d8958b539e331bf5ebb056b7f872541e13fb8e01" [[projects]] branch = "master" - digest = "1:10a5ccf52b9b2af2f8e9bf51ef8e67324e9e999f73099ddea1c849ae5295ced8" + digest = "1:c51e502153acd32f728210817c40fc8e1d6851d2b64a0be0b5c0186ee32218ac" name = "github.com/openshift/cluster-api-actuator-pkg" packages = [ "pkg/e2e/autoscaler", @@ -520,7 +520,7 @@ "pkg/types", ] pruneopts = "" - revision = "7405f6233af2dd7ff0bc6ac815d4a7e954af8ade" + revision = "286578aa9fd0510b7c37fbd4b4ab9c0eab7b03eb" [[projects]] branch = "master" @@ -1257,6 +1257,7 @@ "github.com/openshift/cluster-api-actuator-pkg/pkg/manifests", "github.com/openshift/cluster-api-actuator-pkg/pkg/types", "github.com/openshift/cluster-api/pkg/apis", + "github.com/openshift/cluster-api/pkg/apis/machine/common", "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1", "github.com/openshift/cluster-api/pkg/controller/error", "github.com/openshift/cluster-api/pkg/controller/machine", @@ -1272,13 +1273,16 @@ "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1", "k8s.io/apimachinery/pkg/api/equality", "k8s.io/apimachinery/pkg/apis/meta/v1", + "k8s.io/apimachinery/pkg/apis/meta/v1/validation", "k8s.io/apimachinery/pkg/labels", "k8s.io/apimachinery/pkg/runtime", "k8s.io/apimachinery/pkg/runtime/schema", "k8s.io/apimachinery/pkg/runtime/serializer", "k8s.io/apimachinery/pkg/types", "k8s.io/apimachinery/pkg/util/errors", + "k8s.io/apimachinery/pkg/util/intstr", "k8s.io/apimachinery/pkg/util/uuid", + "k8s.io/apimachinery/pkg/util/validation/field", "k8s.io/apimachinery/pkg/util/wait", "k8s.io/client-go/kubernetes", "k8s.io/client-go/kubernetes/scheme", diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock index 2d0b80767d..13955cb251 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock @@ -372,7 +372,7 @@ [[projects]] branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" - digest = "1:999aa1e8d36fbd410b276ef5a47d62d4a2caaece354e4377f7b8d27f9d75f3ca" + digest = "1:70aff930abe993c5b2c11128f615ac7ad529e99d82ee3fb13e41e2afac30a38c" name = "github.com/openshift/cluster-api" packages = [ "pkg/apis/cluster/common", @@ -388,7 +388,7 @@ "pkg/util", ] pruneopts = "" - revision = "776449739aa75bee4287469e3c82ded381f50b3c" + revision = "d8958b539e331bf5ebb056b7f872541e13fb8e01" [[projects]] branch = "master" diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go index 9f38ac1c01..dceb3efc16 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go @@ -958,10 +958,6 @@ func TestingMachine(clusterID string, namespace string, providerSpec machinev1be }, }, ProviderSpec: providerSpec, - Versions: machinev1beta1.MachineVersionInfo{ - Kubelet: "1.10.1", - ControlPlane: "1.10.1", - }, }, } @@ -981,10 +977,6 @@ func MasterMachine(clusterID, namespace string, providerSpec machinev1beta1.Prov }, Spec: machinev1beta1.MachineSpec{ ProviderSpec: providerSpec, - Versions: machinev1beta1.MachineVersionInfo{ - Kubelet: "1.10.1", - ControlPlane: "1.10.1", - }, }, } @@ -1076,10 +1068,6 @@ func WorkerMachineSet(clusterID, namespace string, providerSpec machinev1beta1.P }, }, ProviderSpec: providerSpec, - Versions: machinev1beta1.MachineVersionInfo{ - Kubelet: "1.10.1", - ControlPlane: "1.10.1", - }, }, }, }, diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml index 253ebd0d3c..507760d978 100644 --- a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_cluster.yaml @@ -73,20 +73,6 @@ spec: their own versioned API types that should be serialized/deserialized from this field, akin to component config. type: object - valueFrom: - description: Source for the provider configuration. Cannot be used - if value is not empty. - properties: - machineClass: - description: The machine class from which the provider config - should be sourced. - properties: - provider: - description: Provider is the name of the cloud-provider - which MachineClass is intended for. - type: string - type: object - type: object type: object required: - clusterNetwork diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml index e78458a400..e4944fbe7f 100644 --- a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machine.yaml @@ -30,13 +30,6 @@ spec: type: object spec: properties: - configSource: - description: ConfigSource is used to populate in the associated Node - for dynamic kubelet config. This field already exists in Node, so - any updates to it in the Machine spec will be automatically copied - to the linked NodeRef from the status. The rest of dynamic kubelet - config support should then work as-is. - type: object metadata: description: ObjectMeta will autopopulate the Node created. Use this to indicate what labels, annotations, name prefix, etc., should be @@ -68,20 +61,6 @@ spec: their own versioned API types that should be serialized/deserialized from this field, akin to component config. type: object - valueFrom: - description: Source for the provider configuration. Cannot be used - if value is not empty. - properties: - machineClass: - description: The machine class from which the provider config - should be sourced. - properties: - provider: - description: Provider is the name of the cloud-provider - which MachineClass is intended for. - type: string - type: object - type: object type: object taints: description: Taints is the full, authoritative list of taints to apply @@ -90,25 +69,6 @@ spec: items: type: object type: array - versions: - description: Versions of key software to use. This field is optional - at cluster creation time, and omitting the field indicates that the - cluster installation tool should select defaults for the user. These - defaults may differ based on the cluster installer, but the tool should - populate the values it uses when persisting Machine objects. A Machine - spec missing this field at runtime is invalid. - properties: - controlPlane: - description: ControlPlane is the semantic version of the Kubernetes - control plane to run. This should only be populated when the machine - is a control plane. - type: string - kubelet: - description: Kubelet is the semantic version of kubelet to run - type: string - required: - - kubelet - type: object required: - providerSpec type: object @@ -120,15 +80,6 @@ spec: items: type: object type: array - conditions: - description: 'Conditions lists the conditions synced from the node conditions - of the corresponding node-object. Machine-controller is responsible - for keeping conditions up-to-date. MachineSet controller will be taking - these conditions as a signal to decide if machine is healthy or needs - to be replaced. Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition' - items: - type: object - type: array errorMessage: description: ErrorMessage will be set in the event that there is a terminal problem reconciling the Machine and will contain a more verbose string @@ -200,30 +151,6 @@ spec: recommended that providers maintain their own versioned API types that should be serialized/deserialized from this field. type: object - versions: - description: 'Versions specifies the current versions of software on - the corresponding Node (if it exists). This is provided for a few - reasons: 1) It is more convenient than checking the NodeRef, traversing - it to the Node, and finding the appropriate field in Node.Status.NodeInfo (which - uses different field names and formatting). 2) It removes some of - the dependency on the structure of the Node, so that if the structure - of Node.Status.NodeInfo changes, only machine controllers need - to be updated, rather than every client of the Machines API. 3) - There is no other simple way to check the control plane version. - A client would have to connect directly to the apiserver running - on the target node in order to find out its version.' - properties: - controlPlane: - description: ControlPlane is the semantic version of the Kubernetes - control plane to run. This should only be populated when the machine - is a control plane. - type: string - kubelet: - description: Kubelet is the semantic version of kubelet to run - type: string - required: - - kubelet - type: object type: object version: v1beta1 status: diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml index cd7527f394..00cd0bdf9b 100644 --- a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machinedeployment.yaml @@ -123,14 +123,6 @@ spec: description: 'Specification of the desired behavior of the machine. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status' properties: - configSource: - description: ConfigSource is used to populate in the associated - Node for dynamic kubelet config. This field already exists - in Node, so any updates to it in the Machine spec will be - automatically copied to the linked NodeRef from the status. - The rest of dynamic kubelet config support should then work - as-is. - type: object metadata: description: ObjectMeta will autopopulate the Node created. Use this to indicate what labels, annotations, name prefix, @@ -165,20 +157,6 @@ spec: should be serialized/deserialized from this field, akin to component config. type: object - valueFrom: - description: Source for the provider configuration. Cannot - be used if value is not empty. - properties: - machineClass: - description: The machine class from which the provider - config should be sourced. - properties: - provider: - description: Provider is the name of the cloud-provider - which MachineClass is intended for. - type: string - type: object - type: object type: object taints: description: Taints is the full, authoritative list of taints @@ -187,27 +165,6 @@ spec: items: type: object type: array - versions: - description: Versions of key software to use. This field is - optional at cluster creation time, and omitting the field - indicates that the cluster installation tool should select - defaults for the user. These defaults may differ based on - the cluster installer, but the tool should populate the values - it uses when persisting Machine objects. A Machine spec missing - this field at runtime is invalid. - properties: - controlPlane: - description: ControlPlane is the semantic version of the - Kubernetes control plane to run. This should only be populated - when the machine is a control plane. - type: string - kubelet: - description: Kubelet is the semantic version of kubelet - to run - type: string - required: - - kubelet - type: object required: - providerSpec type: object diff --git a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml index 733fc975f7..6898963059 100644 --- a/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml +++ b/vendor/github.com/openshift/cluster-api/config/crds/machine_v1beta1_machineset.yaml @@ -63,14 +63,6 @@ spec: description: 'Specification of the desired behavior of the machine. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status' properties: - configSource: - description: ConfigSource is used to populate in the associated - Node for dynamic kubelet config. This field already exists - in Node, so any updates to it in the Machine spec will be - automatically copied to the linked NodeRef from the status. - The rest of dynamic kubelet config support should then work - as-is. - type: object metadata: description: ObjectMeta will autopopulate the Node created. Use this to indicate what labels, annotations, name prefix, @@ -105,20 +97,6 @@ spec: should be serialized/deserialized from this field, akin to component config. type: object - valueFrom: - description: Source for the provider configuration. Cannot - be used if value is not empty. - properties: - machineClass: - description: The machine class from which the provider - config should be sourced. - properties: - provider: - description: Provider is the name of the cloud-provider - which MachineClass is intended for. - type: string - type: object - type: object type: object taints: description: Taints is the full, authoritative list of taints @@ -127,27 +105,6 @@ spec: items: type: object type: array - versions: - description: Versions of key software to use. This field is - optional at cluster creation time, and omitting the field - indicates that the cluster installation tool should select - defaults for the user. These defaults may differ based on - the cluster installer, but the tool should populate the values - it uses when persisting Machine objects. A Machine spec missing - this field at runtime is invalid. - properties: - controlPlane: - description: ControlPlane is the semantic version of the - Kubernetes control plane to run. This should only be populated - when the machine is a control plane. - type: string - kubelet: - description: Kubelet is the semantic version of kubelet - to run - type: string - required: - - kubelet - type: object required: - providerSpec type: object diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go index 7884754101..5ee990c9f2 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go @@ -17,8 +17,7 @@ limitations under the License. package v1beta1 import ( - corev1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime" ) // ProviderSpec defines the configuration to use during node creation. @@ -32,27 +31,4 @@ type ProviderSpec struct { // field, akin to component config. // +optional Value *runtime.RawExtension `json:"value,omitempty"` - - // Source for the provider configuration. Cannot be used if value is - // not empty. - // +optional - ValueFrom *ProviderSpecSource `json:"valueFrom,omitempty"` -} - -// ProviderSpecSource represents a source for the provider-specific -// resource configuration. -type ProviderSpecSource struct { - // The machine class from which the provider config should be sourced. - // +optional - MachineClass *MachineClassRef `json:"machineClass,omitempty"` -} - -// MachineClassRef is a reference to the MachineClass object. Controllers should find the right MachineClass using this reference. -type MachineClassRef struct { - // +optional - *corev1.ObjectReference `json:",inline"` - - // Provider is the name of the cloud-provider which MachineClass is intended for. - // +optional - Provider string `json:"provider,omitempty"` } diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go index e7a386a8d1..cab20ee095 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go @@ -75,23 +75,6 @@ type MachineSpec struct { // +optional ProviderSpec ProviderSpec `json:"providerSpec"` - // Versions of key software to use. This field is optional at cluster - // creation time, and omitting the field indicates that the cluster - // installation tool should select defaults for the user. These - // defaults may differ based on the cluster installer, but the tool - // 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"` - - // ConfigSource is used to populate in the associated Node for dynamic kubelet config. This - // field already exists in Node, so any updates to it in the Machine - // spec will be automatically copied to the linked NodeRef from the - // status. The rest of dynamic kubelet config support should then work - // as-is. - // +optional - ConfigSource *corev1.NodeConfigSource `json:"configSource,omitempty"` - // ProviderID is the identification ID of the machine provided by the provider. // This field must match the provider ID as seen on the node object corresponding to this machine. // This field is required by higher level consumers of cluster-api. Example use case is cluster autoscaler @@ -119,22 +102,6 @@ type MachineStatus struct { // +optional LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` - // Versions specifies the current versions of software on the corresponding Node (if it - // exists). This is provided for a few reasons: - // - // 1) It is more convenient than checking the NodeRef, traversing it to - // the Node, and finding the appropriate field in Node.Status.NodeInfo - // (which uses different field names and formatting). - // 2) It removes some of the dependency on the structure of the Node, - // so that if the structure of Node.Status.NodeInfo changes, only - // machine controllers need to be updated, rather than every client - // of the Machines API. - // 3) There is no other simple way to check the control plane - // version. A client would have to connect directly to the apiserver - // running on the target node in order to find out its version. - // +optional - Versions *MachineVersionInfo `json:"versions,omitempty"` - // ErrorReason will be set in the event that there is a terminal problem // reconciling the Machine and will contain a succinct value suitable // for machine interpretation. @@ -184,14 +151,6 @@ type MachineStatus struct { // +optional Addresses []corev1.NodeAddress `json:"addresses,omitempty"` - // Conditions lists the conditions synced from the node conditions of the corresponding node-object. - // Machine-controller is responsible for keeping conditions up-to-date. - // MachineSet controller will be taking these conditions as a signal to decide if - // machine is healthy or needs to be replaced. - // Refer: https://kubernetes.io/docs/concepts/architecture/nodes/#condition - // +optional - Conditions []corev1.NodeCondition `json:"conditions,omitempty"` - // LastOperation describes the last-operation performed by the machine-controller. // This API should be useful as a history in terms of the latest operation performed on the // specific machine. It should also convey the state of the latest-operation for example if @@ -222,20 +181,6 @@ type LastOperation struct { Type *string `json:"type,omitempty"` } -/// [MachineStatus] - -/// [MachineVersionInfo] -type MachineVersionInfo struct { - // Kubelet is the semantic version of kubelet to run - Kubelet string `json:"kubelet"` - - // ControlPlane is the semantic version of the Kubernetes control plane to - // run. This should only be populated when the machine is a - // control plane. - // +optional - ControlPlane string `json:"controlPlane,omitempty"` -} - /// [MachineVersionInfo] func (m *Machine) Validate() field.ErrorList { @@ -248,8 +193,8 @@ func (m *Machine) Validate() field.ErrorList { } // validate provider config is set - if m.Spec.ProviderSpec.Value == nil && m.Spec.ProviderSpec.ValueFrom == nil { - errors = append(errors, field.Invalid(fldPath.Child("spec").Child("providerspec"), m.Spec.ProviderSpec, "at least one of value or valueFrom fields must be set")) + if m.Spec.ProviderSpec.Value == nil { + errors = append(errors, field.Invalid(fldPath.Child("spec").Child("providerspec"), m.Spec.ProviderSpec, "value field must be set")) } return errors diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go index c7535569a8..ec66da1256 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go @@ -289,27 +289,6 @@ func (in *MachineClassList) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineClassRef) DeepCopyInto(out *MachineClassRef) { - *out = *in - if in.ObjectReference != nil { - in, out := &in.ObjectReference, &out.ObjectReference - *out = new(v1.ObjectReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassRef. -func (in *MachineClassRef) DeepCopy() *MachineClassRef { - if in == nil { - return nil - } - out := new(MachineClassRef) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineDeployment) DeepCopyInto(out *MachineDeployment) { *out = *in @@ -632,12 +611,6 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { } } in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) - out.Versions = in.Versions - if in.ConfigSource != nil { - in, out := &in.ConfigSource, &out.ConfigSource - *out = new(v1.NodeConfigSource) - (*in).DeepCopyInto(*out) - } if in.ProviderID != nil { in, out := &in.ProviderID, &out.ProviderID *out = new(string) @@ -668,11 +641,6 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { in, out := &in.LastUpdated, &out.LastUpdated *out = (*in).DeepCopy() } - if in.Versions != nil { - in, out := &in.Versions, &out.Versions - *out = new(MachineVersionInfo) - **out = **in - } if in.ErrorReason != nil { in, out := &in.ErrorReason, &out.ErrorReason *out = new(common.MachineStatusError) @@ -693,13 +661,6 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { *out = make([]v1.NodeAddress, len(*in)) copy(*out, *in) } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]v1.NodeCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } if in.LastOperation != nil { in, out := &in.LastOperation, &out.LastOperation *out = new(LastOperation) @@ -741,22 +702,6 @@ func (in *MachineTemplateSpec) DeepCopy() *MachineTemplateSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MachineVersionInfo) DeepCopyInto(out *MachineVersionInfo) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineVersionInfo. -func (in *MachineVersionInfo) DeepCopy() *MachineVersionInfo { - if in == nil { - return nil - } - out := new(MachineVersionInfo) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkRanges) DeepCopyInto(out *NetworkRanges) { *out = *in @@ -786,11 +731,6 @@ func (in *ProviderSpec) DeepCopyInto(out *ProviderSpec) { *out = new(runtime.RawExtension) (*in).DeepCopyInto(*out) } - if in.ValueFrom != nil { - in, out := &in.ValueFrom, &out.ValueFrom - *out = new(ProviderSpecSource) - (*in).DeepCopyInto(*out) - } return } @@ -803,24 +743,3 @@ func (in *ProviderSpec) DeepCopy() *ProviderSpec { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ProviderSpecSource) DeepCopyInto(out *ProviderSpecSource) { - *out = *in - if in.MachineClass != nil { - in, out := &in.MachineClass, &out.MachineClass - *out = new(MachineClassRef) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpecSource. -func (in *ProviderSpecSource) DeepCopy() *ProviderSpecSource { - if in == nil { - return nil - } - out := new(ProviderSpecSource) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel index ee70c72aed..006b431d2b 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/BUILD.bazel @@ -38,14 +38,17 @@ go_test( "controller_test.go", "machine_controller_suite_test.go", "machine_controller_test.go", + "openshift_controller_test.go", ], embed = [":go_default_library"], deps = [ "//pkg/apis:go_default_library", "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/apis/machine/v1beta1:go_default_library", + "//pkg/controller/error:go_default_library", "//vendor/golang.org/x/net/context:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/client-go/kubernetes/scheme:go_default_library", "//vendor/k8s.io/client-go/rest:go_default_library", diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go index d41d0e9aaf..e216e749bd 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go @@ -198,18 +198,13 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul // deleted without a manual intervention. if _, exists := m.ObjectMeta.Annotations[ExcludeNodeDrainingAnnotation]; !exists && m.Status.NodeRef != nil { if err := r.drainNode(m); err != nil { - return reconcile.Result{}, err + return delayIfRequeueAfterError(err) } } if err := r.actuator.Delete(ctx, cluster, m); err != nil { - if requeueErr, ok := err.(*controllerError.RequeueAfterError); ok { - klog.Infof("Actuator returned requeue-after error: %v", requeueErr) - return reconcile.Result{Requeue: true, RequeueAfter: requeueErr.RequeueAfter}, nil - } - klog.Errorf("Failed to delete machine %q: %v", name, err) - return reconcile.Result{}, err + return delayIfRequeueAfterError(err) } if m.Status.NodeRef != nil { @@ -240,28 +235,17 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul if exist { klog.Infof("Reconciling machine %q triggers idempotent update", name) if err := r.actuator.Update(ctx, cluster, m); err != nil { - if requeueErr, ok := err.(*controllerError.RequeueAfterError); ok { - klog.Infof("Actuator returned requeue-after error: %v", requeueErr) - return reconcile.Result{Requeue: true, RequeueAfter: requeueErr.RequeueAfter}, nil - } - klog.Errorf(`Error updating machine "%s/%s": %v`, m.Namespace, name, err) - return reconcile.Result{}, err + return delayIfRequeueAfterError(err) } - return reconcile.Result{}, nil } // Machine resource created. Machine does not yet exist. klog.Infof("Reconciling machine object %v triggers idempotent create.", m.ObjectMeta.Name) if err := r.actuator.Create(ctx, cluster, m); err != nil { - if requeueErr, ok := err.(*controllerError.RequeueAfterError); ok { - klog.Infof("Actuator returned requeue-after error: %v", requeueErr) - return reconcile.Result{Requeue: true, RequeueAfter: requeueErr.RequeueAfter}, nil - } - klog.Warningf("Failed to create machine %q: %v", name, err) - return reconcile.Result{}, err + return delayIfRequeueAfterError(err) } return reconcile.Result{}, nil @@ -354,3 +338,12 @@ func (r *ReconcileMachine) deleteNode(ctx context.Context, name string) error { } return r.Client.Delete(ctx, &node) } + +func delayIfRequeueAfterError(err error) (reconcile.Result, error) { + switch t := err.(type) { + case *controllerError.RequeueAfterError: + klog.Infof("Actuator returned requeue-after error: %v", err) + return reconcile.Result{Requeue: true, RequeueAfter: t.RequeueAfter}, nil + } + return reconcile.Result{}, err +}