diff --git a/Gopkg.lock b/Gopkg.lock index b27c7f4cb7..a3b38c7b16 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -433,8 +433,8 @@ version = "v1.5.0" [[projects]] - branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" - digest = "1:6c1953688007e98a582591088bfede8a3bb9e81dce2cdac3b4ace98730f6e2e5" + branch = "openshift-4.2-cluster-api-0.0.0-alpha.4" + digest = "1:d67ab3b4d46616ef4c7d482dd8a88dbe4634f3a35dd354720cb7a4d6b2f59fa1" name = "github.com/openshift/cluster-api" packages = [ "cmd/clusterctl/clientcmd", @@ -465,7 +465,7 @@ "pkg/util", ] pruneopts = "T" - revision = "f46665c25908ee8fd5cb6506f374e3ae254a08dc" + revision = "9941763fab7237205d6eb162cae1bfb1d0096058" [[projects]] branch = "master" @@ -1242,7 +1242,6 @@ "k8s.io/apimachinery/pkg/runtime/schema", "k8s.io/apimachinery/pkg/runtime/serializer/json", "k8s.io/apimachinery/pkg/util/json", - "k8s.io/apimachinery/pkg/util/wait", "k8s.io/client-go/kubernetes", "k8s.io/client-go/plugin/pkg/client/auth/gcp", "k8s.io/client-go/tools/record", diff --git a/Gopkg.toml b/Gopkg.toml index d8082a6d0e..5d77efeaf7 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -49,7 +49,7 @@ required = [ [[override]] name = "github.com/openshift/cluster-api" - branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" + branch = "openshift-4.2-cluster-api-0.0.0-alpha.4" [[override]] name = "k8s.io/code-generator" diff --git a/vendor/github.com/openshift/cluster-api/README.md b/vendor/github.com/openshift/cluster-api/README.md index 6f7ab30986..957d5c8793 100644 --- a/vendor/github.com/openshift/cluster-api/README.md +++ b/vendor/github.com/openshift/cluster-api/README.md @@ -1,73 +1,17 @@ # Cluster API -## What is the Cluster API? -The Cluster API is a Kubernetes project to bring declarative, Kubernetes-style -APIs to cluster creation, configuration, and management. It provides optional, -additive functionality on top of core Kubernetes. +Cluster API provides the ability to manage Kubernetes supportable hosts in the +context of OpenShift. -Note that Cluster API effort is still in the prototype stage while we get -feedback on the API types themselves. All of the code here is to experiment with -the API and demo its abilities, in order to drive more technical feedback to the -API design. Because of this, all of the prototype code is rapidly changing. +This branch contains an implementation of a machineset-controller and +machine-controller as well as their supporting libraries. -![Cluster API Architecture](./docs/book/common_code/architecture.svg "Cluster API Architecture") +Each of these controllers is deployed by the +[machine-api-operator](https://github.com/openshift/machine-api-operator) -To learn more, see the [Cluster API KEP][cluster-api-kep]. +# Upstream Implementation +Other branches of this repository may choose to track the upstream +Kubernetes [Cluster-API project](https://github.com/kubernetes-sigs/cluster-api) -## Get involved! - -* Join the [sig-cluster-lifecycle](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle) -Google Group for access to documents and calendars. - -* Join our Cluster API working group sessions - * Weekly on Wednesdays @ 10:00 PT on [Zoom][zoomMeeting] - * Previous meetings: \[ [notes][notes] | [recordings][recordings] \] - -* Provider implementer office hours - * Weekly on Tuesdays @ 12:00 PT ([Zoom][providerZoomMeetingTues]) and Wednesdays @ 15:00 CET ([Zoom][providerZoomMeetingWed]) - * Previous meetings: \[ [notes][implementerNotes] \] - -* Chat with us on [Slack](http://slack.k8s.io/): #cluster-api - -## Provider Implementations - -The code in this repository is independent of any specific deployment environment. -Provider specific code is being developed in separate repositories, some of which -are also sponsored by SIG-cluster-lifecycle: - - * AWS, https://github.com/kubernetes-sigs/cluster-api-provider-aws - * AWS/Openshift, https://github.com/openshift/cluster-operator - * Azure, https://github.com/kubernetes-sigs/cluster-api-provider-azure - * Baidu Cloud, https://github.com/baidu/cluster-api-provider-baiducloud - * Bare Metal, https://github.com/metalkube/cluster-api-provider-baremetal - * DigitalOcean, https://github.com/kubernetes-sigs/cluster-api-provider-digitalocean - * GCE, https://github.com/kubernetes-sigs/cluster-api-provider-gcp - * OpenStack, https://github.com/kubernetes-sigs/cluster-api-provider-openstack - * Tencent Cloud, https://github.com/TencentCloud/cluster-api-provider-tencent - * vSphere, https://github.com/kubernetes-sigs/cluster-api-provider-vsphere - -## API Adoption - -Following are the implementations managed by third-parties adopting the standard cluster-api and/or machine-api being developed here. - - * Kubermatic machine-controller, https://github.com/kubermatic/machine-controller/tree/master - * Machine API Operator, https://github.com/openshift/machine-api-operator/tree/master - * Machine-controller-manager, https://github.com/gardener/machine-controller-manager/tree/cluster-api - -## Getting Started - -### Resources - -* GitBook: [kubernetes-sigs.github.io/cluster-api](https://kubernetes-sigs.github.io/cluster-api) - -### Prerequisites -* `kubectl` is required, see [here](http://kubernetes.io/docs/user-guide/prereqs/). -* `clusterctl` is a SIG-cluster-lifecycle sponsored tool to manage Cluster API clusters. See [here](cmd/clusterctl) - -[cluster-api-kep]: https://github.com/kubernetes/enhancements/blob/master/keps/sig-cluster-lifecycle/0003-cluster-api.md -[notes]: https://docs.google.com/document/d/1Ys-DOR5UsgbMEeciuG0HOgDQc8kZsaWIWJeKJ1-UfbY/edit -[recordings]: https://www.youtube.com/playlist?list=PL69nYSiGNLP29D0nYgAGWt1ZFqS9Z7lw4 -[zoomMeeting]: https://zoom.us/j/861487554 -[implementerNotes]: https://docs.google.com/document/d/1IZ2-AZhe4r3CYiJuttyciS7bGZTTx4iMppcA8_Pr3xE/edit -[providerZoomMeetingTues]: https://zoom.us/j/140808484 -[providerZoomMeetingWed]: https://zoom.us/j/424743530 +In the future, we may align the master branch with the upstream project as it +stabilizes within the community. diff --git a/vendor/github.com/openshift/cluster-api/cmd/manager/main.go b/vendor/github.com/openshift/cluster-api/cmd/manager/main.go index 1ffccaba69..251e23f676 100644 --- a/vendor/github.com/openshift/cluster-api/cmd/manager/main.go +++ b/vendor/github.com/openshift/cluster-api/cmd/manager/main.go @@ -19,6 +19,7 @@ package main import ( "flag" "log" + "time" "github.com/openshift/cluster-api/pkg/apis" "github.com/openshift/cluster-api/pkg/controller" @@ -32,8 +33,14 @@ import ( func main() { flag.Set("logtostderr", "true") klog.InitFlags(nil) - flag.Parse() + watchNamespace := flag.String("namespace", "", + "Namespace that the controller watches to reconcile cluster-api objects. If unspecified, the controller watches for cluster-api objects across all namespaces.") + flag.Parse() + if *watchNamespace != "" { + log.Printf("Watching cluster-api objects only in namespace %q for reconciliation.", *watchNamespace) + } + log.Printf("Registering Components.") // Get a config to talk to the apiserver cfg, err := config.GetConfig() if err != nil { @@ -41,7 +48,11 @@ func main() { } // Create a new Cmd to provide shared dependencies and start components - mgr, err := manager.New(cfg, manager.Options{}) + syncPeriod := 10 * time.Minute + mgr, err := manager.New(cfg, manager.Options{ + SyncPeriod: &syncPeriod, + Namespace: *watchNamespace, + }) if err != nil { log.Fatal(err) } 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/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/BUILD.bazel index 3fc6c32d0d..8d83f8566d 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/BUILD.bazel @@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") go_library( name = "go_default_library", srcs = [ - "cluster_types.go", "common_types.go", "defaults.go", "doc.go", @@ -33,7 +32,6 @@ go_library( go_test( name = "go_default_test", srcs = [ - "cluster_types_test.go", "machine_types_test.go", "machinedeployment_types_test.go", "machineset_types_test.go", diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go deleted file mode 100644 index 134a63abb6..0000000000 --- a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go +++ /dev/null @@ -1,165 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package v1beta1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - - "github.com/openshift/cluster-api/pkg/apis/machine/common" - "k8s.io/apimachinery/pkg/util/validation/field" -) - -const ClusterFinalizer = "cluster.machine.openshift.io" - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -/// [Cluster] -// Cluster is the Schema for the clusters API -// +k8s:openapi-gen=true -// +kubebuilder:subresource:status -type Cluster struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata,omitempty"` - - Spec ClusterSpec `json:"spec,omitempty"` - Status ClusterStatus `json:"status,omitempty"` -} - -/// [Cluster] - -/// [ClusterSpec] -// ClusterSpec defines the desired state of Cluster -type ClusterSpec struct { - // Cluster network configuration - ClusterNetwork ClusterNetworkingConfig `json:"clusterNetwork"` - - // Provider-specific serialized configuration to use during - // cluster creation. It is recommended that providers maintain - // their own versioned API types that should be - // serialized/deserialized from this field. - // +optional - ProviderSpec ProviderSpec `json:"providerSpec,omitempty"` -} - -/// [ClusterSpec] - -/// [ClusterNetworkingConfig] -// ClusterNetworkingConfig specifies the different networking -// parameters for a cluster. -type ClusterNetworkingConfig struct { - // The network ranges from which service VIPs are allocated. - Services NetworkRanges `json:"services"` - - // The network ranges from which Pod networks are allocated. - Pods NetworkRanges `json:"pods"` - - // Domain name for services. - ServiceDomain string `json:"serviceDomain"` -} - -/// [ClusterNetworkingConfig] - -/// [NetworkRanges] -// NetworkRanges represents ranges of network addresses. -type NetworkRanges struct { - CIDRBlocks []string `json:"cidrBlocks"` -} - -/// [NetworkRanges] - -/// [ClusterStatus] -// ClusterStatus defines the observed state of Cluster -type ClusterStatus struct { - // APIEndpoint represents the endpoint to communicate with the IP. - // +optional - APIEndpoints []APIEndpoint `json:"apiEndpoints,omitempty"` - - // NB: Eventually we will redefine ErrorReason as ClusterStatusError once the - // following issue is fixed. - // https://github.com/kubernetes-incubator/apiserver-builder/issues/176 - - // If set, indicates that there is a problem reconciling the - // state, and will be set to a token value suitable for - // programmatic interpretation. - // +optional - ErrorReason common.ClusterStatusError `json:"errorReason,omitempty"` - - // If set, indicates that there is a problem reconciling the - // state, and will be set to a descriptive error message. - // +optional - ErrorMessage string `json:"errorMessage,omitempty"` - - // Provider-specific status. - // It is recommended that providers maintain their - // own versioned API types that should be - // serialized/deserialized from this field. - // +optional - ProviderStatus *runtime.RawExtension `json:"providerStatus,omitempty"` -} - -/// [ClusterStatus] - -/// [APIEndpoint] -// APIEndpoint represents a reachable Kubernetes API endpoint. -type APIEndpoint struct { - // The hostname on which the API server is serving. - Host string `json:"host"` - - // The port on which the API server is serving. - Port int `json:"port"` -} - -/// [APIEndpoint] - -func (o *Cluster) Validate() field.ErrorList { - errors := field.ErrorList{} - // perform validation here and add to errors using field.Invalid - if o.Spec.ClusterNetwork.ServiceDomain == "" { - errors = append(errors, field.Invalid( - field.NewPath("Spec", "ClusterNetwork", "ServiceDomain"), - o.Spec.ClusterNetwork.ServiceDomain, - "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.ServiceDomain")) - } - if len(o.Spec.ClusterNetwork.Pods.CIDRBlocks) == 0 { - errors = append(errors, field.Invalid( - field.NewPath("Spec", "ClusterNetwork", "Pods"), - o.Spec.ClusterNetwork.Pods, - "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.Pods")) - } - if len(o.Spec.ClusterNetwork.Services.CIDRBlocks) == 0 { - errors = append(errors, field.Invalid( - field.NewPath("Spec", "ClusterNetwork", "Services"), - o.Spec.ClusterNetwork.Services, - "invalid cluster configuration: missing Cluster.Spec.ClusterNetwork.Services")) - } - return errors -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// ClusterList contains a list of Cluster -type ClusterList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Cluster `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Cluster{}, &ClusterList{}) -} 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..53fa8da84e 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 @@ -27,145 +27,6 @@ import ( intstr "k8s.io/apimachinery/pkg/util/intstr" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *APIEndpoint) DeepCopyInto(out *APIEndpoint) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIEndpoint. -func (in *APIEndpoint) DeepCopy() *APIEndpoint { - if in == nil { - return nil - } - out := new(APIEndpoint) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Cluster) DeepCopyInto(out *Cluster) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster. -func (in *Cluster) DeepCopy() *Cluster { - if in == nil { - return nil - } - out := new(Cluster) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Cluster) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterList) DeepCopyInto(out *ClusterList) { - *out = *in - out.TypeMeta = in.TypeMeta - out.ListMeta = in.ListMeta - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Cluster, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList. -func (in *ClusterList) DeepCopy() *ClusterList { - if in == nil { - return nil - } - out := new(ClusterList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ClusterList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterNetworkingConfig) DeepCopyInto(out *ClusterNetworkingConfig) { - *out = *in - in.Services.DeepCopyInto(&out.Services) - in.Pods.DeepCopyInto(&out.Pods) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterNetworkingConfig. -func (in *ClusterNetworkingConfig) DeepCopy() *ClusterNetworkingConfig { - if in == nil { - return nil - } - out := new(ClusterNetworkingConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { - *out = *in - in.ClusterNetwork.DeepCopyInto(&out.ClusterNetwork) - in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. -func (in *ClusterSpec) DeepCopy() *ClusterSpec { - if in == nil { - return nil - } - out := new(ClusterSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { - *out = *in - if in.APIEndpoints != nil { - in, out := &in.APIEndpoints, &out.APIEndpoints - *out = make([]APIEndpoint, len(*in)) - copy(*out, *in) - } - if in.ProviderStatus != nil { - in, out := &in.ProviderStatus, &out.ProviderStatus - *out = new(runtime.RawExtension) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. -func (in *ClusterStatus) DeepCopy() *ClusterStatus { - if in == nil { - return nil - } - out := new(ClusterStatus) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LastOperation) DeepCopyInto(out *LastOperation) { *out = *in @@ -289,27 +150,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 +472,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 +502,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 +522,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,43 +563,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 - if in.CIDRBlocks != nil { - in, out := &in.CIDRBlocks, &out.CIDRBlocks - *out = make([]string, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkRanges. -func (in *NetworkRanges) DeepCopy() *NetworkRanges { - if in == nil { - return nil - } - out := new(NetworkRanges) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProviderSpec) DeepCopyInto(out *ProviderSpec) { *out = *in @@ -786,11 +571,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 +583,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/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel index be7c3feb1d..bf29a1ab31 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/BUILD.bazel @@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "cluster.go", "doc.go", "generated_expansion.go", "machine.go", diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/cluster.go deleted file mode 100644 index 2947c9b846..0000000000 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/cluster.go +++ /dev/null @@ -1,191 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1beta1 - -import ( - "time" - - v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" - scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// ClustersGetter has a method to return a ClusterInterface. -// A group's client should implement this interface. -type ClustersGetter interface { - Clusters(namespace string) ClusterInterface -} - -// ClusterInterface has methods to work with Cluster resources. -type ClusterInterface interface { - Create(*v1beta1.Cluster) (*v1beta1.Cluster, error) - Update(*v1beta1.Cluster) (*v1beta1.Cluster, error) - UpdateStatus(*v1beta1.Cluster) (*v1beta1.Cluster, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1beta1.Cluster, error) - List(opts v1.ListOptions) (*v1beta1.ClusterList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Cluster, err error) - ClusterExpansion -} - -// clusters implements ClusterInterface -type clusters struct { - client rest.Interface - ns string -} - -// newClusters returns a Clusters -func newClusters(c *MachineV1beta1Client, namespace string) *clusters { - return &clusters{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. -func (c *clusters) Get(name string, options v1.GetOptions) (result *v1beta1.Cluster, err error) { - result = &v1beta1.Cluster{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusters"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of Clusters that match those selectors. -func (c *clusters) List(opts v1.ListOptions) (result *v1beta1.ClusterList, err error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - result = &v1beta1.ClusterList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested clusters. -func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) { - var timeout time.Duration - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&opts, scheme.ParameterCodec). - Timeout(timeout). - Watch() -} - -// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *clusters) Create(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { - result = &v1beta1.Cluster{} - err = c.client.Post(). - Namespace(c.ns). - Resource("clusters"). - Body(cluster). - Do(). - Into(result) - return -} - -// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *clusters) Update(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { - result = &v1beta1.Cluster{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusters"). - Name(cluster.Name). - Body(cluster). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *clusters) UpdateStatus(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { - result = &v1beta1.Cluster{} - err = c.client.Put(). - Namespace(c.ns). - Resource("clusters"). - Name(cluster.Name). - SubResource("status"). - Body(cluster). - Do(). - Into(result) - return -} - -// Delete takes name of the cluster and deletes it. Returns an error if one occurs. -func (c *clusters) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("clusters"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - var timeout time.Duration - if listOptions.TimeoutSeconds != nil { - timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second - } - return c.client.Delete(). - Namespace(c.ns). - Resource("clusters"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Timeout(timeout). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched cluster. -func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Cluster, err error) { - result = &v1beta1.Cluster{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("clusters"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel index 6fcca0ee85..89bc237143 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/BUILD.bazel @@ -4,7 +4,6 @@ go_library( name = "go_default_library", srcs = [ "doc.go", - "fake_cluster.go", "fake_machine.go", "fake_machine_client.go", "fake_machineclass.go", diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_cluster.go deleted file mode 100644 index c1044bd6ab..0000000000 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_cluster.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeClusters implements ClusterInterface -type FakeClusters struct { - Fake *FakeMachineV1beta1 - ns string -} - -var clustersResource = schema.GroupVersionResource{Group: "machine.openshift.io", Version: "v1beta1", Resource: "clusters"} - -var clustersKind = schema.GroupVersionKind{Group: "machine.openshift.io", Version: "v1beta1", Kind: "Cluster"} - -// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. -func (c *FakeClusters) Get(name string, options v1.GetOptions) (result *v1beta1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1beta1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Cluster), err -} - -// List takes label and field selectors, and returns the list of Clusters that match those selectors. -func (c *FakeClusters) List(opts v1.ListOptions) (result *v1beta1.ClusterList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1beta1.ClusterList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1beta1.ClusterList{ListMeta: obj.(*v1beta1.ClusterList).ListMeta} - for _, item := range obj.(*v1beta1.ClusterList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested clusters. -func (c *FakeClusters) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts)) - -} - -// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *FakeClusters) Create(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1beta1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Cluster), err -} - -// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. -func (c *FakeClusters) Update(cluster *v1beta1.Cluster) (result *v1beta1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1beta1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Cluster), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeClusters) UpdateStatus(cluster *v1beta1.Cluster) (*v1beta1.Cluster, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(clustersResource, "status", c.ns, cluster), &v1beta1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Cluster), err -} - -// Delete takes name of the cluster and deletes it. Returns an error if one occurs. -func (c *FakeClusters) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1beta1.Cluster{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeClusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1beta1.ClusterList{}) - return err -} - -// Patch applies the patch and returns the patched cluster. -func (c *FakeClusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Cluster, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, pt, data, subresources...), &v1beta1.Cluster{}) - - if obj == nil { - return nil, err - } - return obj.(*v1beta1.Cluster), err -} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go index c94b1ce47e..8ca4a1eb4d 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/fake/fake_machine_client.go @@ -28,10 +28,6 @@ type FakeMachineV1beta1 struct { *testing.Fake } -func (c *FakeMachineV1beta1) Clusters(namespace string) v1beta1.ClusterInterface { - return &FakeClusters{c, namespace} -} - func (c *FakeMachineV1beta1) Machines(namespace string) v1beta1.MachineInterface { return &FakeMachines{c, namespace} } diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go index e4cc014464..2c3b1dd105 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/generated_expansion.go @@ -18,8 +18,6 @@ limitations under the License. package v1beta1 -type ClusterExpansion interface{} - type MachineExpansion interface{} type MachineClassExpansion interface{} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go index 93e8491575..9401510600 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1/machine_client.go @@ -27,7 +27,6 @@ import ( type MachineV1beta1Interface interface { RESTClient() rest.Interface - ClustersGetter MachinesGetter MachineClassesGetter MachineDeploymentsGetter @@ -39,10 +38,6 @@ type MachineV1beta1Client struct { restClient rest.Interface } -func (c *MachineV1beta1Client) Clusters(namespace string) ClusterInterface { - return newClusters(c, namespace) -} - func (c *MachineV1beta1Client) Machines(namespace string) MachineInterface { return newMachines(c, namespace) } diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go index b26301d595..1f51b6f6f5 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/generic.go @@ -66,8 +66,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().MachineSets().Informer()}, nil // Group=machine.openshift.io, Version=v1beta1 - case v1beta1.SchemeGroupVersion.WithResource("clusters"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().Clusters().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("machines"): return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1beta1().Machines().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("machineclasses"): diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel index 65f99f6c14..e1e05411ba 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/BUILD.bazel @@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "cluster.go", "interface.go", "machine.go", "machineclass.go", diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/cluster.go deleted file mode 100644 index 292c42f02c..0000000000 --- a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/cluster.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1beta1 - -import ( - time "time" - - machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" - clientset "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset" - internalinterfaces "github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/internalinterfaces" - v1beta1 "github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - cache "k8s.io/client-go/tools/cache" -) - -// ClusterInformer provides access to a shared informer and lister for -// Clusters. -type ClusterInformer interface { - Informer() cache.SharedIndexInformer - Lister() v1beta1.ClusterLister -} - -type clusterInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewClusterInformer constructs a new informer for Cluster type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewClusterInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredClusterInformer constructs a new informer for Cluster type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredClusterInformer(client clientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - &cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MachineV1beta1().Clusters(namespace).List(options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.MachineV1beta1().Clusters(namespace).Watch(options) - }, - }, - &machinev1beta1.Cluster{}, - resyncPeriod, - indexers, - ) -} - -func (f *clusterInformer) defaultInformer(client clientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *clusterInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&machinev1beta1.Cluster{}, f.defaultInformer) -} - -func (f *clusterInformer) Lister() v1beta1.ClusterLister { - return v1beta1.NewClusterLister(f.Informer().GetIndexer()) -} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go index 870a0b17b6..33c7c903b3 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/informers_generated/externalversions/machine/v1beta1/interface.go @@ -24,8 +24,6 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // Clusters returns a ClusterInformer. - Clusters() ClusterInformer // Machines returns a MachineInformer. Machines() MachineInformer // MachineClasses returns a MachineClassInformer. @@ -47,11 +45,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// Clusters returns a ClusterInformer. -func (v *version) Clusters() ClusterInformer { - return &clusterInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} - // Machines returns a MachineInformer. func (v *version) Machines() MachineInformer { return &machineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel index dd58545475..7483f79527 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/BUILD.bazel @@ -3,7 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library") go_library( name = "go_default_library", srcs = [ - "cluster.go", "expansion_generated.go", "machine.go", "machineclass.go", diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/cluster.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/cluster.go deleted file mode 100644 index 1a509ddaff..0000000000 --- a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/cluster.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1beta1 - -import ( - v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// ClusterLister helps list Clusters. -type ClusterLister interface { - // List lists all Clusters in the indexer. - List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) - // Clusters returns an object that can list and get Clusters. - Clusters(namespace string) ClusterNamespaceLister - ClusterListerExpansion -} - -// clusterLister implements the ClusterLister interface. -type clusterLister struct { - indexer cache.Indexer -} - -// NewClusterLister returns a new ClusterLister. -func NewClusterLister(indexer cache.Indexer) ClusterLister { - return &clusterLister{indexer: indexer} -} - -// List lists all Clusters in the indexer. -func (s *clusterLister) List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Cluster)) - }) - return ret, err -} - -// Clusters returns an object that can list and get Clusters. -func (s *clusterLister) Clusters(namespace string) ClusterNamespaceLister { - return clusterNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// ClusterNamespaceLister helps list and get Clusters. -type ClusterNamespaceLister interface { - // List lists all Clusters in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) - // Get retrieves the Cluster from the indexer for a given namespace and name. - Get(name string) (*v1beta1.Cluster, error) - ClusterNamespaceListerExpansion -} - -// clusterNamespaceLister implements the ClusterNamespaceLister -// interface. -type clusterNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all Clusters in the indexer for a given namespace. -func (s clusterNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.Cluster, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1beta1.Cluster)) - }) - return ret, err -} - -// Get retrieves the Cluster from the indexer for a given namespace and name. -func (s clusterNamespaceLister) Get(name string) (*v1beta1.Cluster, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1beta1.Resource("cluster"), name) - } - return obj.(*v1beta1.Cluster), nil -} diff --git a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go index 8333c80081..ce5f9aa666 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go +++ b/vendor/github.com/openshift/cluster-api/pkg/client/listers_generated/machine/v1beta1/expansion_generated.go @@ -18,14 +18,6 @@ limitations under the License. package v1beta1 -// ClusterListerExpansion allows custom methods to be added to -// ClusterLister. -type ClusterListerExpansion interface{} - -// ClusterNamespaceListerExpansion allows custom methods to be added to -// ClusterNamespaceLister. -type ClusterNamespaceListerExpansion interface{} - // MachineListerExpansion allows custom methods to be added to // MachineLister. type MachineListerExpansion interface{} 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..20a5e72841 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 @@ -10,6 +10,7 @@ go_library( importpath = "github.com/openshift/cluster-api/pkg/controller/machine", visibility = ["//visibility:public"], deps = [ + "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/error:go_default_library", "//pkg/util:go_default_library", @@ -38,14 +39,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/actuator.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/actuator.go index 6ddd372e64..f66e557d9e 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/actuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/actuator.go @@ -19,6 +19,7 @@ package machine import ( "context" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) @@ -27,13 +28,13 @@ import ( // methods should be idempotent unless otherwise specified. type Actuator interface { // Create the machine. - Create(context.Context, *machinev1.Cluster, *machinev1.Machine) error + Create(context.Context, *clusterv1.Cluster, *machinev1.Machine) error // Delete the machine. If no error is returned, it is assumed that all dependent resources have been cleaned up. - Delete(context.Context, *machinev1.Cluster, *machinev1.Machine) error + Delete(context.Context, *clusterv1.Cluster, *machinev1.Machine) error // Update the machine to the provided definition. - Update(context.Context, *machinev1.Cluster, *machinev1.Machine) error + Update(context.Context, *clusterv1.Cluster, *machinev1.Machine) error // Checks if the machine currently exists. - Exists(context.Context, *machinev1.Cluster, *machinev1.Machine) (bool, error) + Exists(context.Context, *clusterv1.Cluster, *machinev1.Machine) (bool, error) } /// [Actuator] 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 227793a4dc..3809d8673c 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 @@ -23,6 +23,7 @@ import ( "time" "github.com/go-log/log/info" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" controllerError "github.com/openshift/cluster-api/pkg/controller/error" "github.com/openshift/cluster-api/pkg/util" @@ -198,18 +199,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 +236,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 @@ -302,13 +287,13 @@ func (r *ReconcileMachine) drainNode(machine *machinev1.Machine) error { return nil } -func (r *ReconcileMachine) getCluster(ctx context.Context, machine *machinev1.Machine) (*machinev1.Cluster, error) { +func (r *ReconcileMachine) getCluster(ctx context.Context, machine *machinev1.Machine) (*clusterv1.Cluster, error) { if machine.Labels[machinev1.MachineClusterLabelName] == "" { - klog.Infof("Machine %q in namespace %q doesn't specify %q label, assuming nil cluster", machine.Name, machinev1.MachineClusterLabelName, machine.Namespace) + klog.Infof("Machine %q in namespace %q doesn't specify %q label, assuming nil cluster", machine.Name, machine.Namespace, machinev1.MachineClusterLabelName) return nil, nil } - cluster := &machinev1.Cluster{} + cluster := &clusterv1.Cluster{} key := client.ObjectKey{ Namespace: machine.Namespace, Name: machine.Labels[machinev1.MachineClusterLabelName], @@ -354,3 +339,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 +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go index 8198698842..fe3fa1c543 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/testactuator.go @@ -20,6 +20,7 @@ import ( "context" "sync" + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" ) @@ -39,7 +40,7 @@ type TestActuator struct { Lock sync.Mutex } -func (a *TestActuator) Create(context.Context, *v1beta1.Cluster, *v1beta1.Machine) error { +func (a *TestActuator) Create(context.Context, *v1alpha1.Cluster, *v1beta1.Machine) error { defer func() { if a.BlockOnCreate { <-a.unblock @@ -52,7 +53,7 @@ func (a *TestActuator) Create(context.Context, *v1beta1.Cluster, *v1beta1.Machin return nil } -func (a *TestActuator) Delete(context.Context, *v1beta1.Cluster, *v1beta1.Machine) error { +func (a *TestActuator) Delete(context.Context, *v1alpha1.Cluster, *v1beta1.Machine) error { defer func() { if a.BlockOnDelete { <-a.unblock @@ -65,7 +66,7 @@ func (a *TestActuator) Delete(context.Context, *v1beta1.Cluster, *v1beta1.Machin return nil } -func (a *TestActuator) Update(ctx context.Context, c *v1beta1.Cluster, machine *v1beta1.Machine) error { +func (a *TestActuator) Update(ctx context.Context, c *v1alpha1.Cluster, machine *v1beta1.Machine) error { defer func() { if a.BlockOnUpdate { <-a.unblock @@ -77,7 +78,7 @@ func (a *TestActuator) Update(ctx context.Context, c *v1beta1.Cluster, machine * return nil } -func (a *TestActuator) Exists(context.Context, *v1beta1.Cluster, *v1beta1.Machine) (bool, error) { +func (a *TestActuator) Exists(context.Context, *v1alpha1.Cluster, *v1beta1.Machine) (bool, error) { defer func() { if a.BlockOnExists { <-a.unblock diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel index f9e28aada0..b6416e098a 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/BUILD.bazel @@ -10,6 +10,7 @@ go_library( importpath = "github.com/openshift/cluster-api/pkg/controller/machinedeployment", visibility = ["//visibility:public"], deps = [ + "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/apis/machine/common:go_default_library", "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/machinedeployment/util:go_default_library", diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go index 67e9c38941..a97f281188 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machinedeployment/controller.go @@ -20,6 +20,7 @@ import ( "context" "reflect" + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" "github.com/openshift/cluster-api/pkg/apis/machine/common" "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "github.com/openshift/cluster-api/pkg/util" @@ -269,13 +270,13 @@ func (r *ReconcileMachineDeployment) reconcile(ctx context.Context, d *v1beta1.M return reconcile.Result{}, errors.Errorf("unexpected deployment strategy type: %s", d.Spec.Strategy.Type) } -func (r *ReconcileMachineDeployment) getCluster(d *v1beta1.MachineDeployment) (*v1beta1.Cluster, error) { +func (r *ReconcileMachineDeployment) getCluster(d *v1beta1.MachineDeployment) (*v1alpha1.Cluster, error) { if d.Spec.Template.Labels[v1beta1.MachineClusterLabelName] == "" { - klog.Infof("Deployment %q in namespace %q doesn't specify %q label, assuming nil cluster", d.Name, v1beta1.MachineClusterLabelName, d.Namespace) + klog.Infof("Deployment %q in namespace %q doesn't specify %q label, assuming nil cluster", d.Name, d.Namespace, v1beta1.MachineClusterLabelName) return nil, nil } - cluster := &v1beta1.Cluster{} + cluster := &v1alpha1.Cluster{} key := client.ObjectKey{ Namespace: d.Namespace, Name: d.Spec.Template.Labels[v1beta1.MachineClusterLabelName], diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel index 2bc0ed85a6..3ff2333d8b 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/BUILD.bazel @@ -11,6 +11,7 @@ go_library( importpath = "github.com/openshift/cluster-api/pkg/controller/machineset", visibility = ["//visibility:public"], deps = [ + "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/controller/noderefutil:go_default_library", "//pkg/util:go_default_library", diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go index 48d8d3cfaa..6be5f38703 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machineset/controller.go @@ -24,6 +24,7 @@ import ( "sync" "time" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "github.com/openshift/cluster-api/pkg/util" "github.com/pkg/errors" @@ -291,13 +292,13 @@ func (r *ReconcileMachineSet) reconcile(ctx context.Context, machineSet *machine return reconcile.Result{}, nil } -func (r *ReconcileMachineSet) getCluster(ms *machinev1beta1.MachineSet) (*machinev1beta1.Cluster, error) { +func (r *ReconcileMachineSet) getCluster(ms *machinev1beta1.MachineSet) (*clusterv1alpha1.Cluster, error) { if ms.Spec.Template.Labels[machinev1beta1.MachineClusterLabelName] == "" { - klog.Infof("MachineSet %q in namespace %q doesn't specify %q label, assuming nil cluster", ms.Name, machinev1beta1.MachineClusterLabelName, ms.Namespace) + klog.Infof("MachineSet %q in namespace %q doesn't specify %q label, assuming nil cluster", ms.Name, ms.Namespace, machinev1beta1.MachineClusterLabelName) return nil, nil } - cluster := &machinev1beta1.Cluster{} + cluster := &clusterv1alpha1.Cluster{} key := client.ObjectKey{ Namespace: ms.Namespace, Name: ms.Spec.Template.Labels[machinev1beta1.MachineClusterLabelName], diff --git a/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/BUILD.bazel b/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/BUILD.bazel index 57e1ec1b54..3a2b7ca241 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/BUILD.bazel +++ b/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/BUILD.bazel @@ -6,6 +6,7 @@ go_library( importpath = "github.com/openshift/cluster-api/pkg/provider/example/actuators/machine", visibility = ["//visibility:public"], deps = [ + "//pkg/apis/cluster/v1alpha1:go_default_library", "//pkg/apis/machine/v1beta1:go_default_library", "//pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", diff --git a/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/machineactuator.go b/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/machineactuator.go index ff5deffd39..7960fbec41 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/machineactuator.go +++ b/vendor/github.com/openshift/cluster-api/pkg/provider/example/actuators/machine/machineactuator.go @@ -19,7 +19,8 @@ package machine import ( "context" - clusterv1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" clusterv1alpha1 "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" corev1 "k8s.io/api/core/v1" "k8s.io/client-go/tools/record" @@ -40,25 +41,25 @@ func NewMachineActuator(clusterV1alpha1 clusterv1alpha1.ClusterV1alpha1Interface } // Create creates a machine -func (a *Actuator) Create(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { +func (a *Actuator) Create(ctx context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error { a.recorder.Event(machine, corev1.EventTypeWarning, "cluster-api", "machineactuator Create invoked") return nil } // Delete deletes a machine -func (a *Actuator) Delete(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { +func (a *Actuator) Delete(ctx context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error { a.recorder.Event(machine, corev1.EventTypeWarning, "cluster-api", "machineactuator Delete invoked") return nil } // Update updates a machine -func (a *Actuator) Update(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error { +func (a *Actuator) Update(ctx context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error { a.recorder.Event(machine, corev1.EventTypeWarning, "cluster-api", "machineactuator Update invoked") return nil } // Exists test for the existence of a machine -func (a *Actuator) Exists(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (bool, error) { +func (a *Actuator) Exists(ctx context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) (bool, error) { a.recorder.Event(machine, corev1.EventTypeWarning, "cluster-api", "machineactuator Exists invoked") return false, nil }