From 1aaac8e7bf90d1057c22c96df62516bf700ecce3 Mon Sep 17 00:00:00 2001 From: Enxebre Date: Fri, 1 Feb 2019 16:32:30 +0100 Subject: [PATCH 1/2] Revendor for machine.openshift.io --- Gopkg.lock | 28 +- Gopkg.toml | 7 +- .../github.com/openshift/cluster-api/LICENSE | 201 +++++ .../pkg/apis/cluster/common/consts.go | 114 +++ .../pkg/apis/cluster/common/plugins.go | 51 ++ .../apis/cluster/v1alpha1/cluster_types.go | 165 ++++ .../pkg/apis/cluster/v1alpha1/common_types.go | 58 ++ .../pkg/apis/cluster/v1alpha1/defaults.go | 74 ++ .../pkg/apis/cluster/v1alpha1/doc.go | 23 + .../apis/cluster/v1alpha1/machine_types.go | 227 +++++ .../cluster/v1alpha1/machineclass_types.go | 78 ++ .../v1alpha1/machinedeployment_types.go | 194 +++++ .../apis/cluster/v1alpha1/machineset_types.go | 187 ++++ .../pkg/apis/cluster/v1alpha1/register.go | 48 + .../cluster/v1alpha1/zz_generated.deepcopy.go | 821 ++++++++++++++++++ .../pkg/apis/machine/common/consts.go | 114 +++ .../pkg/apis/machine/common/plugins.go | 51 ++ .../pkg/apis/machine/v1beta1/cluster_types.go | 165 ++++ .../pkg/apis/machine/v1beta1/common_types.go | 58 ++ .../pkg/apis/machine/v1beta1/defaults.go | 74 ++ .../pkg/apis/machine/v1beta1/doc.go | 23 + .../pkg/apis/machine/v1beta1/machine_types.go | 227 +++++ .../machine/v1beta1/machineclass_types.go | 78 ++ .../v1beta1/machinedeployment_types.go | 194 +++++ .../apis/machine/v1beta1/machineset_types.go | 187 ++++ .../pkg/apis/machine/v1beta1/register.go | 48 + .../machine/v1beta1/zz_generated.deepcopy.go | 821 ++++++++++++++++++ .../awsproviderconfig/v1alpha1/register.go | 8 +- .../pkg/apis/cluster/common/consts.go | 9 + .../pkg/apis/cluster/common/plugins.go | 4 +- .../apis/cluster/v1alpha1/cluster_types.go | 1 - .../apis/cluster/v1alpha1/machine_types.go | 71 +- .../v1alpha1/machinedeployment_types.go | 1 - .../apis/cluster/v1alpha1/machineset_types.go | 31 +- .../pkg/apis/cluster/v1alpha1/register.go | 5 +- .../cluster/v1alpha1/zz_generated.deepcopy.go | 5 + 36 files changed, 4392 insertions(+), 59 deletions(-) create mode 100644 vendor/github.com/openshift/cluster-api/LICENSE create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/doc.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/register.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/consts.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/defaults.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go create mode 100644 vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go diff --git a/Gopkg.lock b/Gopkg.lock index 3ec7c0ff86e..ab605c22792 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -395,6 +395,18 @@ pruneopts = "NUT" revision = "a7448c816a2ac09a48321432daa7303eb6ff92c9" +[[projects]] + digest = "1:5543d01772b4474e08f1554ea53cf3eb12660deed37470888cfc1cd66748cab0" + name = "github.com/openshift/cluster-api" + packages = [ + "pkg/apis/cluster/common", + "pkg/apis/cluster/v1alpha1", + "pkg/apis/machine/common", + "pkg/apis/machine/v1beta1", + ] + pruneopts = "NUT" + revision = "91fca585a85b163ddfd119fd09c128c9feadddca" + [[projects]] branch = "master" digest = "1:0889fa501ce44d01602f3721bbc52529bfe35469410b34d117c45916d43b1b22" @@ -828,22 +840,21 @@ [[projects]] branch = "master" - digest = "1:032b67ae5a3cd593171814b4f6e659831d4de7885e4aedae9dfb9f2b89d612c0" + digest = "1:b23a1b4063d7b3b60ad82fab0cb72b5048da29f880a3761b4e390cb659a0b11f" name = "sigs.k8s.io/cluster-api" packages = [ "pkg/apis/cluster/common", "pkg/apis/cluster/v1alpha1", ] pruneopts = "NUT" - revision = "59a129bbcaf29aa4354da68a7a8acd2085e4a43a" + revision = "ef6f8fc12d32fc1646f231f6e39dbef59ad2e4dd" [[projects]] - branch = "master" - digest = "1:5ade82a27c5ca576a8aa699320fea3ae5a4d47c95e6a2212191ea31e4c49f27c" + digest = "1:b03dcb1c1d57b36333b0fa402ea776f65ba3b25afce00049fe6497f047aa56f6" name = "sigs.k8s.io/cluster-api-provider-aws" packages = ["pkg/apis/awsproviderconfig/v1alpha1"] pruneopts = "NUT" - revision = "97771a0fe7762b34e80e05c7412f464dcdbbb3e7" + revision = "9a983a5c6c12b27169c57e4c8948cb554e4d6b6c" source = "https://github.com/openshift/cluster-api-provider-aws.git" [[projects]] @@ -860,8 +871,8 @@ name = "sigs.k8s.io/controller-runtime" packages = ["pkg/runtime/scheme"] pruneopts = "NUT" - revision = "5fd1e9e9fac5261e9ad9d47c375afc014fc31d21" - version = "v0.1.7" + revision = "12d98582e72927b6cd0123e2b4e819f9341ce62c" + version = "v0.1.10" [[projects]] digest = "1:8730e0150dfb2b7e173890c8b9868e7a273082ef8e39f4940e3506a481cf895c" @@ -918,6 +929,8 @@ "github.com/openshift/client-go/config/clientset/versioned", "github.com/openshift/client-go/route/clientset/versioned", "github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1alpha1", + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1", + "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1", "github.com/openshift/library-go/pkg/config/clusteroperator/v1helpers", "github.com/pborman/uuid", "github.com/peterbourgon/diskv", @@ -954,7 +967,6 @@ "k8s.io/utils/pointer", "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1", "sigs.k8s.io/cluster-api-provider-openstack/pkg/apis/openstackproviderconfig/v1alpha1", - "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 0aea38fdc7e..c999a67bd55 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -53,12 +53,13 @@ ignored = [ version = "9.0.0" [[constraint]] - name = "sigs.k8s.io/cluster-api" - branch = "master" + name = "github.com/openshift/cluster-api" + revision = "91fca585a85b163ddfd119fd09c128c9feadddca" + [[constraint]] name = "sigs.k8s.io/cluster-api-provider-aws" source = "https://github.com/openshift/cluster-api-provider-aws.git" - branch = "master" + revision = "9a983a5c6c12b27169c57e4c8948cb554e4d6b6c" [[constraint]] name = "github.com/openshift/cluster-api-provider-libvirt" diff --git a/vendor/github.com/openshift/cluster-api/LICENSE b/vendor/github.com/openshift/cluster-api/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go new file mode 100644 index 00000000000..287480250d5 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/consts.go @@ -0,0 +1,114 @@ +/* +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 common + +// Constants aren't automatically generated for unversioned packages. +// Instead share the same constant for all versioned packages +type MachineStatusError string + +const ( + // Represents that the combination of configuration in the MachineSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist, + InvalidConfigurationMachineError MachineStatusError = "InvalidConfiguration" + + // This indicates that the MachineSpec has been updated in a way that + // is not supported for reconciliation on this cluster. The spec may be + // completely valid from a configuration standpoint, but the controller + // does not support changing the real world state to match the new + // spec. + // + // Example: the responsible controller is not capable of changing the + // container runtime from docker to rkt. + UnsupportedChangeMachineError MachineStatusError = "UnsupportedChange" + + // This generally refers to exceeding one's quota in a cloud provider, + // or running out of physical machines in an on-premise environment. + InsufficientResourcesMachineError MachineStatusError = "InsufficientResources" + + // There was an error while trying to create a Node to match this + // Machine. This may indicate a transient problem that will be fixed + // automatically with time, such as a service outage, or a terminal + // error during creation that doesn't match a more specific + // MachineStatusError value. + // + // Example: timeout trying to connect to GCE. + CreateMachineError MachineStatusError = "CreateError" + + // An error was encountered while trying to delete the Node that this + // Machine represents. This could be a transient or terminal error, but + // will only be observable if the provider's Machine controller has + // added a finalizer to the object to more gracefully handle deletions. + // + // Example: cannot resolve EC2 IP address. + DeleteMachineError MachineStatusError = "DeleteError" + + // This error indicates that the machine did not join the cluster + // as a new node within the expected timeframe after instance + // creation at the provider succeeded + // + // Example use case: A controller that deletes Machines which do + // not result in a Node joining the cluster within a given timeout + // and that are managed by a MachineSet + JoinClusterTimeoutMachineError = "JoinClusterTimeoutError" +) + +type ClusterStatusError string + +const ( + // InvalidConfigurationClusterError indicates that the cluster + // configuration is invalid. + InvalidConfigurationClusterError ClusterStatusError = "InvalidConfiguration" + + // UnsupportedChangeClusterError indicates that the cluster + // spec has been updated in an unsupported way. That cannot be + // reconciled. + UnsupportedChangeClusterError ClusterStatusError = "UnsupportedChange" + + // CreateClusterError indicates that an error was encountered + // when trying to create the cluster. + CreateClusterError ClusterStatusError = "CreateError" + + // UpdateClusterError indicates that an error was encountered + // when trying to update the cluster. + UpdateClusterError ClusterStatusError = "UpdateError" + + // DeleteClusterError indicates that an error was encountered + // when trying to delete the cluster. + DeleteClusterError ClusterStatusError = "DeleteError" +) + +type MachineSetStatusError string + +const ( + // Represents that the combination of configuration in the MachineTemplateSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist. + InvalidConfigurationMachineSetError MachineSetStatusError = "InvalidConfiguration" +) + +type MachineDeploymentStrategyType string + +const ( + // Replace the old MachineSet by new one using rolling update + // i.e. gradually scale down the old MachineSet and scale up the new one. + RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go new file mode 100644 index 00000000000..8c2083d88c0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/common/plugins.go @@ -0,0 +1,51 @@ +/* +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 common + +import ( + "sync" + + "github.com/pkg/errors" + "k8s.io/klog" +) + +var ( + providersMutex sync.Mutex + providers = make(map[string]interface{}) +) + +// RegisterClusterProvisioner registers a ClusterProvisioner by name. This +// is expected to happen during app startup. +func RegisterClusterProvisioner(name string, provisioner interface{}) { + providersMutex.Lock() + defer providersMutex.Unlock() + if _, found := providers[name]; found { + klog.Fatalf("Cluster provisioner %q was registered twice", name) + } + klog.V(1).Infof("Registered cluster provisioner %q", name) + providers[name] = provisioner +} + +func ClusterProvisioner(name string) (interface{}, error) { + providersMutex.Lock() + defer providersMutex.Unlock() + provisioner, found := providers[name] + if !found { + return nil, errors.Errorf("unable to find provisioner for %s", name) + } + return provisioner, nil +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go new file mode 100644 index 00000000000..dae8b49cebe --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go @@ -0,0 +1,165 @@ +/* +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/openshift/cluster-api/pkg/apis/cluster/common" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +const ClusterFinalizer = "cluster.cluster.k8s.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/cluster/v1alpha1/common_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go new file mode 100644 index 00000000000..7a9c647fe29 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/common_types.go @@ -0,0 +1,58 @@ +/* +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 v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// ProviderSpec defines the configuration to use during node creation. +type ProviderSpec struct { + + // No more than one of the following may be specified. + + // Value is an inlined, serialized representation of the resource + // configuration. It is recommended that providers maintain their own + // versioned API types that should be serialized/deserialized from this + // 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/cluster/v1alpha1/defaults.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go new file mode 100644 index 00000000000..a64e64ab375 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/defaults.go @@ -0,0 +1,74 @@ +/* +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 v1alpha1 + +import ( + "github.com/openshift/cluster-api/pkg/apis/cluster/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// PopulateDefaultsMachineDeployment fills in default field values +// Currently it is called after reading objects, but it could be called in an admission webhook also +func PopulateDefaultsMachineDeployment(d *MachineDeployment) { + if d.Spec.Replicas == nil { + d.Spec.Replicas = new(int32) + *d.Spec.Replicas = 1 + } + + if d.Spec.MinReadySeconds == nil { + d.Spec.MinReadySeconds = new(int32) + *d.Spec.MinReadySeconds = 0 + } + + if d.Spec.RevisionHistoryLimit == nil { + d.Spec.RevisionHistoryLimit = new(int32) + *d.Spec.RevisionHistoryLimit = 1 + } + + if d.Spec.ProgressDeadlineSeconds == nil { + d.Spec.ProgressDeadlineSeconds = new(int32) + *d.Spec.ProgressDeadlineSeconds = 600 + } + + if d.Spec.Strategy == nil { + d.Spec.Strategy = &MachineDeploymentStrategy{} + } + + if d.Spec.Strategy.Type == "" { + d.Spec.Strategy.Type = common.RollingUpdateMachineDeploymentStrategyType + } + + // Default RollingUpdate strategy only if strategy type is RollingUpdate. + if d.Spec.Strategy.Type == common.RollingUpdateMachineDeploymentStrategyType { + if d.Spec.Strategy.RollingUpdate == nil { + d.Spec.Strategy.RollingUpdate = &MachineRollingUpdateDeployment{} + } + if d.Spec.Strategy.RollingUpdate.MaxSurge == nil { + ios1 := intstr.FromInt(1) + d.Spec.Strategy.RollingUpdate.MaxSurge = &ios1 + } + if d.Spec.Strategy.RollingUpdate.MaxUnavailable == nil { + ios0 := intstr.FromInt(0) + d.Spec.Strategy.RollingUpdate.MaxUnavailable = &ios0 + } + } + + if len(d.Namespace) == 0 { + d.Namespace = metav1.NamespaceDefault + } +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/doc.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/doc.go new file mode 100644 index 00000000000..9bd92e43525 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/doc.go @@ -0,0 +1,23 @@ +/* +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 v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/cluster +// +k8s:defaulter-gen=TypeMeta +// +groupName=cluster.k8s.io +package v1alpha1 diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go new file mode 100644 index 00000000000..6c6cc4a3c25 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go @@ -0,0 +1,227 @@ +/* +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 v1alpha1 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/openshift/cluster-api/pkg/apis/cluster/common" +) + +// Finalizer is set on PrepareForCreate callback +const MachineFinalizer = "machine.cluster.k8s.io" + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [Machine] +// Machine is the Schema for the machines API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +type Machine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSpec `json:"spec,omitempty"` + Status MachineStatus `json:"status,omitempty"` +} + +/// [Machine] + +/// [MachineSpec] +// MachineSpec defines the desired state of Machine +type MachineSpec struct { + // ObjectMeta will autopopulate the Node created. Use this to + // indicate what labels, annotations, name prefix, etc., should be used + // when creating the Node. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Taints is the full, authoritative list of taints to apply to the corresponding + // Node. This list will overwrite any modifications made to the Node on + // an ongoing basis. + // +optional + Taints []corev1.Taint `json:"taints,omitempty"` + + // ProviderSpec details Provider-specific configuration to use during node creation. + // +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"` +} + +/// [MachineSpec] + +/// [MachineStatus] +// MachineStatus defines the observed state of Machine +type MachineStatus struct { + // NodeRef will point to the corresponding Node if it exists. + // +optional + NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` + + // LastUpdated identifies when this status was last observed. + // +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. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` + + // ProviderStatus details a 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"` + + // Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available. + // +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 + // it is still on-going, failed or completed successfully. + // +optional + LastOperation *LastOperation `json:"lastOperation,omitempty"` + + // Phase represents the current phase of machine actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase *string `json:"phase,omitempty"` +} + +// LastOperation represents the detail of the last performed operation on the MachineObject. +type LastOperation struct { + // Description is the human-readable description of the last operation. + Description *string `json:"description,omitempty"` + + // LastUpdated is the timestamp at which LastOperation API was last-updated. + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + + // State is the current status of the last performed operation. + // E.g. Processing, Failed, Successful etc + State *string `json:"state,omitempty"` + + // Type is the type of operation which was last performed. + // E.g. Create, Delete, Update etc + 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] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineList contains a list of Machine +type MachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Machine `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Machine{}, &MachineList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go new file mode 100644 index 00000000000..7844f6cfa46 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineclass_types.go @@ -0,0 +1,78 @@ +/* +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineClass] +// MachineClass can be used to templatize and re-use provider configuration +// across multiple Machines / MachineSets / MachineDeployments. +// +k8s:openapi-gen=true +// +resource:path=machineclasses +type MachineClass struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The total capacity available on this machine type (cpu/memory/disk). + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Capacity corev1.ResourceList `json:"capacity"` + + // How much capacity is actually allocatable on this machine. + // Must be equal to or less than the capacity, and when less + // indicates the resources reserved for system overhead. + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Allocatable corev1.ResourceList `json:"allocatable"` + + // Provider-specific configuration to use during node creation. + ProviderSpec runtime.RawExtension `json:"providerSpec"` + + // TODO: should this use an api.ObjectReference to a 'MachineTemplate' instead? + // A link to the MachineTemplate that will be used to create provider + // specific configuration for Machines of this class. + // MachineTemplate corev1.ObjectReference `json:machineTemplate` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineClassList contains a list of MachineClasses +type MachineClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineClass `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineClass{}, &MachineClassList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go new file mode 100644 index 00000000000..be0cc25ff6d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go @@ -0,0 +1,194 @@ +/* +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + + "github.com/openshift/cluster-api/pkg/apis/cluster/common" +) + +/// [MachineDeploymentSpec] +// MachineDeploymentSpec defines the desired state of MachineDeployment +type MachineDeploymentSpec struct { + // Number of desired machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + Replicas *int32 `json:"replicas,omitempty"` + + // Label selector for machines. Existing MachineSets whose machines are + // selected by this will be the ones affected by this deployment. + // It must match the machine template's labels. + Selector metav1.LabelSelector `json:"selector"` + + // Template describes the machines that will be created. + Template MachineTemplateSpec `json:"template"` + + // The deployment strategy to use to replace existing machines with + // new ones. + // +optional + Strategy *MachineDeploymentStrategy `json:"strategy,omitempty"` + + // Minimum number of seconds for which a newly created machine should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + // +optional + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + + // The number of old MachineSets to retain to allow rollback. + // This is a pointer to distinguish between explicit zero and not specified. + // Defaults to 1. + // +optional + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + + // Indicates that the deployment is paused. + // +optional + Paused bool `json:"paused,omitempty"` + + // The maximum time in seconds for a deployment to make progress before it + // is considered to be failed. The deployment controller will continue to + // process failed deployments and a condition with a ProgressDeadlineExceeded + // reason will be surfaced in the deployment status. Note that progress will + // not be estimated during the time a deployment is paused. Defaults to 600s. + ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"` +} + +/// [MachineDeploymentSpec] + +/// [MachineDeploymentStrategy] +// MachineDeploymentStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentStrategy struct { + // Type of deployment. Currently the only supported strategy is + // "RollingUpdate". + // Default is RollingUpdate. + // +optional + Type common.MachineDeploymentStrategyType `json:"type,omitempty"` + + // Rolling update config params. Present only if + // MachineDeploymentStrategyType = RollingUpdate. + // +optional + RollingUpdate *MachineRollingUpdateDeployment `json:"rollingUpdate,omitempty"` +} + +/// [MachineDeploymentStrategy] + +/// [MachineRollingUpdateDeployment] +// Spec to control the desired behavior of rolling update. +type MachineRollingUpdateDeployment struct { + // The maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + // +optional + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"` + + // The maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + // +optional + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"` +} + +/// [MachineRollingUpdateDeployment] + +/// [MachineDeploymentStatus] +// MachineDeploymentStatus defines the observed state of MachineDeployment +type MachineDeploymentStatus struct { + // The generation observed by the deployment controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` + + // Total number of non-terminated machines targeted by this deployment + // (their labels match the selector). + // +optional + Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` + + // Total number of non-terminated machines targeted by this deployment + // that have the desired template spec. + // +optional + UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"` + + // Total number of ready machines targeted by this deployment. + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"` + + // Total number of available machines (ready for at least minReadySeconds) + // targeted by this deployment. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"` + + // Total number of unavailable machines targeted by this deployment. + // This is the total number of machines that are still required for + // the deployment to have 100% available capacity. They may either + // be machines that are running but not yet available or machines + // that still have not been created. + // +optional + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` +} + +/// [MachineDeploymentStatus] + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineDeployment] +// MachineDeployment is the Schema for the machinedeployments API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineDeployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineDeploymentSpec `json:"spec,omitempty"` + Status MachineDeploymentStatus `json:"status,omitempty"` +} + +/// [MachineDeployment] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineDeploymentList contains a list of MachineDeployment +type MachineDeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineDeployment `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineDeployment{}, &MachineDeploymentList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go new file mode 100644 index 00000000000..95644395ace --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go @@ -0,0 +1,187 @@ +/* +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 v1alpha1 + +import ( + "log" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + + "github.com/openshift/cluster-api/pkg/apis/cluster/common" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineSet] +// MachineSet ensures that a specified number of machines replicas are running at any given time. +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSetSpec `json:"spec,omitempty"` + Status MachineSetStatus `json:"status,omitempty"` +} + +/// [MachineSet] + +/// [MachineSetSpec] +// MachineSetSpec defines the desired state of MachineSet +type MachineSetSpec struct { + // Replicas is the number of desired replicas. + // This is a pointer to distinguish between explicit zero and unspecified. + // Defaults to 1. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // MinReadySeconds is the minimum number of seconds for which a newly created machine should be ready. + // Defaults to 0 (machine will be considered available as soon as it is ready) + // +optional + MinReadySeconds int32 `json:"minReadySeconds,omitempty"` + + // Selector is a label query over machines that should match the replica count. + // Label keys and values that must match in order to be controlled by this MachineSet. + // It must match the machine template's labels. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector metav1.LabelSelector `json:"selector"` + + // Template is the object that describes the machine that will be created if + // insufficient replicas are detected. + // +optional + Template MachineTemplateSpec `json:"template,omitempty"` +} + +/// [MachineSetSpec] // doxygen marker + +/// [MachineTemplateSpec] // doxygen marker +// MachineTemplateSpec describes the data needed to create a Machine from a template +type MachineTemplateSpec struct { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Specification of the desired behavior of the machine. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec MachineSpec `json:"spec,omitempty"` +} + +/// [MachineTemplateSpec] + +/// [MachineSetStatus] +// MachineSetStatus defines the observed state of MachineSet +type MachineSetStatus struct { + // Replicas is the most recently observed number of replicas. + Replicas int32 `json:"replicas"` + + // The number of replicas that have labels matching the labels of the machine template of the MachineSet. + // +optional + FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty"` + + // The number of ready replicas for this MachineSet. A machine is considered ready when the node has been created and is "Ready". + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // The number of available replicas (ready for at least minReadySeconds) for this MachineSet. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty"` + + // ObservedGeneration reflects the generation of the most recently observed MachineSet. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // In the event that there is a terminal problem reconciling the + // replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + // will be populated with a succinct value suitable for machine + // interpretation, while ErrorMessage will contain a more verbose + // string suitable for logging and human consumption. + // + // These fields should not be set for transitive errors that a + // controller faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the MachineTemplate's spec or the configuration of + // the machine controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the machine controller, or the + // responsible machine controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the MachineSet object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineSetStatusError `json:"errorReason,omitempty"` + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +/// [MachineSetStatus] + +func (machineSet *MachineSet) Validate() field.ErrorList { + errors := field.ErrorList{} + + // validate spec.selector and spec.template.labels + fldPath := field.NewPath("spec") + errors = append(errors, metav1validation.ValidateLabelSelector(&machineSet.Spec.Selector, fldPath.Child("selector"))...) + if len(machineSet.Spec.Selector.MatchLabels)+len(machineSet.Spec.Selector.MatchExpressions) == 0 { + errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "empty selector is not valid for MachineSet.")) + } + selector, err := metav1.LabelSelectorAsSelector(&machineSet.Spec.Selector) + if err != nil { + errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "invalid label selector.")) + } else { + labels := labels.Set(machineSet.Spec.Template.Labels) + if !selector.Matches(labels) { + errors = append(errors, field.Invalid(fldPath.Child("template", "metadata", "labels"), machineSet.Spec.Template.Labels, "`selector` does not match template `labels`")) + } + } + + return errors +} + +// DefaultingFunction sets default MachineSet field values +func (obj *MachineSet) Default() { + log.Printf("Defaulting fields for MachineSet %s\n", obj.Name) + + if obj.Spec.Replicas == nil { + obj.Spec.Replicas = new(int32) + *obj.Spec.Replicas = 1 + } + + if len(obj.Namespace) == 0 { + obj.Namespace = metav1.NamespaceDefault + } +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineSetList contains a list of MachineSet +type MachineSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineSet{}, &MachineSetList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/register.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/register.go new file mode 100644 index 00000000000..d4b8529670d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/register.go @@ -0,0 +1,48 @@ +/* +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. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1alpha1 contains API Schema definitions for the cluster v1alpha1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/cluster +// +k8s:defaulter-gen=TypeMeta +// +groupName=cluster.k8s.io +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "cluster.k8s.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // Required by pkg/client/... + // TODO(pwittrock): Remove this after removing pkg/client/... + AddToScheme = SchemeBuilder.AddToScheme +) + +// Required by pkg/client/listers/... +// TODO(pwittrock): Remove this after removing pkg/client/... +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..fd8e1f63a9c --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,821 @@ +// +build !ignore_autogenerated + +/* +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 main. DO NOT EDIT. + +package v1alpha1 + +import ( + common "github.com/openshift/cluster-api/pkg/apis/cluster/common" + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + 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 + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastOperation. +func (in *LastOperation) DeepCopy() *LastOperation { + if in == nil { + return nil + } + out := new(LastOperation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Machine) DeepCopyInto(out *Machine) { + *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 Machine. +func (in *Machine) DeepCopy() *Machine { + if in == nil { + return nil + } + out := new(Machine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Machine) 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 *MachineClass) DeepCopyInto(out *MachineClass) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClass. +func (in *MachineClass) DeepCopy() *MachineClass { + if in == nil { + return nil + } + out := new(MachineClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClass) 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 *MachineClassList) DeepCopyInto(out *MachineClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassList. +func (in *MachineClassList) DeepCopy() *MachineClassList { + if in == nil { + return nil + } + out := new(MachineClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClassList) 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 *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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeployment. +func (in *MachineDeployment) DeepCopy() *MachineDeployment { + if in == nil { + return nil + } + out := new(MachineDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeployment) 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 *MachineDeploymentList) DeepCopyInto(out *MachineDeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineDeployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentList. +func (in *MachineDeploymentList) DeepCopy() *MachineDeploymentList { + if in == nil { + return nil + } + out := new(MachineDeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeploymentList) 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 *MachineDeploymentSpec) DeepCopyInto(out *MachineDeploymentSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + if in.Strategy != nil { + in, out := &in.Strategy, &out.Strategy + *out = new(MachineDeploymentStrategy) + (*in).DeepCopyInto(*out) + } + if in.MinReadySeconds != nil { + in, out := &in.MinReadySeconds, &out.MinReadySeconds + *out = new(int32) + **out = **in + } + if in.RevisionHistoryLimit != nil { + in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit + *out = new(int32) + **out = **in + } + if in.ProgressDeadlineSeconds != nil { + in, out := &in.ProgressDeadlineSeconds, &out.ProgressDeadlineSeconds + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentSpec. +func (in *MachineDeploymentSpec) DeepCopy() *MachineDeploymentSpec { + if in == nil { + return nil + } + out := new(MachineDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStatus. +func (in *MachineDeploymentStatus) DeepCopy() *MachineDeploymentStatus { + if in == nil { + return nil + } + out := new(MachineDeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStrategy) DeepCopyInto(out *MachineDeploymentStrategy) { + *out = *in + if in.RollingUpdate != nil { + in, out := &in.RollingUpdate, &out.RollingUpdate + *out = new(MachineRollingUpdateDeployment) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStrategy. +func (in *MachineDeploymentStrategy) DeepCopy() *MachineDeploymentStrategy { + if in == nil { + return nil + } + out := new(MachineDeploymentStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineList) DeepCopyInto(out *MachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineList. +func (in *MachineList) DeepCopy() *MachineList { + if in == nil { + return nil + } + out := new(MachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineList) 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 *MachineRollingUpdateDeployment) DeepCopyInto(out *MachineRollingUpdateDeployment) { + *out = *in + if in.MaxUnavailable != nil { + in, out := &in.MaxUnavailable, &out.MaxUnavailable + *out = new(intstr.IntOrString) + **out = **in + } + if in.MaxSurge != nil { + in, out := &in.MaxSurge, &out.MaxSurge + *out = new(intstr.IntOrString) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRollingUpdateDeployment. +func (in *MachineRollingUpdateDeployment) DeepCopy() *MachineRollingUpdateDeployment { + if in == nil { + return nil + } + out := new(MachineRollingUpdateDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSet) DeepCopyInto(out *MachineSet) { + *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 MachineSet. +func (in *MachineSet) DeepCopy() *MachineSet { + if in == nil { + return nil + } + out := new(MachineSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSet) 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 *MachineSetList) DeepCopyInto(out *MachineSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetList. +func (in *MachineSetList) DeepCopy() *MachineSetList { + if in == nil { + return nil + } + out := new(MachineSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSetList) 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 *MachineSetSpec) DeepCopyInto(out *MachineSetSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetSpec. +func (in *MachineSetSpec) DeepCopy() *MachineSetSpec { + if in == nil { + return nil + } + out := new(MachineSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { + *out = *in + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + *out = new(common.MachineSetStatusError) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetStatus. +func (in *MachineSetStatus) DeepCopy() *MachineSetStatus { + if in == nil { + return nil + } + out := new(MachineSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Taints != nil { + in, out := &in.Taints, &out.Taints + *out = make([]v1.Taint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSpec. +func (in *MachineSpec) DeepCopy() *MachineSpec { + if in == nil { + return nil + } + out := new(MachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { + *out = *in + if in.NodeRef != nil { + in, out := &in.NodeRef, &out.NodeRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.LastUpdated != nil { + 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) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *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) + (*in).DeepCopyInto(*out) + } + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. +func (in *MachineStatus) DeepCopy() *MachineStatus { + if in == nil { + return nil + } + out := new(MachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineTemplateSpec) DeepCopyInto(out *MachineTemplateSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplateSpec. +func (in *MachineTemplateSpec) DeepCopy() *MachineTemplateSpec { + if in == nil { + return nil + } + out := new(MachineTemplateSpec) + in.DeepCopyInto(out) + 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 + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(ProviderSpecSource) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpec. +func (in *ProviderSpec) DeepCopy() *ProviderSpec { + if in == nil { + return nil + } + out := new(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/apis/machine/common/consts.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/consts.go new file mode 100644 index 00000000000..287480250d5 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/consts.go @@ -0,0 +1,114 @@ +/* +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 common + +// Constants aren't automatically generated for unversioned packages. +// Instead share the same constant for all versioned packages +type MachineStatusError string + +const ( + // Represents that the combination of configuration in the MachineSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist, + InvalidConfigurationMachineError MachineStatusError = "InvalidConfiguration" + + // This indicates that the MachineSpec has been updated in a way that + // is not supported for reconciliation on this cluster. The spec may be + // completely valid from a configuration standpoint, but the controller + // does not support changing the real world state to match the new + // spec. + // + // Example: the responsible controller is not capable of changing the + // container runtime from docker to rkt. + UnsupportedChangeMachineError MachineStatusError = "UnsupportedChange" + + // This generally refers to exceeding one's quota in a cloud provider, + // or running out of physical machines in an on-premise environment. + InsufficientResourcesMachineError MachineStatusError = "InsufficientResources" + + // There was an error while trying to create a Node to match this + // Machine. This may indicate a transient problem that will be fixed + // automatically with time, such as a service outage, or a terminal + // error during creation that doesn't match a more specific + // MachineStatusError value. + // + // Example: timeout trying to connect to GCE. + CreateMachineError MachineStatusError = "CreateError" + + // An error was encountered while trying to delete the Node that this + // Machine represents. This could be a transient or terminal error, but + // will only be observable if the provider's Machine controller has + // added a finalizer to the object to more gracefully handle deletions. + // + // Example: cannot resolve EC2 IP address. + DeleteMachineError MachineStatusError = "DeleteError" + + // This error indicates that the machine did not join the cluster + // as a new node within the expected timeframe after instance + // creation at the provider succeeded + // + // Example use case: A controller that deletes Machines which do + // not result in a Node joining the cluster within a given timeout + // and that are managed by a MachineSet + JoinClusterTimeoutMachineError = "JoinClusterTimeoutError" +) + +type ClusterStatusError string + +const ( + // InvalidConfigurationClusterError indicates that the cluster + // configuration is invalid. + InvalidConfigurationClusterError ClusterStatusError = "InvalidConfiguration" + + // UnsupportedChangeClusterError indicates that the cluster + // spec has been updated in an unsupported way. That cannot be + // reconciled. + UnsupportedChangeClusterError ClusterStatusError = "UnsupportedChange" + + // CreateClusterError indicates that an error was encountered + // when trying to create the cluster. + CreateClusterError ClusterStatusError = "CreateError" + + // UpdateClusterError indicates that an error was encountered + // when trying to update the cluster. + UpdateClusterError ClusterStatusError = "UpdateError" + + // DeleteClusterError indicates that an error was encountered + // when trying to delete the cluster. + DeleteClusterError ClusterStatusError = "DeleteError" +) + +type MachineSetStatusError string + +const ( + // Represents that the combination of configuration in the MachineTemplateSpec + // is not supported by this cluster. This is not a transient error, but + // indicates a state that must be fixed before progress can be made. + // + // Example: the ProviderSpec specifies an instance type that doesn't exist. + InvalidConfigurationMachineSetError MachineSetStatusError = "InvalidConfiguration" +) + +type MachineDeploymentStrategyType string + +const ( + // Replace the old MachineSet by new one using rolling update + // i.e. gradually scale down the old MachineSet and scale up the new one. + RollingUpdateMachineDeploymentStrategyType MachineDeploymentStrategyType = "RollingUpdate" +) diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go new file mode 100644 index 00000000000..8c2083d88c0 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/common/plugins.go @@ -0,0 +1,51 @@ +/* +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 common + +import ( + "sync" + + "github.com/pkg/errors" + "k8s.io/klog" +) + +var ( + providersMutex sync.Mutex + providers = make(map[string]interface{}) +) + +// RegisterClusterProvisioner registers a ClusterProvisioner by name. This +// is expected to happen during app startup. +func RegisterClusterProvisioner(name string, provisioner interface{}) { + providersMutex.Lock() + defer providersMutex.Unlock() + if _, found := providers[name]; found { + klog.Fatalf("Cluster provisioner %q was registered twice", name) + } + klog.V(1).Infof("Registered cluster provisioner %q", name) + providers[name] = provisioner +} + +func ClusterProvisioner(name string) (interface{}, error) { + providersMutex.Lock() + defer providersMutex.Unlock() + provisioner, found := providers[name] + if !found { + return nil, errors.Errorf("unable to find provisioner for %s", name) + } + return provisioner, nil +} 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 new file mode 100644 index 00000000000..134a63abb61 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/cluster_types.go @@ -0,0 +1,165 @@ +/* +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 new file mode 100644 index 00000000000..7884754101d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/common_types.go @@ -0,0 +1,58 @@ +/* +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 ( + corev1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// ProviderSpec defines the configuration to use during node creation. +type ProviderSpec struct { + + // No more than one of the following may be specified. + + // Value is an inlined, serialized representation of the resource + // configuration. It is recommended that providers maintain their own + // versioned API types that should be serialized/deserialized from this + // 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/defaults.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/defaults.go new file mode 100644 index 00000000000..354cfa3f6ea --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/defaults.go @@ -0,0 +1,74 @@ +/* +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 ( + "github.com/openshift/cluster-api/pkg/apis/machine/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +// PopulateDefaultsMachineDeployment fills in default field values +// Currently it is called after reading objects, but it could be called in an admission webhook also +func PopulateDefaultsMachineDeployment(d *MachineDeployment) { + if d.Spec.Replicas == nil { + d.Spec.Replicas = new(int32) + *d.Spec.Replicas = 1 + } + + if d.Spec.MinReadySeconds == nil { + d.Spec.MinReadySeconds = new(int32) + *d.Spec.MinReadySeconds = 0 + } + + if d.Spec.RevisionHistoryLimit == nil { + d.Spec.RevisionHistoryLimit = new(int32) + *d.Spec.RevisionHistoryLimit = 1 + } + + if d.Spec.ProgressDeadlineSeconds == nil { + d.Spec.ProgressDeadlineSeconds = new(int32) + *d.Spec.ProgressDeadlineSeconds = 600 + } + + if d.Spec.Strategy == nil { + d.Spec.Strategy = &MachineDeploymentStrategy{} + } + + if d.Spec.Strategy.Type == "" { + d.Spec.Strategy.Type = common.RollingUpdateMachineDeploymentStrategyType + } + + // Default RollingUpdate strategy only if strategy type is RollingUpdate. + if d.Spec.Strategy.Type == common.RollingUpdateMachineDeploymentStrategyType { + if d.Spec.Strategy.RollingUpdate == nil { + d.Spec.Strategy.RollingUpdate = &MachineRollingUpdateDeployment{} + } + if d.Spec.Strategy.RollingUpdate.MaxSurge == nil { + ios1 := intstr.FromInt(1) + d.Spec.Strategy.RollingUpdate.MaxSurge = &ios1 + } + if d.Spec.Strategy.RollingUpdate.MaxUnavailable == nil { + ios0 := intstr.FromInt(0) + d.Spec.Strategy.RollingUpdate.MaxUnavailable = &ios0 + } + } + + if len(d.Namespace) == 0 { + d.Namespace = metav1.NamespaceDefault + } +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go new file mode 100644 index 00000000000..ca985dc5b93 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/doc.go @@ -0,0 +1,23 @@ +/* +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 contains API Schema definitions for the machine v1beta1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/machine +// +k8s:defaulter-gen=TypeMeta +// +groupName=machine.openshift.io +package v1beta1 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 new file mode 100644 index 00000000000..657d7aeeaa3 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machine_types.go @@ -0,0 +1,227 @@ +/* +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 ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" +) + +// Finalizer is set on PrepareForCreate callback +const MachineFinalizer = "machine.machine.openshift.io" + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [Machine] +// Machine is the Schema for the machines API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +type Machine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSpec `json:"spec,omitempty"` + Status MachineStatus `json:"status,omitempty"` +} + +/// [Machine] + +/// [MachineSpec] +// MachineSpec defines the desired state of Machine +type MachineSpec struct { + // ObjectMeta will autopopulate the Node created. Use this to + // indicate what labels, annotations, name prefix, etc., should be used + // when creating the Node. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Taints is the full, authoritative list of taints to apply to the corresponding + // Node. This list will overwrite any modifications made to the Node on + // an ongoing basis. + // +optional + Taints []corev1.Taint `json:"taints,omitempty"` + + // ProviderSpec details Provider-specific configuration to use during node creation. + // +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"` +} + +/// [MachineSpec] + +/// [MachineStatus] +// MachineStatus defines the observed state of Machine +type MachineStatus struct { + // NodeRef will point to the corresponding Node if it exists. + // +optional + NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` + + // LastUpdated identifies when this status was last observed. + // +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. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` + + // ProviderStatus details a 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"` + + // Addresses is a list of addresses assigned to the machine. Queried from cloud provider, if available. + // +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 + // it is still on-going, failed or completed successfully. + // +optional + LastOperation *LastOperation `json:"lastOperation,omitempty"` + + // Phase represents the current phase of machine actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase *string `json:"phase,omitempty"` +} + +// LastOperation represents the detail of the last performed operation on the MachineObject. +type LastOperation struct { + // Description is the human-readable description of the last operation. + Description *string `json:"description,omitempty"` + + // LastUpdated is the timestamp at which LastOperation API was last-updated. + LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` + + // State is the current status of the last performed operation. + // E.g. Processing, Failed, Successful etc + State *string `json:"state,omitempty"` + + // Type is the type of operation which was last performed. + // E.g. Create, Delete, Update etc + 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] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineList contains a list of Machine +type MachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Machine `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Machine{}, &MachineList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go new file mode 100644 index 00000000000..85a1ea37d0e --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineclass_types.go @@ -0,0 +1,78 @@ +/* +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" +) + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineClass] +// MachineClass can be used to templatize and re-use provider configuration +// across multiple Machines / MachineSets / MachineDeployments. +// +k8s:openapi-gen=true +// +resource:path=machineclasses +type MachineClass struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // The total capacity available on this machine type (cpu/memory/disk). + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Capacity corev1.ResourceList `json:"capacity"` + + // How much capacity is actually allocatable on this machine. + // Must be equal to or less than the capacity, and when less + // indicates the resources reserved for system overhead. + // + // WARNING: It is up to the creator of the MachineClass to ensure that + // this field is consistent with the underlying machine that will + // be provisioned when this class is used, to inform higher level + // automation (e.g. the cluster autoscaler). + // TODO(hardikdr) Add allocatable field once requirements are clear from autoscaler-clusterapi // integration topic. + // Allocatable corev1.ResourceList `json:"allocatable"` + + // Provider-specific configuration to use during node creation. + ProviderSpec runtime.RawExtension `json:"providerSpec"` + + // TODO: should this use an api.ObjectReference to a 'MachineTemplate' instead? + // A link to the MachineTemplate that will be used to create provider + // specific configuration for Machines of this class. + // MachineTemplate corev1.ObjectReference `json:machineTemplate` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineClassList contains a list of MachineClasses +type MachineClassList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineClass `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineClass{}, &MachineClassList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go new file mode 100644 index 00000000000..8e892ecc07f --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machinedeployment_types.go @@ -0,0 +1,194 @@ +/* +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/util/intstr" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" +) + +/// [MachineDeploymentSpec] +// MachineDeploymentSpec defines the desired state of MachineDeployment +type MachineDeploymentSpec struct { + // Number of desired machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + Replicas *int32 `json:"replicas,omitempty"` + + // Label selector for machines. Existing MachineSets whose machines are + // selected by this will be the ones affected by this deployment. + // It must match the machine template's labels. + Selector metav1.LabelSelector `json:"selector"` + + // Template describes the machines that will be created. + Template MachineTemplateSpec `json:"template"` + + // The deployment strategy to use to replace existing machines with + // new ones. + // +optional + Strategy *MachineDeploymentStrategy `json:"strategy,omitempty"` + + // Minimum number of seconds for which a newly created machine should + // be ready. + // Defaults to 0 (machine will be considered available as soon as it + // is ready) + // +optional + MinReadySeconds *int32 `json:"minReadySeconds,omitempty"` + + // The number of old MachineSets to retain to allow rollback. + // This is a pointer to distinguish between explicit zero and not specified. + // Defaults to 1. + // +optional + RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty"` + + // Indicates that the deployment is paused. + // +optional + Paused bool `json:"paused,omitempty"` + + // The maximum time in seconds for a deployment to make progress before it + // is considered to be failed. The deployment controller will continue to + // process failed deployments and a condition with a ProgressDeadlineExceeded + // reason will be surfaced in the deployment status. Note that progress will + // not be estimated during the time a deployment is paused. Defaults to 600s. + ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty"` +} + +/// [MachineDeploymentSpec] + +/// [MachineDeploymentStrategy] +// MachineDeploymentStrategy describes how to replace existing machines +// with new ones. +type MachineDeploymentStrategy struct { + // Type of deployment. Currently the only supported strategy is + // "RollingUpdate". + // Default is RollingUpdate. + // +optional + Type common.MachineDeploymentStrategyType `json:"type,omitempty"` + + // Rolling update config params. Present only if + // MachineDeploymentStrategyType = RollingUpdate. + // +optional + RollingUpdate *MachineRollingUpdateDeployment `json:"rollingUpdate,omitempty"` +} + +/// [MachineDeploymentStrategy] + +/// [MachineRollingUpdateDeployment] +// Spec to control the desired behavior of rolling update. +type MachineRollingUpdateDeployment struct { + // The maximum number of machines that can be unavailable during the update. + // Value can be an absolute number (ex: 5) or a percentage of desired + // machines (ex: 10%). + // Absolute number is calculated from percentage by rounding down. + // This can not be 0 if MaxSurge is 0. + // Defaults to 0. + // Example: when this is set to 30%, the old MachineSet can be scaled + // down to 70% of desired machines immediately when the rolling update + // starts. Once new machines are ready, old MachineSet can be scaled + // down further, followed by scaling up the new MachineSet, ensuring + // that the total number of machines available at all times + // during the update is at least 70% of desired machines. + // +optional + MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"` + + // The maximum number of machines that can be scheduled above the + // desired number of machines. + // Value can be an absolute number (ex: 5) or a percentage of + // desired machines (ex: 10%). + // This can not be 0 if MaxUnavailable is 0. + // Absolute number is calculated from percentage by rounding up. + // Defaults to 1. + // Example: when this is set to 30%, the new MachineSet can be scaled + // up immediately when the rolling update starts, such that the total + // number of old and new machines do not exceed 130% of desired + // machines. Once old machines have been killed, new MachineSet can + // be scaled up further, ensuring that total number of machines running + // at any time during the update is at most 130% of desired machines. + // +optional + MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"` +} + +/// [MachineRollingUpdateDeployment] + +/// [MachineDeploymentStatus] +// MachineDeploymentStatus defines the observed state of MachineDeployment +type MachineDeploymentStatus struct { + // The generation observed by the deployment controller. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` + + // Total number of non-terminated machines targeted by this deployment + // (their labels match the selector). + // +optional + Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"` + + // Total number of non-terminated machines targeted by this deployment + // that have the desired template spec. + // +optional + UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"` + + // Total number of ready machines targeted by this deployment. + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"` + + // Total number of available machines (ready for at least minReadySeconds) + // targeted by this deployment. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"` + + // Total number of unavailable machines targeted by this deployment. + // This is the total number of machines that are still required for + // the deployment to have 100% available capacity. They may either + // be machines that are running but not yet available or machines + // that still have not been created. + // +optional + UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"` +} + +/// [MachineDeploymentStatus] + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineDeployment] +// MachineDeployment is the Schema for the machinedeployments API +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineDeployment struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineDeploymentSpec `json:"spec,omitempty"` + Status MachineDeploymentStatus `json:"status,omitempty"` +} + +/// [MachineDeployment] + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineDeploymentList contains a list of MachineDeployment +type MachineDeploymentList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineDeployment `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineDeployment{}, &MachineDeploymentList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go new file mode 100644 index 00000000000..ee810bc94d6 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/machineset_types.go @@ -0,0 +1,187 @@ +/* +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 ( + "log" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" + + "github.com/openshift/cluster-api/pkg/apis/machine/common" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +/// [MachineSet] +// MachineSet ensures that a specified number of machines replicas are running at any given time. +// +k8s:openapi-gen=true +// +kubebuilder:subresource:status +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +type MachineSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec MachineSetSpec `json:"spec,omitempty"` + Status MachineSetStatus `json:"status,omitempty"` +} + +/// [MachineSet] + +/// [MachineSetSpec] +// MachineSetSpec defines the desired state of MachineSet +type MachineSetSpec struct { + // Replicas is the number of desired replicas. + // This is a pointer to distinguish between explicit zero and unspecified. + // Defaults to 1. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // MinReadySeconds is the minimum number of seconds for which a newly created machine should be ready. + // Defaults to 0 (machine will be considered available as soon as it is ready) + // +optional + MinReadySeconds int32 `json:"minReadySeconds,omitempty"` + + // Selector is a label query over machines that should match the replica count. + // Label keys and values that must match in order to be controlled by this MachineSet. + // It must match the machine template's labels. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors + Selector metav1.LabelSelector `json:"selector"` + + // Template is the object that describes the machine that will be created if + // insufficient replicas are detected. + // +optional + Template MachineTemplateSpec `json:"template,omitempty"` +} + +/// [MachineSetSpec] // doxygen marker + +/// [MachineTemplateSpec] // doxygen marker +// MachineTemplateSpec describes the data needed to create a Machine from a template +type MachineTemplateSpec struct { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Specification of the desired behavior of the machine. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status + // +optional + Spec MachineSpec `json:"spec,omitempty"` +} + +/// [MachineTemplateSpec] + +/// [MachineSetStatus] +// MachineSetStatus defines the observed state of MachineSet +type MachineSetStatus struct { + // Replicas is the most recently observed number of replicas. + Replicas int32 `json:"replicas"` + + // The number of replicas that have labels matching the labels of the machine template of the MachineSet. + // +optional + FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty"` + + // The number of ready replicas for this MachineSet. A machine is considered ready when the node has been created and is "Ready". + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // The number of available replicas (ready for at least minReadySeconds) for this MachineSet. + // +optional + AvailableReplicas int32 `json:"availableReplicas,omitempty"` + + // ObservedGeneration reflects the generation of the most recently observed MachineSet. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // In the event that there is a terminal problem reconciling the + // replicas, both ErrorReason and ErrorMessage will be set. ErrorReason + // will be populated with a succinct value suitable for machine + // interpretation, while ErrorMessage will contain a more verbose + // string suitable for logging and human consumption. + // + // These fields should not be set for transitive errors that a + // controller faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the MachineTemplate's spec or the configuration of + // the machine controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the machine controller, or the + // responsible machine controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the MachineSet object and/or logged in the + // controller's output. + // +optional + ErrorReason *common.MachineSetStatusError `json:"errorReason,omitempty"` + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +/// [MachineSetStatus] + +func (machineSet *MachineSet) Validate() field.ErrorList { + errors := field.ErrorList{} + + // validate spec.selector and spec.template.labels + fldPath := field.NewPath("spec") + errors = append(errors, metav1validation.ValidateLabelSelector(&machineSet.Spec.Selector, fldPath.Child("selector"))...) + if len(machineSet.Spec.Selector.MatchLabels)+len(machineSet.Spec.Selector.MatchExpressions) == 0 { + errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "empty selector is not valid for MachineSet.")) + } + selector, err := metav1.LabelSelectorAsSelector(&machineSet.Spec.Selector) + if err != nil { + errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "invalid label selector.")) + } else { + labels := labels.Set(machineSet.Spec.Template.Labels) + if !selector.Matches(labels) { + errors = append(errors, field.Invalid(fldPath.Child("template", "metadata", "labels"), machineSet.Spec.Template.Labels, "`selector` does not match template `labels`")) + } + } + + return errors +} + +// DefaultingFunction sets default MachineSet field values +func (obj *MachineSet) Default() { + log.Printf("Defaulting fields for MachineSet %s\n", obj.Name) + + if obj.Spec.Replicas == nil { + obj.Spec.Replicas = new(int32) + *obj.Spec.Replicas = 1 + } + + if len(obj.Namespace) == 0 { + obj.Namespace = metav1.NamespaceDefault + } +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MachineSetList contains a list of MachineSet +type MachineSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []MachineSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(&MachineSet{}, &MachineSetList{}) +} diff --git a/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go new file mode 100644 index 00000000000..5062825dc8d --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/register.go @@ -0,0 +1,48 @@ +/* +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. +*/ + +// NOTE: Boilerplate only. Ignore this file. + +// Package v1beta1 contains API Schema definitions for the machine v1beta1 API group +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=sigs.k8s.io/cluster-api/pkg/apis/machine +// +k8s:defaulter-gen=TypeMeta +// +groupName=machine.openshift.io +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "machine.openshift.io", Version: "v1beta1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + + // Required by pkg/client/... + // TODO(pwittrock): Remove this after removing pkg/client/... + AddToScheme = SchemeBuilder.AddToScheme +) + +// Required by pkg/client/listers/... +// TODO(pwittrock): Remove this after removing pkg/client/... +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} 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 new file mode 100644 index 00000000000..ab6e3a58796 --- /dev/null +++ b/vendor/github.com/openshift/cluster-api/pkg/apis/machine/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,821 @@ +// +build !ignore_autogenerated + +/* +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 main. DO NOT EDIT. + +package v1beta1 + +import ( + common "github.com/openshift/cluster-api/pkg/apis/machine/common" + v1 "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + 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 + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.LastUpdated != nil { + in, out := &in.LastUpdated, &out.LastUpdated + *out = (*in).DeepCopy() + } + if in.State != nil { + in, out := &in.State, &out.State + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastOperation. +func (in *LastOperation) DeepCopy() *LastOperation { + if in == nil { + return nil + } + out := new(LastOperation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Machine) DeepCopyInto(out *Machine) { + *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 Machine. +func (in *Machine) DeepCopy() *Machine { + if in == nil { + return nil + } + out := new(Machine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Machine) 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 *MachineClass) DeepCopyInto(out *MachineClass) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.ProviderSpec.DeepCopyInto(&out.ProviderSpec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClass. +func (in *MachineClass) DeepCopy() *MachineClass { + if in == nil { + return nil + } + out := new(MachineClass) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClass) 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 *MachineClassList) DeepCopyInto(out *MachineClassList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineClass, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineClassList. +func (in *MachineClassList) DeepCopy() *MachineClassList { + if in == nil { + return nil + } + out := new(MachineClassList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineClassList) 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 *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 + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeployment. +func (in *MachineDeployment) DeepCopy() *MachineDeployment { + if in == nil { + return nil + } + out := new(MachineDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeployment) 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 *MachineDeploymentList) DeepCopyInto(out *MachineDeploymentList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineDeployment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentList. +func (in *MachineDeploymentList) DeepCopy() *MachineDeploymentList { + if in == nil { + return nil + } + out := new(MachineDeploymentList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineDeploymentList) 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 *MachineDeploymentSpec) DeepCopyInto(out *MachineDeploymentSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + if in.Strategy != nil { + in, out := &in.Strategy, &out.Strategy + *out = new(MachineDeploymentStrategy) + (*in).DeepCopyInto(*out) + } + if in.MinReadySeconds != nil { + in, out := &in.MinReadySeconds, &out.MinReadySeconds + *out = new(int32) + **out = **in + } + if in.RevisionHistoryLimit != nil { + in, out := &in.RevisionHistoryLimit, &out.RevisionHistoryLimit + *out = new(int32) + **out = **in + } + if in.ProgressDeadlineSeconds != nil { + in, out := &in.ProgressDeadlineSeconds, &out.ProgressDeadlineSeconds + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentSpec. +func (in *MachineDeploymentSpec) DeepCopy() *MachineDeploymentSpec { + if in == nil { + return nil + } + out := new(MachineDeploymentSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStatus. +func (in *MachineDeploymentStatus) DeepCopy() *MachineDeploymentStatus { + if in == nil { + return nil + } + out := new(MachineDeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentStrategy) DeepCopyInto(out *MachineDeploymentStrategy) { + *out = *in + if in.RollingUpdate != nil { + in, out := &in.RollingUpdate, &out.RollingUpdate + *out = new(MachineRollingUpdateDeployment) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStrategy. +func (in *MachineDeploymentStrategy) DeepCopy() *MachineDeploymentStrategy { + if in == nil { + return nil + } + out := new(MachineDeploymentStrategy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineList) DeepCopyInto(out *MachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Machine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineList. +func (in *MachineList) DeepCopy() *MachineList { + if in == nil { + return nil + } + out := new(MachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineList) 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 *MachineRollingUpdateDeployment) DeepCopyInto(out *MachineRollingUpdateDeployment) { + *out = *in + if in.MaxUnavailable != nil { + in, out := &in.MaxUnavailable, &out.MaxUnavailable + *out = new(intstr.IntOrString) + **out = **in + } + if in.MaxSurge != nil { + in, out := &in.MaxSurge, &out.MaxSurge + *out = new(intstr.IntOrString) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineRollingUpdateDeployment. +func (in *MachineRollingUpdateDeployment) DeepCopy() *MachineRollingUpdateDeployment { + if in == nil { + return nil + } + out := new(MachineRollingUpdateDeployment) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSet) DeepCopyInto(out *MachineSet) { + *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 MachineSet. +func (in *MachineSet) DeepCopy() *MachineSet { + if in == nil { + return nil + } + out := new(MachineSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSet) 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 *MachineSetList) DeepCopyInto(out *MachineSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetList. +func (in *MachineSetList) DeepCopy() *MachineSetList { + if in == nil { + return nil + } + out := new(MachineSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MachineSetList) 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 *MachineSetSpec) DeepCopyInto(out *MachineSetSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Selector.DeepCopyInto(&out.Selector) + in.Template.DeepCopyInto(&out.Template) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetSpec. +func (in *MachineSetSpec) DeepCopy() *MachineSetSpec { + if in == nil { + return nil + } + out := new(MachineSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { + *out = *in + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + *out = new(common.MachineSetStatusError) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetStatus. +func (in *MachineSetStatus) DeepCopy() *MachineSetStatus { + if in == nil { + return nil + } + out := new(MachineSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Taints != nil { + in, out := &in.Taints, &out.Taints + *out = make([]v1.Taint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + 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) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSpec. +func (in *MachineSpec) DeepCopy() *MachineSpec { + if in == nil { + return nil + } + out := new(MachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { + *out = *in + if in.NodeRef != nil { + in, out := &in.NodeRef, &out.NodeRef + *out = new(v1.ObjectReference) + **out = **in + } + if in.LastUpdated != nil { + 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) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } + if in.ProviderStatus != nil { + in, out := &in.ProviderStatus, &out.ProviderStatus + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *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) + (*in).DeepCopyInto(*out) + } + if in.Phase != nil { + in, out := &in.Phase, &out.Phase + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. +func (in *MachineStatus) DeepCopy() *MachineStatus { + if in == nil { + return nil + } + out := new(MachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineTemplateSpec) DeepCopyInto(out *MachineTemplateSpec) { + *out = *in + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineTemplateSpec. +func (in *MachineTemplateSpec) DeepCopy() *MachineTemplateSpec { + if in == nil { + return nil + } + out := new(MachineTemplateSpec) + in.DeepCopyInto(out) + 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 + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(runtime.RawExtension) + (*in).DeepCopyInto(*out) + } + if in.ValueFrom != nil { + in, out := &in.ValueFrom, &out.ValueFrom + *out = new(ProviderSpecSource) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProviderSpec. +func (in *ProviderSpec) DeepCopy() *ProviderSpec { + if in == nil { + return nil + } + out := new(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/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go index 298aa7e27f8..1217f5baa8b 100644 --- a/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go +++ b/vendor/sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1/register.go @@ -28,10 +28,10 @@ import ( "bytes" "fmt" + machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/runtime/scheme" ) @@ -74,7 +74,7 @@ func NewCodec() (*AWSProviderConfigCodec, error) { } // DecodeProviderSpec deserialises an object from the provider config -func (codec *AWSProviderConfigCodec) DecodeProviderSpec(providerSpec *clusterv1.ProviderSpec, out runtime.Object) error { +func (codec *AWSProviderConfigCodec) DecodeProviderSpec(providerSpec *machinev1.ProviderSpec, out runtime.Object) error { if providerSpec.Value != nil { _, _, err := codec.decoder.Decode(providerSpec.Value.Raw, nil, out) if err != nil { @@ -85,12 +85,12 @@ func (codec *AWSProviderConfigCodec) DecodeProviderSpec(providerSpec *clusterv1. } // EncodeProviderSpec serialises an object to the provider config -func (codec *AWSProviderConfigCodec) EncodeProviderSpec(in runtime.Object) (*clusterv1.ProviderSpec, error) { +func (codec *AWSProviderConfigCodec) EncodeProviderSpec(in runtime.Object) (*machinev1.ProviderSpec, error) { var buf bytes.Buffer if err := codec.encoder.Encode(in, &buf); err != nil { return nil, fmt.Errorf("encoding failed: %v", err) } - return &clusterv1.ProviderSpec{ + return &machinev1.ProviderSpec{ Value: &runtime.RawExtension{Raw: buf.Bytes()}, }, nil } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go index 81fed067fe1..287480250d5 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/consts.go @@ -58,6 +58,15 @@ const ( // // Example: cannot resolve EC2 IP address. DeleteMachineError MachineStatusError = "DeleteError" + + // This error indicates that the machine did not join the cluster + // as a new node within the expected timeframe after instance + // creation at the provider succeeded + // + // Example use case: A controller that deletes Machines which do + // not result in a Node joining the cluster within a given timeout + // and that are managed by a MachineSet + JoinClusterTimeoutMachineError = "JoinClusterTimeoutError" ) type ClusterStatusError string diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go index 276cbe9be55..8c2083d88c0 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common/plugins.go @@ -17,9 +17,9 @@ limitations under the License. package common import ( - "fmt" "sync" + "github.com/pkg/errors" "k8s.io/klog" ) @@ -45,7 +45,7 @@ func ClusterProvisioner(name string) (interface{}, error) { defer providersMutex.Unlock() provisioner, found := providers[name] if !found { - return nil, fmt.Errorf("unable to find provisioner for %s", name) + return nil, errors.Errorf("unable to find provisioner for %s", name) } return provisioner, nil } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go index c0cd29a46b9..69bf422db18 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/cluster_types.go @@ -19,7 +19,6 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/validation/field" "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go index 5a10bba39fb..02df8c021e1 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machine_types.go @@ -20,7 +20,6 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) @@ -47,19 +46,19 @@ type Machine struct { /// [MachineSpec] // MachineSpec defines the desired state of Machine type MachineSpec struct { - // This ObjectMeta will autopopulate the Node created. Use this to + // ObjectMeta will autopopulate the Node created. Use this to // indicate what labels, annotations, name prefix, etc., should be used // when creating the Node. // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - // The full, authoritative list of taints to apply to the corresponding + // Taints is the full, authoritative list of taints to apply to the corresponding // Node. This list will overwrite any modifications made to the Node on // an ongoing basis. // +optional Taints []corev1.Taint `json:"taints,omitempty"` - // Provider-specific configuration to use during node creation. + // ProviderSpec details Provider-specific configuration to use during node creation. // +optional ProviderSpec ProviderSpec `json:"providerSpec"` @@ -72,13 +71,26 @@ type MachineSpec struct { // +optional Versions MachineVersionInfo `json:"versions,omitempty"` - // To populate in the associated Node for dynamic kubelet config. This + // 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 + // with cluster-api as provider. Clean-up login in the autoscaler compares machines v/s nodes to find out + // machines at provider which could not get registered as Kubernetes nodes. With cluster-api as a + // generic out-of-tree provider for autoscaler, this field is required by autoscaler to be + // able to have a provider view of the list of machines. Another list of nodes is queries from the k8s apiserver + // and then comparison is done to find out unregistered machines and are marked for delete. + // This field will be set by the actuators and consumed by higher level entities like autoscaler who will + // be interfacing with cluster-api as generic provider. + // +optional + ProviderID *string `json:"providerID,omitempty"` } /// [MachineSpec] @@ -86,15 +98,15 @@ type MachineSpec struct { /// [MachineStatus] // MachineStatus defines the observed state of Machine type MachineStatus struct { - // If the corresponding Node exists, this will point to its object. + // NodeRef will point to the corresponding Node if it exists. // +optional NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` - // When was this status last observed + // LastUpdated identifies when this status was last observed. // +optional LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` - // The current versions of software on the corresponding Node (if it + // 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 @@ -104,20 +116,18 @@ type MachineStatus struct { // 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 ControlPlane + // 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"` - // In the event that there is a terminal problem reconciling the - // Machine, both ErrorReason and ErrorMessage will be set. ErrorReason - // will be populated with a succinct value suitable for machine - // interpretation, while ErrorMessage will contain a more verbose - // string suitable for logging and human consumption. + // 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. // - // These fields should not be set for transitive errors that a - // controller faces that are expected to be fixed automatically over + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over // time (like service outages), but instead indicate that something is // fundamentally wrong with the Machine's spec or the configuration of // the controller, and that manual intervention is required. Examples @@ -130,10 +140,27 @@ type MachineStatus struct { // controller's output. // +optional ErrorReason *common.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. // +optional ErrorMessage *string `json:"errorMessage,omitempty"` - // Provider-specific status. + // ProviderStatus details a Provider-specific status. // It is recommended that providers maintain their // own versioned API types that should be // serialized/deserialized from this field. @@ -144,7 +171,7 @@ type MachineStatus struct { // +optional Addresses []corev1.NodeAddress `json:"addresses,omitempty"` - // List of conditions synced from the node conditions of the corresponding node-object. + // 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. @@ -170,7 +197,7 @@ type LastOperation struct { // Description is the human-readable description of the last operation. Description *string `json:"description,omitempty"` - // LastUpdateTime is the timestamp at which LastOperation API was last-updated. + // LastUpdated is the timestamp at which LastOperation API was last-updated. LastUpdated *metav1.Time `json:"lastUpdated,omitempty"` // State is the current status of the last performed operation. @@ -186,12 +213,12 @@ type LastOperation struct { /// [MachineVersionInfo] type MachineVersionInfo struct { - // Semantic version of kubelet to run + // Kubelet is the semantic version of kubelet to run Kubelet string `json:"kubelet"` - // Semantic version of the Kubernetes control plane to + // ControlPlane is the semantic version of the Kubernetes control plane to // run. This should only be populated when the machine is a - // master. + // control plane. // +optional ControlPlane string `json:"controlPlane,omitempty"` } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go index 690d095ad04..d685318ff8f 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machinedeployment_types.go @@ -19,7 +19,6 @@ package v1alpha1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" ) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go index 40c04286a3c..ded876889c3 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/machineset_types.go @@ -21,7 +21,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation" - "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/validation/field" "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" @@ -137,22 +136,22 @@ type MachineSetStatus struct { /// [MachineSetStatus] -func (machineSet *MachineSet) Validate() field.ErrorList { +func (m *MachineSet) Validate() field.ErrorList { errors := field.ErrorList{} // validate spec.selector and spec.template.labels fldPath := field.NewPath("spec") - errors = append(errors, metav1validation.ValidateLabelSelector(&machineSet.Spec.Selector, fldPath.Child("selector"))...) - if len(machineSet.Spec.Selector.MatchLabels)+len(machineSet.Spec.Selector.MatchExpressions) == 0 { - errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "empty selector is not valid for MachineSet.")) + errors = append(errors, metav1validation.ValidateLabelSelector(&m.Spec.Selector, fldPath.Child("selector"))...) + if len(m.Spec.Selector.MatchLabels)+len(m.Spec.Selector.MatchExpressions) == 0 { + errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "empty selector is not valid for MachineSet.")) } - selector, err := metav1.LabelSelectorAsSelector(&machineSet.Spec.Selector) + selector, err := metav1.LabelSelectorAsSelector(&m.Spec.Selector) if err != nil { - errors = append(errors, field.Invalid(fldPath.Child("selector"), machineSet.Spec.Selector, "invalid label selector.")) + errors = append(errors, field.Invalid(fldPath.Child("selector"), m.Spec.Selector, "invalid label selector.")) } else { - labels := labels.Set(machineSet.Spec.Template.Labels) + labels := labels.Set(m.Spec.Template.Labels) if !selector.Matches(labels) { - errors = append(errors, field.Invalid(fldPath.Child("template", "metadata", "labels"), machineSet.Spec.Template.Labels, "`selector` does not match template `labels`")) + errors = append(errors, field.Invalid(fldPath.Child("template", "metadata", "labels"), m.Spec.Template.Labels, "`selector` does not match template `labels`")) } } @@ -160,16 +159,16 @@ func (machineSet *MachineSet) Validate() field.ErrorList { } // DefaultingFunction sets default MachineSet field values -func (obj *MachineSet) Default() { - log.Printf("Defaulting fields for MachineSet %s\n", obj.Name) +func (m *MachineSet) Default() { + log.Printf("Defaulting fields for MachineSet %s\n", m.Name) - if obj.Spec.Replicas == nil { - obj.Spec.Replicas = new(int32) - *obj.Spec.Replicas = 1 + if m.Spec.Replicas == nil { + m.Spec.Replicas = new(int32) + *m.Spec.Replicas = 1 } - if len(obj.Namespace) == 0 { - obj.Namespace = metav1.NamespaceDefault + if len(m.Namespace) == 0 { + m.Namespace = metav1.NamespaceDefault } } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go index d4b8529670d..2456af99e9f 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/register.go @@ -30,12 +30,13 @@ import ( ) var ( - // SchemeGroupVersion is group version used to register these objects + // SchemeGroupVersion is group version used to register these objects. SchemeGroupVersion = schema.GroupVersion{Group: "cluster.k8s.io", Version: "v1alpha1"} - // SchemeBuilder is used to add go types to the GroupVersionKind scheme + // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} + // AddToScheme adds registered types to the builder. // Required by pkg/client/... // TODO(pwittrock): Remove this after removing pkg/client/... AddToScheme = SchemeBuilder.AddToScheme diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go index 9b0a0352080..643a51be65c 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1/zz_generated.deepcopy.go @@ -638,6 +638,11 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = new(v1.NodeConfigSource) (*in).DeepCopyInto(*out) } + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } return } From cf60daa1bdcc0de911ba2487cd1211b7171c1f22 Mon Sep 17 00:00:00 2001 From: Enxebre Date: Fri, 1 Feb 2019 16:36:00 +0100 Subject: [PATCH 2/2] Pivot aws from cluster.k8s.io into machine.openshift.io We are mirroring the cluster API types under machine.openshift.io group. For the sake of transparency we are making this explicit in the import path. We aim to consilidate back with upstream once there's a relase of the API stable enough --- pkg/asset/machines/aws/machines.go | 16 ++++++++-------- pkg/asset/machines/aws/machinesets.go | 18 +++++++++--------- pkg/asset/machines/master.go | 20 +++++++++++++++++--- pkg/asset/machines/worker.go | 20 +++++++++++++++++--- 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/pkg/asset/machines/aws/machines.go b/pkg/asset/machines/aws/machines.go index 916fd59ae09..4c1029a2014 100644 --- a/pkg/asset/machines/aws/machines.go +++ b/pkg/asset/machines/aws/machines.go @@ -4,6 +4,7 @@ package aws import ( "fmt" + machineapi "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -11,14 +12,13 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/utils/pointer" awsprovider "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1alpha1" - clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "github.com/openshift/installer/pkg/types" "github.com/openshift/installer/pkg/types/aws" ) // Machines returns a list of machines for a machinepool. -func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]clusterapi.Machine, error) { +func Machines(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]machineapi.Machine, error) { if configPlatform := config.Platform.Name(); configPlatform != aws.Name { return nil, fmt.Errorf("non-AWS configuration: %q", configPlatform) } @@ -34,16 +34,16 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine if pool.Replicas != nil { total = *pool.Replicas } - var machines []clusterapi.Machine + var machines []machineapi.Machine for idx := int64(0); idx < total; idx++ { azIndex := int(idx) % len(azs) provider, err := provider(clusterID, clustername, platform, mpool, osImage, azIndex, role, userDataSecret) if err != nil { return nil, errors.Wrap(err, "failed to create provider") } - machine := clusterapi.Machine{ + machine := machineapi.Machine{ TypeMeta: metav1.TypeMeta{ - APIVersion: "cluster.k8s.io/v1alpha1", + APIVersion: "machine.openshift.io/v1beta1", Kind: "Machine", }, ObjectMeta: metav1.ObjectMeta{ @@ -55,8 +55,8 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine "sigs.k8s.io/cluster-api-machine-type": role, }, }, - Spec: clusterapi.MachineSpec{ - ProviderSpec: clusterapi.ProviderSpec{ + Spec: machineapi.MachineSpec{ + ProviderSpec: machineapi.ProviderSpec{ Value: &runtime.RawExtension{Object: provider}, }, // we don't need to set Versions, because we control those via operators. @@ -130,7 +130,7 @@ func tagsFromUserTags(clusterID, clusterName string, usertags map[string]string) } // ConfigMasters sets the PublicIP flag and assigns a set of load balancers to the given machines -func ConfigMasters(machines []clusterapi.Machine, clusterName string) { +func ConfigMasters(machines []machineapi.Machine, clusterName string) { for _, machine := range machines { providerSpec := machine.Spec.ProviderSpec.Value.Object.(*awsprovider.AWSMachineProviderConfig) providerSpec.PublicIP = pointer.BoolPtr(true) diff --git a/pkg/asset/machines/aws/machinesets.go b/pkg/asset/machines/aws/machinesets.go index 8c181bd440a..60c057c4c94 100644 --- a/pkg/asset/machines/aws/machinesets.go +++ b/pkg/asset/machines/aws/machinesets.go @@ -4,9 +4,9 @@ package aws import ( "fmt" + machineapi "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - clusterapi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" "github.com/openshift/installer/pkg/types" "github.com/openshift/installer/pkg/types/aws" @@ -14,7 +14,7 @@ import ( ) // MachineSets returns a list of machinesets for a machinepool. -func MachineSets(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]clusterapi.MachineSet, error) { +func MachineSets(clusterID string, config *types.InstallConfig, pool *types.MachinePool, osImage, role, userDataSecret string) ([]machineapi.MachineSet, error) { if configPlatform := config.Platform.Name(); configPlatform != aws.Name { return nil, fmt.Errorf("non-AWS configuration: %q", configPlatform) } @@ -31,7 +31,7 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach total = *pool.Replicas } numOfAZs := int64(len(azs)) - var machinesets []clusterapi.MachineSet + var machinesets []machineapi.MachineSet for idx, az := range azs { replicas := int32(total / numOfAZs) if int64(idx) < total%numOfAZs { @@ -43,9 +43,9 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach return nil, errors.Wrap(err, "failed to create provider") } name := fmt.Sprintf("%s-%s-%s", clustername, pool.Name, az) - mset := clusterapi.MachineSet{ + mset := machineapi.MachineSet{ TypeMeta: metav1.TypeMeta{ - APIVersion: "cluster.k8s.io/v1alpha1", + APIVersion: "machine.openshift.io/v1beta1", Kind: "MachineSet", }, ObjectMeta: metav1.ObjectMeta{ @@ -57,7 +57,7 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach "sigs.k8s.io/cluster-api-machine-type": role, }, }, - Spec: clusterapi.MachineSetSpec{ + Spec: machineapi.MachineSetSpec{ Replicas: &replicas, Selector: metav1.LabelSelector{ MatchLabels: map[string]string{ @@ -65,7 +65,7 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach "sigs.k8s.io/cluster-api-cluster": clustername, }, }, - Template: clusterapi.MachineTemplateSpec{ + Template: machineapi.MachineTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "sigs.k8s.io/cluster-api-machineset": name, @@ -74,8 +74,8 @@ func MachineSets(clusterID string, config *types.InstallConfig, pool *types.Mach "sigs.k8s.io/cluster-api-machine-type": role, }, }, - Spec: clusterapi.MachineSpec{ - ProviderSpec: clusterapi.ProviderSpec{ + Spec: machineapi.MachineSpec{ + ProviderSpec: machineapi.ProviderSpec{ Value: &runtime.RawExtension{Object: provider}, }, // we don't need to set Versions, because we control those via cluster operators. diff --git a/pkg/asset/machines/master.go b/pkg/asset/machines/master.go index 609f53e67ef..17cad9b98f6 100644 --- a/pkg/asset/machines/master.go +++ b/pkg/asset/machines/master.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/ghodss/yaml" + machineapi "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -104,7 +105,7 @@ func (m *Master) Generate(dependencies asset.Parents) error { return errors.Wrap(err, "failed to create master machine objects") } - list := listFromMachines(machines) + list := listFromMachinesDeprecated(machines) raw, err := yaml.Marshal(list) if err != nil { return errors.Wrap(err, "failed to marshal") @@ -127,7 +128,7 @@ func (m *Master) Generate(dependencies asset.Parents) error { } openstack.ConfigMasters(machines, ic.ObjectMeta.Name) - list := listFromMachines(machines) + list := listFromMachinesDeprecated(machines) m.MachinesRaw, err = yaml.Marshal(list) if err != nil { return errors.Wrap(err, "failed to marshal") @@ -148,7 +149,20 @@ func masterPool(pools []types.MachinePool) types.MachinePool { return types.MachinePool{} } -func listFromMachines(objs []clusterapi.Machine) *metav1.List { +func listFromMachines(objs []machineapi.Machine) *metav1.List { + list := &metav1.List{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "List", + }, + } + for idx := range objs { + list.Items = append(list.Items, runtime.RawExtension{Object: &objs[idx]}) + } + return list +} + +func listFromMachinesDeprecated(objs []clusterapi.Machine) *metav1.List { list := &metav1.List{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", diff --git a/pkg/asset/machines/worker.go b/pkg/asset/machines/worker.go index fc0c612d42b..e2667ea8ccb 100644 --- a/pkg/asset/machines/worker.go +++ b/pkg/asset/machines/worker.go @@ -6,6 +6,7 @@ import ( "text/template" "github.com/ghodss/yaml" + machineapi "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -124,7 +125,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error { return errors.Wrap(err, "failed to create worker machine objects") } - list := listFromMachineSets(sets) + list := listFromMachineDeprecated(sets) raw, err := yaml.Marshal(list) if err != nil { return errors.Wrap(err, "failed to marshal") @@ -146,7 +147,7 @@ func (w *Worker) Generate(dependencies asset.Parents) error { return errors.Wrap(err, "failed to create master machine objects") } - list := listFromMachineSets(sets) + list := listFromMachineDeprecated(sets) w.MachineSetRaw, err = yaml.Marshal(list) if err != nil { return errors.Wrap(err, "failed to marshal") @@ -174,7 +175,20 @@ func applyTemplateData(template *template.Template, templateData interface{}) [] return buf.Bytes() } -func listFromMachineSets(objs []clusterapi.MachineSet) *metav1.List { +func listFromMachineSets(objs []machineapi.MachineSet) *metav1.List { + list := &metav1.List{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "List", + }, + } + for idx := range objs { + list.Items = append(list.Items, runtime.RawExtension{Object: &objs[idx]}) + } + return list +} + +func listFromMachineDeprecated(objs []clusterapi.MachineSet) *metav1.List { list := &metav1.List{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1",