Merge pull request #83276 from Klaven/pr_v1beta1_dep

Initial deprecation of kubeadm v1beta1 apis
This commit is contained in:
Kubernetes Prow Robot 2019-10-07 22:15:11 -07:00 committed by GitHub
commit 6564b34f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import (
bootstraputil "k8s.io/cluster-bootstrap/token/util" 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 // 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 // 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 // of view and as an authentication method for the node in the bootstrap phase of

View File

@ -19,6 +19,7 @@ limitations under the License.
// +k8s:deepcopy-gen=package // +k8s:deepcopy-gen=package
// +k8s:conversion-gen=k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm // +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. // 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. // This version graduates the configuration format to BETA and is a big step towards GA.
// //

View File

@ -23,6 +23,7 @@ import (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +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 // InitConfiguration contains a list of elements that is specific "kubeadm init"-only runtime
// information. // information.
type InitConfiguration struct { type InitConfiguration struct {
@ -56,6 +57,7 @@ type InitConfiguration struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +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 // ClusterConfiguration contains cluster-wide configuration for a kubeadm cluster
type ClusterConfiguration struct { type ClusterConfiguration struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
@ -297,6 +299,7 @@ type ExternalEtcd struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +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. // JoinConfiguration contains elements describing a particular node.
type JoinConfiguration struct { type JoinConfiguration struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`

View File

@ -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. // 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() gvString := gv.String()
@ -72,7 +74,7 @@ func validateSupportedVersion(gv schema.GroupVersion, allowDeprecated bool) erro
} }
if _, present := deprecatedAPIVersions[gvString]; present && !allowDeprecated { 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 return nil

View File

@ -65,6 +65,13 @@ func TestValidateSupportedVersion(t *testing.T) {
allowDeprecated: true, allowDeprecated: true,
expectedErr: true, expectedErr: true,
}, },
{
gv: schema.GroupVersion{
Group: KubeadmGroupName,
Version: "v1beta1",
},
allowDeprecated: true,
},
{ {
gv: schema.GroupVersion{ gv: schema.GroupVersion{
Group: KubeadmGroupName, Group: KubeadmGroupName,

View File

@ -94,6 +94,8 @@ func TestLoadJoinConfigurationFromFile(t *testing.T) {
return return
} }
t2.Fatalf("couldn't unmarshal test data: %v", err) 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) actual, err := kubeadmutil.MarshalToYamlForCodecs(internalcfg, rt.groupVersion, scheme.Codecs)