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

Initial deprecation of kubeadm v1beta1 apis #83276

Merged
merged 1 commit into from Oct 8, 2019
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
Expand Up @@ -26,6 +26,7 @@ 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
1 change: 1 addition & 0 deletions cmd/kubeadm/app/apis/kubeadm/v1beta1/doc.go
Expand Up @@ -19,6 +19,7 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm

// Package v1beta1 has been deprecated by v1beta2
// Package v1beta1 defines the v1beta1 version of the kubeadm configuration file format.
// This version graduates the configuration format to BETA and is a big step towards GA.
//
Expand Down
3 changes: 3 additions & 0 deletions cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go
Expand Up @@ -23,6 +23,7 @@ import (

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// DEPRECATED - This group version of InitConfiguration is deprecated by apis/kubeadm/v1beta2/InitConfiguration.
// InitConfiguration contains a list of elements that is specific "kubeadm init"-only runtime
// information.
type InitConfiguration struct {
Expand Down Expand Up @@ -56,6 +57,7 @@ type InitConfiguration struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// DEPRECATED - This group version of ClusterConfiguration is deprecated by apis/kubeadm/v1beta2/ClusterConfiguration.
// ClusterConfiguration contains cluster-wide configuration for a kubeadm cluster
type ClusterConfiguration struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -297,6 +299,7 @@ type ExternalEtcd struct {

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// DEPRECATED - This group version of JoinConfiguration is deprecated by apis/kubeadm/v1beta2/JoinConfiguration.
// JoinConfiguration contains elements describing a particular node.
type JoinConfiguration struct {
metav1.TypeMeta `json:",inline"`
Expand Down
6 changes: 4 additions & 2 deletions cmd/kubeadm/app/util/config/common.go
Expand Up @@ -63,7 +63,9 @@ func validateSupportedVersion(gv schema.GroupVersion, allowDeprecated bool) erro
}

// Deprecated API versions are supported by us, but can only be used for migration.
deprecatedAPIVersions := map[string]struct{}{}
deprecatedAPIVersions := map[string]struct{}{
"kubeadm.k8s.io/v1beta1": {},
}

gvString := gv.String()

Expand All @@ -72,7 +74,7 @@ func validateSupportedVersion(gv schema.GroupVersion, allowDeprecated bool) erro
}

if _, present := deprecatedAPIVersions[gvString]; present && !allowDeprecated {
return errors.Errorf("your configuration file uses a deprecated API spec: %q. Please use 'kubeadm config migrate --old-config old.yaml --new-config new.yaml', which will write the new, similar spec using a newer API version.", gv.String())
klog.Warningf("your configuration file uses a deprecated API spec: %q. Please use 'kubeadm config migrate --old-config old.yaml --new-config new.yaml', which will write the new, similar spec using a newer API version.", gv)
}

return nil
Expand Down
7 changes: 7 additions & 0 deletions cmd/kubeadm/app/util/config/common_test.go
Expand Up @@ -65,6 +65,13 @@ func TestValidateSupportedVersion(t *testing.T) {
allowDeprecated: true,
expectedErr: true,
},
{
gv: schema.GroupVersion{
Group: KubeadmGroupName,
Version: "v1beta1",
},
allowDeprecated: true,
},
{
gv: schema.GroupVersion{
Group: KubeadmGroupName,
Expand Down
2 changes: 2 additions & 0 deletions cmd/kubeadm/app/util/config/joinconfiguration_test.go
Expand Up @@ -94,6 +94,8 @@ func TestLoadJoinConfigurationFromFile(t *testing.T) {
return
}
t2.Fatalf("couldn't unmarshal test data: %v", err)
} else if rt.expectedErr {
t2.Fatalf("expected error, but no error returned")
}

actual, err := kubeadmutil.MarshalToYamlForCodecs(internalcfg, rt.groupVersion, scheme.Codecs)
Expand Down