sigs.k8s.io/cluster-api@v1.7.1/bootstrap/kubeadm/types/upstreamv1beta3/conversion.go (about)

     1  /*
     2  Copyright 2021 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 upstreamv1beta3
    18  
    19  import (
    20  	apimachineryconversion "k8s.io/apimachinery/pkg/conversion"
    21  	"sigs.k8s.io/controller-runtime/pkg/conversion"
    22  
    23  	bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
    24  )
    25  
    26  // ConvertTo converts this ClusterConfiguration to the Hub version (v1alpha4).
    27  func (src *ClusterConfiguration) ConvertTo(dstRaw conversion.Hub) error {
    28  	dst := dstRaw.(*bootstrapv1.ClusterConfiguration)
    29  	return Convert_upstreamv1beta3_ClusterConfiguration_To_v1beta1_ClusterConfiguration(src, dst, nil)
    30  }
    31  
    32  // ConvertFrom converts from the ClusterConfiguration Hub version (v1alpha4) to this version.
    33  func (dst *ClusterConfiguration) ConvertFrom(srcRaw conversion.Hub) error {
    34  	src := srcRaw.(*bootstrapv1.ClusterConfiguration)
    35  	return Convert_v1beta1_ClusterConfiguration_To_upstreamv1beta3_ClusterConfiguration(src, dst, nil)
    36  }
    37  
    38  // ConvertTo converts this InitConfiguration to the Hub version (v1alpha4).
    39  func (src *InitConfiguration) ConvertTo(dstRaw conversion.Hub) error {
    40  	dst := dstRaw.(*bootstrapv1.InitConfiguration)
    41  	return Convert_upstreamv1beta3_InitConfiguration_To_v1beta1_InitConfiguration(src, dst, nil)
    42  }
    43  
    44  // ConvertFrom converts from the InitConfiguration Hub version (v1alpha4) to this version.
    45  func (dst *InitConfiguration) ConvertFrom(srcRaw conversion.Hub) error {
    46  	src := srcRaw.(*bootstrapv1.InitConfiguration)
    47  	return Convert_v1beta1_InitConfiguration_To_upstreamv1beta3_InitConfiguration(src, dst, nil)
    48  }
    49  
    50  // ConvertTo converts this JoinConfiguration to the Hub version (v1alpha4).
    51  func (src *JoinConfiguration) ConvertTo(dstRaw conversion.Hub) error {
    52  	dst := dstRaw.(*bootstrapv1.JoinConfiguration)
    53  	return Convert_upstreamv1beta3_JoinConfiguration_To_v1beta1_JoinConfiguration(src, dst, nil)
    54  }
    55  
    56  // ConvertFrom converts from the JoinConfiguration Hub version (v1alpha4) to this version.
    57  func (dst *JoinConfiguration) ConvertFrom(srcRaw conversion.Hub) error {
    58  	src := srcRaw.(*bootstrapv1.JoinConfiguration)
    59  	return Convert_v1beta1_JoinConfiguration_To_upstreamv1beta3_JoinConfiguration(src, dst, nil)
    60  }
    61  
    62  func Convert_upstreamv1beta3_InitConfiguration_To_v1beta1_InitConfiguration(in *InitConfiguration, out *bootstrapv1.InitConfiguration, s apimachineryconversion.Scope) error {
    63  	// InitConfiguration.CertificateKey and SkipPhases exists in v1beta3 types but not in bootstrapv1.InitConfiguration (Cluster API does not uses automatic copy certs or does not support SkipPhases for now)). Ignoring when converting.
    64  	return autoConvert_upstreamv1beta3_InitConfiguration_To_v1beta1_InitConfiguration(in, out, s)
    65  }
    66  
    67  func Convert_upstreamv1beta3_JoinConfiguration_To_v1beta1_JoinConfiguration(in *JoinConfiguration, out *bootstrapv1.JoinConfiguration, s apimachineryconversion.Scope) error {
    68  	// JoinConfiguration.SkipPhases exists in v1beta3 types but not in bootstrapv1.JoinConfiguration (Cluster API does not support SkipPhases for now). Ignoring when converting.
    69  	return autoConvert_upstreamv1beta3_JoinConfiguration_To_v1beta1_JoinConfiguration(in, out, s)
    70  }
    71  
    72  func Convert_upstreamv1beta3_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(in *NodeRegistrationOptions, out *bootstrapv1.NodeRegistrationOptions, s apimachineryconversion.Scope) error {
    73  	// NodeRegistrationOptions.IgnorePreflightErrors exists in v1beta3 types but not in bootstrapv1.NodeRegistrationOptions (Cluster API does not support it for now). Ignoring when converting.
    74  	return autoConvert_upstreamv1beta3_NodeRegistrationOptions_To_v1beta1_NodeRegistrationOptions(in, out, s)
    75  }
    76  
    77  func Convert_upstreamv1beta3_JoinControlPlane_To_v1beta1_JoinControlPlane(in *JoinControlPlane, out *bootstrapv1.JoinControlPlane, s apimachineryconversion.Scope) error {
    78  	// JoinControlPlane.CertificateKey exists in v1beta3 types but not in bootstrapv1.JoinControlPlane (Cluster API does not uses automatic copy certs). Ignoring when converting.
    79  	return autoConvert_upstreamv1beta3_JoinControlPlane_To_v1beta1_JoinControlPlane(in, out, s)
    80  }