|
| 1 | +/* |
| 2 | +Copyright 2019 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha2 |
| 18 | + |
| 19 | +import ( |
| 20 | + apiconversion "k8s.io/apimachinery/pkg/conversion" |
| 21 | + kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3" |
| 22 | + "sigs.k8s.io/controller-runtime/pkg/conversion" |
| 23 | +) |
| 24 | + |
| 25 | +// ConvertTo converts this KubeadmConfig to the Hub version (v1alpha3). |
| 26 | +func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { // nolint |
| 27 | + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig) |
| 28 | + return Convert_v1alpha2_KubeadmConfig_To_v1alpha3_KubeadmConfig(src, dst, nil) |
| 29 | +} |
| 30 | + |
| 31 | +// ConvertFrom converts from the KubeadmConfig Hub version (v1alpha3) to this version. |
| 32 | +func (dst *KubeadmConfig) ConvertFrom(srcRaw conversion.Hub) error { // nolint |
| 33 | + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfig) |
| 34 | + return Convert_v1alpha3_KubeadmConfig_To_v1alpha2_KubeadmConfig(src, dst, nil) |
| 35 | +} |
| 36 | + |
| 37 | +// ConvertTo converts this KubeadmConfigList to the Hub version (v1alpha3). |
| 38 | +func (src *KubeadmConfigList) ConvertTo(dstRaw conversion.Hub) error { // nolint |
| 39 | + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList) |
| 40 | + return Convert_v1alpha2_KubeadmConfigList_To_v1alpha3_KubeadmConfigList(src, dst, nil) |
| 41 | +} |
| 42 | + |
| 43 | +// ConvertFrom converts from the KubeadmConfigList Hub version (v1alpha3) to this version. |
| 44 | +func (dst *KubeadmConfigList) ConvertFrom(srcRaw conversion.Hub) error { // nolint |
| 45 | + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigList) |
| 46 | + return Convert_v1alpha3_KubeadmConfigList_To_v1alpha2_KubeadmConfigList(src, dst, nil) |
| 47 | +} |
| 48 | + |
| 49 | +// ConvertTo converts this KubeadmConfigTemplate to the Hub version (v1alpha3). |
| 50 | +func (src *KubeadmConfigTemplate) ConvertTo(dstRaw conversion.Hub) error { // nolint |
| 51 | + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate) |
| 52 | + return Convert_v1alpha2_KubeadmConfigTemplate_To_v1alpha3_KubeadmConfigTemplate(src, dst, nil) |
| 53 | +} |
| 54 | + |
| 55 | +// ConvertFrom converts from the KubeadmConfigTemplate Hub version (v1alpha3) to this version. |
| 56 | +func (dst *KubeadmConfigTemplate) ConvertFrom(srcRaw conversion.Hub) error { // nolint |
| 57 | + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplate) |
| 58 | + return Convert_v1alpha3_KubeadmConfigTemplate_To_v1alpha2_KubeadmConfigTemplate(src, dst, nil) |
| 59 | +} |
| 60 | + |
| 61 | +// ConvertTo converts this KubeadmConfigTemplateList to the Hub version (v1alpha3). |
| 62 | +func (src *KubeadmConfigTemplateList) ConvertTo(dstRaw conversion.Hub) error { // nolint |
| 63 | + dst := dstRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList) |
| 64 | + return Convert_v1alpha2_KubeadmConfigTemplateList_To_v1alpha3_KubeadmConfigTemplateList(src, dst, nil) |
| 65 | +} |
| 66 | + |
| 67 | +// ConvertFrom converts from the KubeadmConfigTemplateList Hub version (v1alpha3) to this version. |
| 68 | +func (dst *KubeadmConfigTemplateList) ConvertFrom(srcRaw conversion.Hub) error { // nolint |
| 69 | + src := srcRaw.(*kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList) |
| 70 | + return Convert_v1alpha3_KubeadmConfigTemplateList_To_v1alpha2_KubeadmConfigTemplateList(src, dst, nil) |
| 71 | +} |
| 72 | + |
| 73 | +// Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus converts this KubeadmConfigStatus to the Hub version (v1alpha3). |
| 74 | +func Convert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *KubeadmConfigStatus, out *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, s apiconversion.Scope) error { // nolint |
| 75 | + if err := autoConvert_v1alpha2_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s); err != nil { |
| 76 | + return err |
| 77 | + } |
| 78 | + |
| 79 | + // Manually convert the Error fields to the Failure fields |
| 80 | + out.FailureMessage = in.ErrorMessage |
| 81 | + out.FailureReason = in.ErrorReason |
| 82 | + |
| 83 | + return nil |
| 84 | +} |
| 85 | + |
| 86 | +// Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus converts from the Hub version (v1alpha3) of the KubeadmConfigStatus to this version. |
| 87 | +func Convert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in *kubeadmbootstrapv1alpha3.KubeadmConfigStatus, out *KubeadmConfigStatus, s apiconversion.Scope) error { // nolint |
| 88 | + if err := autoConvert_v1alpha3_KubeadmConfigStatus_To_v1alpha2_KubeadmConfigStatus(in, out, s); err != nil { |
| 89 | + return err |
| 90 | + } |
| 91 | + |
| 92 | + // Manually convert the Failure fields to the Error fields |
| 93 | + out.ErrorMessage = in.FailureMessage |
| 94 | + out.ErrorReason = in.FailureReason |
| 95 | + |
| 96 | + return nil |
| 97 | +} |
0 commit comments