Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubeadm: add placeholder v1beta3; remove the deprecated v1beta1 #101129

Merged
merged 5 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 8 additions & 14 deletions cmd/kubeadm/app/apis/kubeadm/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"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/constants"
)

Expand Down Expand Up @@ -58,18 +58,18 @@ func fuzzInitConfiguration(obj *kubeadm.InitConfiguration, c fuzz.Continue) {
DNS: kubeadm.DNS{
Type: kubeadm.CoreDNS,
},
CertificatesDir: v1beta2.DefaultCertificatesDir,
ClusterName: v1beta2.DefaultClusterName,
CertificatesDir: kubeadmapiv1.DefaultCertificatesDir,
ClusterName: kubeadmapiv1.DefaultClusterName,
Etcd: kubeadm.Etcd{
Local: &kubeadm.LocalEtcd{
DataDir: v1beta2.DefaultEtcdDataDir,
DataDir: kubeadmapiv1.DefaultEtcdDataDir,
},
},
ImageRepository: v1beta2.DefaultImageRepository,
KubernetesVersion: v1beta2.DefaultKubernetesVersion,
ImageRepository: kubeadmapiv1.DefaultImageRepository,
KubernetesVersion: kubeadmapiv1.DefaultKubernetesVersion,
Networking: kubeadm.Networking{
ServiceSubnet: v1beta2.DefaultServicesSubnet,
DNSDomain: v1beta2.DefaultServiceDNSDomain,
ServiceSubnet: kubeadmapiv1.DefaultServicesSubnet,
DNSDomain: kubeadmapiv1.DefaultServiceDNSDomain,
},
}
// Adds the default bootstrap token to get the round working
Expand All @@ -83,9 +83,6 @@ func fuzzInitConfiguration(obj *kubeadm.InitConfiguration, c fuzz.Continue) {
Usages: []string{"foo"},
},
}

// Pin values for fields that are not present in v1beta1
obj.CertificateKey = ""
}

func fuzzNodeRegistration(obj *kubeadm.NodeRegistrationOptions, c fuzz.Continue) {
Expand Down Expand Up @@ -150,7 +147,4 @@ func fuzzJoinConfiguration(obj *kubeadm.JoinConfiguration, c fuzz.Continue) {

func fuzzJoinControlPlane(obj *kubeadm.JoinControlPlane, c fuzz.Continue) {
c.FuzzNoCustom(obj)

// Pin values for fields that are not present in v1beta1
obj.CertificateKey = ""
}
6 changes: 3 additions & 3 deletions cmd/kubeadm/app/apis/kubeadm/scheme/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta1"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3"
)

// Scheme is the runtime.Scheme to which all kubeadm api types are registered.
Expand All @@ -41,7 +41,7 @@ func init() {
// AddToScheme builds the kubeadm scheme using all known versions of the kubeadm api.
func AddToScheme(scheme *runtime.Scheme) {
utilruntime.Must(kubeadm.AddToScheme(scheme))
utilruntime.Must(v1beta1.AddToScheme(scheme))
utilruntime.Must(v1beta2.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1beta2.SchemeGroupVersion))
utilruntime.Must(v1beta3.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1beta3.SchemeGroupVersion))
}
59 changes: 0 additions & 59 deletions cmd/kubeadm/app/apis/kubeadm/v1beta1/conversion.go

This file was deleted.

149 changes: 0 additions & 149 deletions cmd/kubeadm/app/apis/kubeadm/v1beta1/conversion_test.go

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018 The Kubernetes Authors.
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.
Expand All @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1
package v1beta3

import (
"fmt"
Expand All @@ -26,7 +26,6 @@ import (
bootstraputil "k8s.io/cluster-bootstrap/token/util"
)

// DEPRECATED - This group version of BootstrapTokenString is deprecated by apis/kubeadm/v1beta2/BootstrapTokenString.
// BootstrapTokenString is a token of the format abcdef.abcdef0123456789 that is used
// for both validation of the practically of the API server from a joining node's point
// of view and as an authentication method for the node in the bootstrap phase of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018 The Kubernetes Authors.
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.
Expand All @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1
package v1beta3

import (
"encoding/json"
Expand Down
38 changes: 38 additions & 0 deletions cmd/kubeadm/app/apis/kubeadm/v1beta3/conversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
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 v1beta3

import (
conversion "k8s.io/apimachinery/pkg/conversion"
kubeadm "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
)

func Convert_kubeadm_InitConfiguration_To_v1beta3_InitConfiguration(in *kubeadm.InitConfiguration, out *InitConfiguration, s conversion.Scope) error {
return autoConvert_kubeadm_InitConfiguration_To_v1beta3_InitConfiguration(in, out, s)
}

func Convert_v1beta3_InitConfiguration_To_kubeadm_InitConfiguration(in *InitConfiguration, out *kubeadm.InitConfiguration, s conversion.Scope) error {
err := autoConvert_v1beta3_InitConfiguration_To_kubeadm_InitConfiguration(in, out, s)
if err != nil {
return err
}

// Keep the fuzzer test happy by setting out.ClusterConfiguration to defaults
clusterCfg := &ClusterConfiguration{}
SetDefaults_ClusterConfiguration(clusterCfg)
return Convert_v1beta3_ClusterConfiguration_To_kubeadm_ClusterConfiguration(clusterCfg, &out.ClusterConfiguration, s)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018 The Kubernetes Authors.
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.
Expand All @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1
package v1beta3

import (
"net/url"
Expand Down Expand Up @@ -67,7 +67,6 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {

// SetDefaults_InitConfiguration assigns default values for the InitConfiguration
func SetDefaults_InitConfiguration(obj *InitConfiguration) {
SetDefaults_ClusterConfiguration(&obj.ClusterConfiguration)
SetDefaults_BootstrapTokens(obj)
SetDefaults_APIEndpoint(&obj.LocalAPIEndpoint)
}
Expand Down