mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #105295 from neolit123/1.23-add-output-v1alpha2
kubeadm: add a new output/v1alpha2 API; deprecate output/v1alpha1
This commit is contained in:
commit
73f4064fff
@ -17,9 +17,12 @@ limitations under the License.
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||
)
|
||||
|
||||
@ -64,3 +67,19 @@ func Convert_v1beta2_JoinConfiguration_To_kubeadm_JoinConfiguration(in *JoinConf
|
||||
out.NodeRegistration.ImagePullPolicy = corev1.PullIfNotPresent
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_BootstrapToken_To_v1_BootstrapToken is required so that we can directly
|
||||
// cast a v1beta1.BootstrapToken to v1.BootstrapToken using unsafe.Pointer and not
|
||||
// field by field.
|
||||
func Convert_v1beta2_BootstrapToken_To_v1_BootstrapToken(in *BootstrapToken, out *bootstraptokenv1.BootstrapToken, s conversion.Scope) error {
|
||||
*out = *(*bootstraptokenv1.BootstrapToken)(unsafe.Pointer(in))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1_BootstrapToken_To_v1beta2_BootstrapToken is required so that we can directly
|
||||
// cast a v1.BootstrapToken to v1beta1.BootstrapToken using unsafe.Pointer and not
|
||||
// field by field.
|
||||
func Convert_v1_BootstrapToken_To_v1beta2_BootstrapToken(in *bootstraptokenv1.BootstrapToken, out *BootstrapToken, s conversion.Scope) error {
|
||||
*out = *(*BootstrapToken)(unsafe.Pointer(in))
|
||||
return nil
|
||||
}
|
||||
|
@ -29,9 +29,6 @@ const GroupName = "kubeadm.k8s.io"
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta2"}
|
||||
|
||||
var (
|
||||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||
|
||||
// SchemeBuilder points to a list of functions added to Scheme.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
|
@ -25,10 +25,10 @@ import (
|
||||
unsafe "unsafe"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
v1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||
)
|
||||
|
||||
@ -204,6 +204,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*v1.BootstrapToken)(nil), (*BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1_BootstrapToken_To_v1beta2_BootstrapToken(a.(*v1.BootstrapToken), b.(*BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*BootstrapToken)(nil), (*v1.BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_BootstrapToken_To_v1_BootstrapToken(a.(*BootstrapToken), b.(*v1.BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*ClusterConfiguration)(nil), (*kubeadm.ClusterConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_ClusterConfiguration_To_kubeadm_ClusterConfiguration(a.(*ClusterConfiguration), b.(*kubeadm.ClusterConfiguration), scope)
|
||||
}); err != nil {
|
||||
@ -249,7 +259,7 @@ func autoConvert_v1beta2_APIServer_To_kubeadm_APIServer(in *APIServer, out *kube
|
||||
return err
|
||||
}
|
||||
out.CertSANs = *(*[]string)(unsafe.Pointer(&in.CertSANs))
|
||||
out.TimeoutForControlPlane = (*v1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane))
|
||||
out.TimeoutForControlPlane = (*metav1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -263,7 +273,7 @@ func autoConvert_kubeadm_APIServer_To_v1beta2_APIServer(in *kubeadm.APIServer, o
|
||||
return err
|
||||
}
|
||||
out.CertSANs = *(*[]string)(unsafe.Pointer(&in.CertSANs))
|
||||
out.TimeoutForControlPlane = (*v1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane))
|
||||
out.TimeoutForControlPlane = (*metav1.Duration)(unsafe.Pointer(in.TimeoutForControlPlane))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -414,7 +424,7 @@ func autoConvert_v1beta2_Discovery_To_kubeadm_Discovery(in *Discovery, out *kube
|
||||
out.BootstrapToken = (*kubeadm.BootstrapTokenDiscovery)(unsafe.Pointer(in.BootstrapToken))
|
||||
out.File = (*kubeadm.FileDiscovery)(unsafe.Pointer(in.File))
|
||||
out.TLSBootstrapToken = in.TLSBootstrapToken
|
||||
out.Timeout = (*v1.Duration)(unsafe.Pointer(in.Timeout))
|
||||
out.Timeout = (*metav1.Duration)(unsafe.Pointer(in.Timeout))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -427,7 +437,7 @@ func autoConvert_kubeadm_Discovery_To_v1beta2_Discovery(in *kubeadm.Discovery, o
|
||||
out.BootstrapToken = (*BootstrapTokenDiscovery)(unsafe.Pointer(in.BootstrapToken))
|
||||
out.File = (*FileDiscovery)(unsafe.Pointer(in.File))
|
||||
out.TLSBootstrapToken = in.TLSBootstrapToken
|
||||
out.Timeout = (*v1.Duration)(unsafe.Pointer(in.Timeout))
|
||||
out.Timeout = (*metav1.Duration)(unsafe.Pointer(in.Timeout))
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -555,7 +565,17 @@ func Convert_kubeadm_ImageMeta_To_v1beta2_ImageMeta(in *kubeadm.ImageMeta, out *
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error {
|
||||
out.BootstrapTokens = *(*[]bootstraptokenv1.BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens))
|
||||
if in.BootstrapTokens != nil {
|
||||
in, out := &in.BootstrapTokens, &out.BootstrapTokens
|
||||
*out = make([]v1.BootstrapToken, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1beta2_BootstrapToken_To_v1_BootstrapToken(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.BootstrapTokens = nil
|
||||
}
|
||||
if err := Convert_v1beta2_NodeRegistrationOptions_To_kubeadm_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -568,7 +588,17 @@ func autoConvert_v1beta2_InitConfiguration_To_kubeadm_InitConfiguration(in *Init
|
||||
|
||||
func autoConvert_kubeadm_InitConfiguration_To_v1beta2_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
|
||||
// WARNING: in.ClusterConfiguration requires manual conversion: does not exist in peer-type
|
||||
out.BootstrapTokens = *(*[]BootstrapToken)(unsafe.Pointer(&in.BootstrapTokens))
|
||||
if in.BootstrapTokens != nil {
|
||||
in, out := &in.BootstrapTokens, &out.BootstrapTokens
|
||||
*out = make([]BootstrapToken, len(*in))
|
||||
for i := range *in {
|
||||
if err := Convert_v1_BootstrapToken_To_v1beta2_BootstrapToken(&(*in)[i], &(*out)[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.BootstrapTokens = nil
|
||||
}
|
||||
if err := Convert_kubeadm_NodeRegistrationOptions_To_v1beta2_NodeRegistrationOptions(&in.NodeRegistration, &out.NodeRegistration, s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -29,9 +29,6 @@ const GroupName = "kubeadm.k8s.io"
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta3"}
|
||||
|
||||
var (
|
||||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||
|
||||
// SchemeBuilder points to a list of functions added to Scheme.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
|
||||
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/output"
|
||||
)
|
||||
|
||||
@ -38,7 +38,7 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
func fuzzBootstrapToken(obj *output.BootstrapToken, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(obj)
|
||||
|
||||
obj.Token = &kubeadmapiv1beta2.BootstrapTokenString{ID: "uvxdac", Secret: "fq35fuyue3kd4gda"}
|
||||
obj.Token = &bootstraptokenv1.BootstrapTokenString{ID: "uvxdac", Secret: "fq35fuyue3kd4gda"}
|
||||
obj.Description = ""
|
||||
obj.TTL = &metav1.Duration{Duration: time.Hour * 24}
|
||||
obj.Usages = []string{"authentication", "signing"}
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/output"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
|
||||
)
|
||||
|
||||
// Scheme is the runtime.Scheme to which all kubeadm api types are registered.
|
||||
@ -42,5 +43,6 @@ func init() {
|
||||
func AddToScheme(scheme *runtime.Scheme) {
|
||||
utilruntime.Must(output.AddToScheme(scheme))
|
||||
utilruntime.Must(v1alpha1.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
|
||||
utilruntime.Must(v1alpha2.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1alpha2.SchemeGroupVersion))
|
||||
}
|
||||
|
@ -19,18 +19,16 @@ package output
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// BootstrapToken represents information for the output produced by 'kubeadm token list'
|
||||
// This is a copy of BootstrapToken struct from ../kubeadm/types.go with 2 additions:
|
||||
// metav1.TypeMeta and metav1.ObjectMeta
|
||||
// BootstrapToken represents information for the bootstrap token output produced by kubeadm
|
||||
type BootstrapToken struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
kubeadmapiv1beta2.BootstrapToken
|
||||
bootstraptokenv1.BootstrapToken
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
37
cmd/kubeadm/app/apis/output/v1alpha1/conversion.go
Normal file
37
cmd/kubeadm/app/apis/output/v1alpha1/conversion.go
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2021 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 (
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
|
||||
kubeadmv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||
output "k8s.io/kubernetes/cmd/kubeadm/app/apis/output"
|
||||
)
|
||||
|
||||
// The conversion functions here are required since output.v1alpha2.BootstrapToken embeds
|
||||
// bootstraptoken.v1.BootstrapToken, instead of kubeadm.v1beta2.BootstrapToken.
|
||||
|
||||
func Convert_v1alpha1_BootstrapToken_To_output_BootstrapToken(in *BootstrapToken, out *output.BootstrapToken, s conversion.Scope) error {
|
||||
kubeadmv1beta2.Convert_v1beta2_BootstrapToken_To_v1_BootstrapToken(&in.BootstrapToken, &out.BootstrapToken, s)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_output_BootstrapToken_To_v1alpha1_BootstrapToken(in *output.BootstrapToken, out *BootstrapToken, s conversion.Scope) error {
|
||||
kubeadmv1beta2.Convert_v1_BootstrapToken_To_v1beta2_BootstrapToken(&in.BootstrapToken, &out.BootstrapToken, s)
|
||||
return nil
|
||||
}
|
@ -24,4 +24,5 @@ limitations under the License.
|
||||
// The purpose of the kubeadm structured output is to have a well
|
||||
// defined versioned output format that other software that uses
|
||||
// kubeadm for cluster deployments can use and rely on.
|
||||
// DEPRECATED: use v1alpha2 instead
|
||||
package v1alpha1 // import "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
|
||||
|
@ -29,9 +29,6 @@ const GroupName = "output.kubeadm.k8s.io"
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
|
||||
|
||||
var (
|
||||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||
|
||||
// SchemeBuilder points to a list of functions added to Scheme.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
|
@ -25,8 +25,6 @@ import (
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// BootstrapToken represents information for the bootstrap token output produced by kubeadm
|
||||
// This is a copy of BootstrapToken struct from ../kubeadm/types.go with 2 additions:
|
||||
// metav1.TypeMeta and metav1.ObjectMeta
|
||||
type BootstrapToken struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||
output "k8s.io/kubernetes/cmd/kubeadm/app/apis/output"
|
||||
)
|
||||
|
||||
@ -36,16 +37,6 @@ func init() {
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*BootstrapToken)(nil), (*output.BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_BootstrapToken_To_output_BootstrapToken(a.(*BootstrapToken), b.(*output.BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*output.BootstrapToken)(nil), (*BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_BootstrapToken_To_v1alpha1_BootstrapToken(a.(*output.BootstrapToken), b.(*BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*ComponentConfigVersionState)(nil), (*output.ComponentConfigVersionState)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState(a.(*ComponentConfigVersionState), b.(*output.ComponentConfigVersionState), scope)
|
||||
}); err != nil {
|
||||
@ -86,29 +77,33 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*output.BootstrapToken)(nil), (*BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_BootstrapToken_To_v1alpha1_BootstrapToken(a.(*output.BootstrapToken), b.(*BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddConversionFunc((*BootstrapToken)(nil), (*output.BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha1_BootstrapToken_To_output_BootstrapToken(a.(*BootstrapToken), b.(*output.BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_BootstrapToken_To_output_BootstrapToken(in *BootstrapToken, out *output.BootstrapToken, s conversion.Scope) error {
|
||||
out.BootstrapToken = in.BootstrapToken
|
||||
if err := v1beta2.Convert_v1beta2_BootstrapToken_To_v1_BootstrapToken(&in.BootstrapToken, &out.BootstrapToken, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha1_BootstrapToken_To_output_BootstrapToken is an autogenerated conversion function.
|
||||
func Convert_v1alpha1_BootstrapToken_To_output_BootstrapToken(in *BootstrapToken, out *output.BootstrapToken, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha1_BootstrapToken_To_output_BootstrapToken(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_output_BootstrapToken_To_v1alpha1_BootstrapToken(in *output.BootstrapToken, out *BootstrapToken, s conversion.Scope) error {
|
||||
out.BootstrapToken = in.BootstrapToken
|
||||
if err := v1beta2.Convert_v1_BootstrapToken_To_v1beta2_BootstrapToken(&in.BootstrapToken, &out.BootstrapToken, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_output_BootstrapToken_To_v1alpha1_BootstrapToken is an autogenerated conversion function.
|
||||
func Convert_output_BootstrapToken_To_v1alpha1_BootstrapToken(in *output.BootstrapToken, out *BootstrapToken, s conversion.Scope) error {
|
||||
return autoConvert_output_BootstrapToken_To_v1alpha1_BootstrapToken(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha1_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in *ComponentConfigVersionState, out *output.ComponentConfigVersionState, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.CurrentVersion = in.CurrentVersion
|
||||
|
26
cmd/kubeadm/app/apis/output/v1alpha2/doc.go
Normal file
26
cmd/kubeadm/app/apis/output/v1alpha2/doc.go
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2021 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.
|
||||
*/
|
||||
|
||||
// +groupName=output.kubeadm.k8s.io
|
||||
// +k8s:deepcopy-gen=package
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/cmd/kubeadm/app/apis/output
|
||||
|
||||
// Package v1alpha2 defines the v1alpha2 version of the kubeadm data structures
|
||||
// related to structured output
|
||||
// The purpose of the kubeadm structured output is to have a well
|
||||
// defined versioned output format that other software that uses
|
||||
// kubeadm for cluster deployments can use and rely on.
|
||||
package v1alpha2 // import "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
|
64
cmd/kubeadm/app/apis/output/v1alpha2/register.go
Normal file
64
cmd/kubeadm/app/apis/output/v1alpha2/register.go
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2021 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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// GroupName is the group name use in this package
|
||||
const GroupName = "output.kubeadm.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"}
|
||||
|
||||
var (
|
||||
// SchemeBuilder points to a list of functions added to Scheme.
|
||||
SchemeBuilder runtime.SchemeBuilder
|
||||
localSchemeBuilder = &SchemeBuilder
|
||||
// AddToScheme applies all the stored functions to the scheme.
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
func init() {
|
||||
// We only register manually written functions here. The registration of the
|
||||
// generated functions takes place in the generated files. The separation
|
||||
// makes the code compile even when the generated files are missing.
|
||||
localSchemeBuilder.Register(addKnownTypes)
|
||||
}
|
||||
|
||||
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||
func Kind(kind string) schema.GroupKind {
|
||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&BootstrapToken{},
|
||||
&Images{},
|
||||
&UpgradePlan{},
|
||||
)
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
80
cmd/kubeadm/app/apis/output/v1alpha2/types.go
Normal file
80
cmd/kubeadm/app/apis/output/v1alpha2/types.go
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright 2021 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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// BootstrapToken represents information for the bootstrap token output produced by kubeadm
|
||||
type BootstrapToken struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
bootstraptokenv1.BootstrapToken
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Images represents information for the output produced by 'kubeadm config images list'
|
||||
type Images struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
Images []string `json:"images"`
|
||||
}
|
||||
|
||||
// ComponentUpgradePlan represents information about upgrade plan for one component
|
||||
type ComponentUpgradePlan struct {
|
||||
Name string `json:"name"`
|
||||
CurrentVersion string `json:"currentVersion"`
|
||||
NewVersion string `json:"newVersion"`
|
||||
}
|
||||
|
||||
// ComponentConfigVersionState describes the current and desired version of a component config
|
||||
type ComponentConfigVersionState struct {
|
||||
// Group points to the Kubernetes API group that covers the config
|
||||
Group string `json:"group"`
|
||||
|
||||
// CurrentVersion is the currently active component config version
|
||||
// NOTE: This can be empty in case the config was not found on the cluster or it was unsupported
|
||||
// kubeadm generated version
|
||||
CurrentVersion string `json:"currentVersion"`
|
||||
|
||||
// PreferredVersion is the component config version that is currently preferred by kubeadm for use.
|
||||
// NOTE: As of today, this is the only version supported by kubeadm.
|
||||
PreferredVersion string `json:"preferredVersion"`
|
||||
|
||||
// ManualUpgradeRequired indicates if users need to manually upgrade their component config versions. This happens if
|
||||
// the CurrentVersion of the config is user supplied (or modified) and no longer supported. Users should upgrade
|
||||
// their component configs to PreferredVersion or any other supported component config version.
|
||||
ManualUpgradeRequired bool `json:"manualUpgradeRequired"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// UpgradePlan represents information about upgrade plan for the output
|
||||
// produced by 'kubeadm upgrade plan'
|
||||
type UpgradePlan struct {
|
||||
metav1.TypeMeta
|
||||
|
||||
Components []ComponentUpgradePlan `json:"components"`
|
||||
|
||||
ConfigVersions []ComponentConfigVersionState `json:"configVersions"`
|
||||
}
|
202
cmd/kubeadm/app/apis/output/v1alpha2/zz_generated.conversion.go
generated
Normal file
202
cmd/kubeadm/app/apis/output/v1alpha2/zz_generated.conversion.go
generated
Normal file
@ -0,0 +1,202 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 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 conversion-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
unsafe "unsafe"
|
||||
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
output "k8s.io/kubernetes/cmd/kubeadm/app/apis/output"
|
||||
)
|
||||
|
||||
func init() {
|
||||
localSchemeBuilder.Register(RegisterConversions)
|
||||
}
|
||||
|
||||
// RegisterConversions adds conversion functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterConversions(s *runtime.Scheme) error {
|
||||
if err := s.AddGeneratedConversionFunc((*BootstrapToken)(nil), (*output.BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha2_BootstrapToken_To_output_BootstrapToken(a.(*BootstrapToken), b.(*output.BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*output.BootstrapToken)(nil), (*BootstrapToken)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_BootstrapToken_To_v1alpha2_BootstrapToken(a.(*output.BootstrapToken), b.(*BootstrapToken), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*ComponentConfigVersionState)(nil), (*output.ComponentConfigVersionState)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha2_ComponentConfigVersionState_To_output_ComponentConfigVersionState(a.(*ComponentConfigVersionState), b.(*output.ComponentConfigVersionState), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*output.ComponentConfigVersionState)(nil), (*ComponentConfigVersionState)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_ComponentConfigVersionState_To_v1alpha2_ComponentConfigVersionState(a.(*output.ComponentConfigVersionState), b.(*ComponentConfigVersionState), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*ComponentUpgradePlan)(nil), (*output.ComponentUpgradePlan)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha2_ComponentUpgradePlan_To_output_ComponentUpgradePlan(a.(*ComponentUpgradePlan), b.(*output.ComponentUpgradePlan), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*output.ComponentUpgradePlan)(nil), (*ComponentUpgradePlan)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_ComponentUpgradePlan_To_v1alpha2_ComponentUpgradePlan(a.(*output.ComponentUpgradePlan), b.(*ComponentUpgradePlan), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*Images)(nil), (*output.Images)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha2_Images_To_output_Images(a.(*Images), b.(*output.Images), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*output.Images)(nil), (*Images)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_Images_To_v1alpha2_Images(a.(*output.Images), b.(*Images), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*UpgradePlan)(nil), (*output.UpgradePlan)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1alpha2_UpgradePlan_To_output_UpgradePlan(a.(*UpgradePlan), b.(*output.UpgradePlan), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*output.UpgradePlan)(nil), (*UpgradePlan)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_output_UpgradePlan_To_v1alpha2_UpgradePlan(a.(*output.UpgradePlan), b.(*UpgradePlan), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha2_BootstrapToken_To_output_BootstrapToken(in *BootstrapToken, out *output.BootstrapToken, s conversion.Scope) error {
|
||||
out.BootstrapToken = in.BootstrapToken
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha2_BootstrapToken_To_output_BootstrapToken is an autogenerated conversion function.
|
||||
func Convert_v1alpha2_BootstrapToken_To_output_BootstrapToken(in *BootstrapToken, out *output.BootstrapToken, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha2_BootstrapToken_To_output_BootstrapToken(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_output_BootstrapToken_To_v1alpha2_BootstrapToken(in *output.BootstrapToken, out *BootstrapToken, s conversion.Scope) error {
|
||||
out.BootstrapToken = in.BootstrapToken
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_output_BootstrapToken_To_v1alpha2_BootstrapToken is an autogenerated conversion function.
|
||||
func Convert_output_BootstrapToken_To_v1alpha2_BootstrapToken(in *output.BootstrapToken, out *BootstrapToken, s conversion.Scope) error {
|
||||
return autoConvert_output_BootstrapToken_To_v1alpha2_BootstrapToken(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha2_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in *ComponentConfigVersionState, out *output.ComponentConfigVersionState, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.CurrentVersion = in.CurrentVersion
|
||||
out.PreferredVersion = in.PreferredVersion
|
||||
out.ManualUpgradeRequired = in.ManualUpgradeRequired
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha2_ComponentConfigVersionState_To_output_ComponentConfigVersionState is an autogenerated conversion function.
|
||||
func Convert_v1alpha2_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in *ComponentConfigVersionState, out *output.ComponentConfigVersionState, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha2_ComponentConfigVersionState_To_output_ComponentConfigVersionState(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_output_ComponentConfigVersionState_To_v1alpha2_ComponentConfigVersionState(in *output.ComponentConfigVersionState, out *ComponentConfigVersionState, s conversion.Scope) error {
|
||||
out.Group = in.Group
|
||||
out.CurrentVersion = in.CurrentVersion
|
||||
out.PreferredVersion = in.PreferredVersion
|
||||
out.ManualUpgradeRequired = in.ManualUpgradeRequired
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_output_ComponentConfigVersionState_To_v1alpha2_ComponentConfigVersionState is an autogenerated conversion function.
|
||||
func Convert_output_ComponentConfigVersionState_To_v1alpha2_ComponentConfigVersionState(in *output.ComponentConfigVersionState, out *ComponentConfigVersionState, s conversion.Scope) error {
|
||||
return autoConvert_output_ComponentConfigVersionState_To_v1alpha2_ComponentConfigVersionState(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha2_ComponentUpgradePlan_To_output_ComponentUpgradePlan(in *ComponentUpgradePlan, out *output.ComponentUpgradePlan, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.CurrentVersion = in.CurrentVersion
|
||||
out.NewVersion = in.NewVersion
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha2_ComponentUpgradePlan_To_output_ComponentUpgradePlan is an autogenerated conversion function.
|
||||
func Convert_v1alpha2_ComponentUpgradePlan_To_output_ComponentUpgradePlan(in *ComponentUpgradePlan, out *output.ComponentUpgradePlan, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha2_ComponentUpgradePlan_To_output_ComponentUpgradePlan(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_output_ComponentUpgradePlan_To_v1alpha2_ComponentUpgradePlan(in *output.ComponentUpgradePlan, out *ComponentUpgradePlan, s conversion.Scope) error {
|
||||
out.Name = in.Name
|
||||
out.CurrentVersion = in.CurrentVersion
|
||||
out.NewVersion = in.NewVersion
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_output_ComponentUpgradePlan_To_v1alpha2_ComponentUpgradePlan is an autogenerated conversion function.
|
||||
func Convert_output_ComponentUpgradePlan_To_v1alpha2_ComponentUpgradePlan(in *output.ComponentUpgradePlan, out *ComponentUpgradePlan, s conversion.Scope) error {
|
||||
return autoConvert_output_ComponentUpgradePlan_To_v1alpha2_ComponentUpgradePlan(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha2_Images_To_output_Images(in *Images, out *output.Images, s conversion.Scope) error {
|
||||
out.Images = *(*[]string)(unsafe.Pointer(&in.Images))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha2_Images_To_output_Images is an autogenerated conversion function.
|
||||
func Convert_v1alpha2_Images_To_output_Images(in *Images, out *output.Images, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha2_Images_To_output_Images(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_output_Images_To_v1alpha2_Images(in *output.Images, out *Images, s conversion.Scope) error {
|
||||
out.Images = *(*[]string)(unsafe.Pointer(&in.Images))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_output_Images_To_v1alpha2_Images is an autogenerated conversion function.
|
||||
func Convert_output_Images_To_v1alpha2_Images(in *output.Images, out *Images, s conversion.Scope) error {
|
||||
return autoConvert_output_Images_To_v1alpha2_Images(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1alpha2_UpgradePlan_To_output_UpgradePlan(in *UpgradePlan, out *output.UpgradePlan, s conversion.Scope) error {
|
||||
out.Components = *(*[]output.ComponentUpgradePlan)(unsafe.Pointer(&in.Components))
|
||||
out.ConfigVersions = *(*[]output.ComponentConfigVersionState)(unsafe.Pointer(&in.ConfigVersions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1alpha2_UpgradePlan_To_output_UpgradePlan is an autogenerated conversion function.
|
||||
func Convert_v1alpha2_UpgradePlan_To_output_UpgradePlan(in *UpgradePlan, out *output.UpgradePlan, s conversion.Scope) error {
|
||||
return autoConvert_v1alpha2_UpgradePlan_To_output_UpgradePlan(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_output_UpgradePlan_To_v1alpha2_UpgradePlan(in *output.UpgradePlan, out *UpgradePlan, s conversion.Scope) error {
|
||||
out.Components = *(*[]ComponentUpgradePlan)(unsafe.Pointer(&in.Components))
|
||||
out.ConfigVersions = *(*[]ComponentConfigVersionState)(unsafe.Pointer(&in.ConfigVersions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_output_UpgradePlan_To_v1alpha2_UpgradePlan is an autogenerated conversion function.
|
||||
func Convert_output_UpgradePlan_To_v1alpha2_UpgradePlan(in *output.UpgradePlan, out *UpgradePlan, s conversion.Scope) error {
|
||||
return autoConvert_output_UpgradePlan_To_v1alpha2_UpgradePlan(in, out, s)
|
||||
}
|
149
cmd/kubeadm/app/apis/output/v1alpha2/zz_generated.deepcopy.go
generated
Normal file
149
cmd/kubeadm/app/apis/output/v1alpha2/zz_generated.deepcopy.go
generated
Normal file
@ -0,0 +1,149 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 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 deepcopy-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *BootstrapToken) DeepCopyInto(out *BootstrapToken) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.BootstrapToken.DeepCopyInto(&out.BootstrapToken)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BootstrapToken.
|
||||
func (in *BootstrapToken) DeepCopy() *BootstrapToken {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(BootstrapToken)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *BootstrapToken) 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 *ComponentConfigVersionState) DeepCopyInto(out *ComponentConfigVersionState) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentConfigVersionState.
|
||||
func (in *ComponentConfigVersionState) DeepCopy() *ComponentConfigVersionState {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ComponentConfigVersionState)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ComponentUpgradePlan) DeepCopyInto(out *ComponentUpgradePlan) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComponentUpgradePlan.
|
||||
func (in *ComponentUpgradePlan) DeepCopy() *ComponentUpgradePlan {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ComponentUpgradePlan)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Images) DeepCopyInto(out *Images) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if in.Images != nil {
|
||||
in, out := &in.Images, &out.Images
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Images.
|
||||
func (in *Images) DeepCopy() *Images {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Images)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Images) 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 *UpgradePlan) DeepCopyInto(out *UpgradePlan) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]ComponentUpgradePlan, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ConfigVersions != nil {
|
||||
in, out := &in.ConfigVersions, &out.ConfigVersions
|
||||
*out = make([]ComponentConfigVersionState, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpgradePlan.
|
||||
func (in *UpgradePlan) DeepCopy() *UpgradePlan {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(UpgradePlan)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *UpgradePlan) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
@ -38,7 +38,7 @@ import (
|
||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||
kubeadmapiv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3"
|
||||
outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme"
|
||||
outputapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
|
||||
outputapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/componentconfigs"
|
||||
@ -413,7 +413,7 @@ type imageTextPrinter struct {
|
||||
// PrintObj is an implementation of ResourcePrinter.PrintObj for plain text output
|
||||
func (itp *imageTextPrinter) PrintObj(obj runtime.Object, writer io.Writer) error {
|
||||
var err error
|
||||
if imgs, ok := obj.(*outputapiv1alpha1.Images); ok {
|
||||
if imgs, ok := obj.(*outputapiv1alpha2.Images); ok {
|
||||
_, err = fmt.Fprintln(writer, strings.Join(imgs.Images, "\n"))
|
||||
} else {
|
||||
err = errors.New("unexpected object type")
|
||||
@ -436,7 +436,7 @@ func (ipf *imageTextPrintFlags) ToPrinter(outputFormat string) (output.Printer,
|
||||
func (i *ImagesList) Run(out io.Writer, printer output.Printer) error {
|
||||
imgs := images.GetControlPlaneImages(&i.cfg.ClusterConfiguration)
|
||||
|
||||
if err := printer.PrintObj(&outputapiv1alpha1.Images{Images: imgs}, out); err != nil {
|
||||
if err := printer.PrintObj(&outputapiv1alpha2.Images{Images: imgs}, out); err != nil {
|
||||
return errors.Wrap(err, "unable to print images")
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ k8s.gcr.io/coredns/coredns:{{.CoreDNSVersion}}
|
||||
outputFormat: "json",
|
||||
expectedOutput: `{
|
||||
"kind": "Images",
|
||||
"apiVersion": "output.kubeadm.k8s.io/v1alpha1",
|
||||
"apiVersion": "output.kubeadm.k8s.io/v1alpha2",
|
||||
"images": [
|
||||
"k8s.gcr.io/kube-apiserver:{{.KubeVersion}}",
|
||||
"k8s.gcr.io/kube-controller-manager:{{.KubeVersion}}",
|
||||
@ -272,7 +272,7 @@ k8s.gcr.io/coredns/coredns:{{.CoreDNSVersion}}
|
||||
KubernetesVersion: dummyKubernetesVersionStr,
|
||||
},
|
||||
outputFormat: "yaml",
|
||||
expectedOutput: `apiVersion: output.kubeadm.k8s.io/v1alpha1
|
||||
expectedOutput: `apiVersion: output.kubeadm.k8s.io/v1alpha2
|
||||
images:
|
||||
- k8s.gcr.io/kube-apiserver:{{.KubeVersion}}
|
||||
- k8s.gcr.io/kube-controller-manager:{{.KubeVersion}}
|
||||
|
@ -41,11 +41,10 @@ import (
|
||||
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
kubeadmscheme "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/scheme"
|
||||
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||
kubeadmapiv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
|
||||
outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme"
|
||||
outputapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
|
||||
outputapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
|
||||
cmdutil "k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
|
||||
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
|
||||
@ -300,7 +299,7 @@ func RunGenerateToken(out io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func formatBootstrapToken(obj *outputapiv1alpha1.BootstrapToken) string {
|
||||
func formatBootstrapToken(obj *outputapiv1alpha2.BootstrapToken) string {
|
||||
ttl := "<forever>"
|
||||
expires := "<never>"
|
||||
if obj.Expires != nil {
|
||||
@ -347,7 +346,7 @@ func (ttp *tokenTextPrinter) PrintObj(obj runtime.Object, writer io.Writer) erro
|
||||
}
|
||||
|
||||
// Print token
|
||||
fmt.Fprint(tabw, formatBootstrapToken(obj.(*outputapiv1alpha1.BootstrapToken)))
|
||||
fmt.Fprint(tabw, formatBootstrapToken(obj.(*outputapiv1alpha2.BootstrapToken)))
|
||||
|
||||
return tabw.Flush()
|
||||
}
|
||||
@ -391,9 +390,9 @@ func RunListTokens(out io.Writer, errW io.Writer, client clientset.Interface, pr
|
||||
}
|
||||
|
||||
// Convert token into versioned output structure
|
||||
outputToken := outputapiv1alpha1.BootstrapToken{
|
||||
BootstrapToken: kubeadmapiv1beta2.BootstrapToken{
|
||||
Token: &kubeadmapiv1beta2.BootstrapTokenString{ID: token.Token.ID, Secret: token.Token.Secret},
|
||||
outputToken := outputapiv1alpha2.BootstrapToken{
|
||||
BootstrapToken: bootstraptokenv1.BootstrapToken{
|
||||
Token: &bootstraptokenv1.BootstrapTokenString{ID: token.Token.ID, Secret: token.Token.Secret},
|
||||
Description: token.Description,
|
||||
TTL: token.TTL,
|
||||
Expires: token.Expires,
|
||||
|
@ -33,10 +33,9 @@ import (
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
|
||||
bootstraptokenv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/bootstraptoken/v1"
|
||||
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
|
||||
kubeadmapiv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3"
|
||||
outputapischeme "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/scheme"
|
||||
outputapiv1alpha1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha1"
|
||||
outputapiv1alpha2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/output/v1alpha2"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/util/output"
|
||||
)
|
||||
|
||||
@ -360,7 +359,7 @@ func TestTokenOutput(t *testing.T) {
|
||||
outputFormat: "json",
|
||||
expected: `{
|
||||
"kind": "BootstrapToken",
|
||||
"apiVersion": "output.kubeadm.k8s.io/v1alpha1",
|
||||
"apiVersion": "output.kubeadm.k8s.io/v1alpha2",
|
||||
"token": "abcdef.1234567890123456",
|
||||
"description": "valid bootstrap tooken",
|
||||
"usages": [
|
||||
@ -381,7 +380,7 @@ func TestTokenOutput(t *testing.T) {
|
||||
usages: []string{"signing", "authentication"},
|
||||
extraGroups: []string{"system:bootstrappers:kubeadm:default-node-token"},
|
||||
outputFormat: "yaml",
|
||||
expected: `apiVersion: output.kubeadm.k8s.io/v1alpha1
|
||||
expected: `apiVersion: output.kubeadm.k8s.io/v1alpha2
|
||||
description: valid bootstrap tooken
|
||||
groups:
|
||||
- system:bootstrappers:kubeadm:default-node-token
|
||||
@ -428,9 +427,9 @@ abcdef.1234567890123456 <forever> <never> signing,authentication valid b
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
token := outputapiv1alpha1.BootstrapToken{
|
||||
BootstrapToken: kubeadmapiv1beta2.BootstrapToken{
|
||||
Token: &kubeadmapiv1beta2.BootstrapTokenString{ID: tc.id, Secret: tc.secret},
|
||||
token := outputapiv1alpha2.BootstrapToken{
|
||||
BootstrapToken: bootstraptokenv1.BootstrapToken{
|
||||
Token: &bootstraptokenv1.BootstrapTokenString{ID: tc.id, Secret: tc.secret},
|
||||
Description: tc.description,
|
||||
Usages: tc.usages,
|
||||
Groups: tc.extraGroups,
|
||||
|
Loading…
Reference in New Issue
Block a user