GA of RuntimeClass feature gate and API

This commit is contained in:
Sergey Kanzhelev
2020-11-11 19:22:32 +00:00
parent 0469db9fe7
commit 06da0e5e74
88 changed files with 4377 additions and 305 deletions

View File

@@ -30,6 +30,7 @@ filegroup(
srcs = [
":package-srcs",
"//pkg/apis/node/install:all-srcs",
"//pkg/apis/node/v1:all-srcs",
"//pkg/apis/node/v1alpha1:all-srcs",
"//pkg/apis/node/v1beta1:all-srcs",
"//pkg/apis/node/validation:all-srcs",

View File

@@ -8,6 +8,7 @@ go_library(
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/node:go_default_library",
"//pkg/apis/node/v1:go_default_library",
"//pkg/apis/node/v1alpha1:go_default_library",
"//pkg/apis/node/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",

View File

@@ -23,6 +23,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/node"
v1 "k8s.io/kubernetes/pkg/apis/node/v1"
"k8s.io/kubernetes/pkg/apis/node/v1alpha1"
"k8s.io/kubernetes/pkg/apis/node/v1beta1"
)
@@ -36,5 +37,13 @@ func Install(scheme *runtime.Scheme) {
utilruntime.Must(node.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(v1beta1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion))
utilruntime.Must(v1.AddToScheme(scheme))
// TODO (SergeyKanzhelev): priority should change after 1.21. See https://github.com/kubernetes/kubernetes/pull/95718#discussion_r520969477
// This is what controls the preferred serialization version. Add both v1beta1 and v1 here, and prefer v1beta1 over v1 until 1.21. See the comment on test/integration/etcd around serialized version.
//
// Details on why we can't advance the storage version for a release are at https://kubernetes.io/docs/reference/using-api/deprecation-policy/:
//
// > Rule #4b: The "preferred" API version and the "storage version" for a given group may not advance until after a release has been made that supports both the new version and the previous version
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion, v1.SchemeGroupVersion))
}

View File

@@ -29,7 +29,7 @@ import (
// user or cluster provisioner, and referenced in the PodSpec. The Kubelet is
// responsible for resolving the RuntimeClassName reference before running the
// pod. For more details, see
// https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md
// https://git.k8s.io/enhancements/keps/sig-node/585-runtime-class/README.md
type RuntimeClass struct {
metav1.TypeMeta
// +optional

35
pkg/apis/node/v1/BUILD Normal file
View File

@@ -0,0 +1,35 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"register.go",
"zz_generated.conversion.go",
],
importpath = "k8s.io/kubernetes/pkg/apis/node/v1",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/node:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

22
pkg/apis/node/v1/doc.go Normal file
View File

@@ -0,0 +1,22 @@
/*
Copyright 2020 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.
*/
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/node
// +k8s:conversion-gen-external-types=k8s.io/api/node/v1
// +groupName=node.k8s.io
package v1 // import "k8s.io/kubernetes/pkg/apis/node/v1"

View File

@@ -0,0 +1,39 @@
/*
Copyright 2020 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 v1
import (
nodev1 "k8s.io/api/node/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName for node API
const GroupName = "node.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
localSchemeBuilder = &nodev1.SchemeBuilder
// AddToScheme node API registration
AddToScheme = localSchemeBuilder.AddToScheme
)

View File

@@ -0,0 +1,172 @@
// +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 v1
import (
unsafe "unsafe"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/node/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
node "k8s.io/kubernetes/pkg/apis/node"
)
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((*v1.Overhead)(nil), (*node.Overhead)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_Overhead_To_node_Overhead(a.(*v1.Overhead), b.(*node.Overhead), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*node.Overhead)(nil), (*v1.Overhead)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_Overhead_To_v1_Overhead(a.(*node.Overhead), b.(*v1.Overhead), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.RuntimeClass)(nil), (*node.RuntimeClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_RuntimeClass_To_node_RuntimeClass(a.(*v1.RuntimeClass), b.(*node.RuntimeClass), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*node.RuntimeClass)(nil), (*v1.RuntimeClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_RuntimeClass_To_v1_RuntimeClass(a.(*node.RuntimeClass), b.(*v1.RuntimeClass), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.RuntimeClassList)(nil), (*node.RuntimeClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_RuntimeClassList_To_node_RuntimeClassList(a.(*v1.RuntimeClassList), b.(*node.RuntimeClassList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*node.RuntimeClassList)(nil), (*v1.RuntimeClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_RuntimeClassList_To_v1_RuntimeClassList(a.(*node.RuntimeClassList), b.(*v1.RuntimeClassList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1.Scheduling)(nil), (*node.Scheduling)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1_Scheduling_To_node_Scheduling(a.(*v1.Scheduling), b.(*node.Scheduling), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*node.Scheduling)(nil), (*v1.Scheduling)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_node_Scheduling_To_v1_Scheduling(a.(*node.Scheduling), b.(*v1.Scheduling), scope)
}); err != nil {
return err
}
return nil
}
func autoConvert_v1_Overhead_To_node_Overhead(in *v1.Overhead, out *node.Overhead, s conversion.Scope) error {
out.PodFixed = *(*core.ResourceList)(unsafe.Pointer(&in.PodFixed))
return nil
}
// Convert_v1_Overhead_To_node_Overhead is an autogenerated conversion function.
func Convert_v1_Overhead_To_node_Overhead(in *v1.Overhead, out *node.Overhead, s conversion.Scope) error {
return autoConvert_v1_Overhead_To_node_Overhead(in, out, s)
}
func autoConvert_node_Overhead_To_v1_Overhead(in *node.Overhead, out *v1.Overhead, s conversion.Scope) error {
out.PodFixed = *(*corev1.ResourceList)(unsafe.Pointer(&in.PodFixed))
return nil
}
// Convert_node_Overhead_To_v1_Overhead is an autogenerated conversion function.
func Convert_node_Overhead_To_v1_Overhead(in *node.Overhead, out *v1.Overhead, s conversion.Scope) error {
return autoConvert_node_Overhead_To_v1_Overhead(in, out, s)
}
func autoConvert_v1_RuntimeClass_To_node_RuntimeClass(in *v1.RuntimeClass, out *node.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Handler = in.Handler
out.Overhead = (*node.Overhead)(unsafe.Pointer(in.Overhead))
out.Scheduling = (*node.Scheduling)(unsafe.Pointer(in.Scheduling))
return nil
}
// Convert_v1_RuntimeClass_To_node_RuntimeClass is an autogenerated conversion function.
func Convert_v1_RuntimeClass_To_node_RuntimeClass(in *v1.RuntimeClass, out *node.RuntimeClass, s conversion.Scope) error {
return autoConvert_v1_RuntimeClass_To_node_RuntimeClass(in, out, s)
}
func autoConvert_node_RuntimeClass_To_v1_RuntimeClass(in *node.RuntimeClass, out *v1.RuntimeClass, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
out.Handler = in.Handler
out.Overhead = (*v1.Overhead)(unsafe.Pointer(in.Overhead))
out.Scheduling = (*v1.Scheduling)(unsafe.Pointer(in.Scheduling))
return nil
}
// Convert_node_RuntimeClass_To_v1_RuntimeClass is an autogenerated conversion function.
func Convert_node_RuntimeClass_To_v1_RuntimeClass(in *node.RuntimeClass, out *v1.RuntimeClass, s conversion.Scope) error {
return autoConvert_node_RuntimeClass_To_v1_RuntimeClass(in, out, s)
}
func autoConvert_v1_RuntimeClassList_To_node_RuntimeClassList(in *v1.RuntimeClassList, out *node.RuntimeClassList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]node.RuntimeClass)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1_RuntimeClassList_To_node_RuntimeClassList is an autogenerated conversion function.
func Convert_v1_RuntimeClassList_To_node_RuntimeClassList(in *v1.RuntimeClassList, out *node.RuntimeClassList, s conversion.Scope) error {
return autoConvert_v1_RuntimeClassList_To_node_RuntimeClassList(in, out, s)
}
func autoConvert_node_RuntimeClassList_To_v1_RuntimeClassList(in *node.RuntimeClassList, out *v1.RuntimeClassList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v1.RuntimeClass)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_node_RuntimeClassList_To_v1_RuntimeClassList is an autogenerated conversion function.
func Convert_node_RuntimeClassList_To_v1_RuntimeClassList(in *node.RuntimeClassList, out *v1.RuntimeClassList, s conversion.Scope) error {
return autoConvert_node_RuntimeClassList_To_v1_RuntimeClassList(in, out, s)
}
func autoConvert_v1_Scheduling_To_node_Scheduling(in *v1.Scheduling, out *node.Scheduling, s conversion.Scope) error {
out.NodeSelector = *(*map[string]string)(unsafe.Pointer(&in.NodeSelector))
out.Tolerations = *(*[]core.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_v1_Scheduling_To_node_Scheduling is an autogenerated conversion function.
func Convert_v1_Scheduling_To_node_Scheduling(in *v1.Scheduling, out *node.Scheduling, s conversion.Scope) error {
return autoConvert_v1_Scheduling_To_node_Scheduling(in, out, s)
}
func autoConvert_node_Scheduling_To_v1_Scheduling(in *node.Scheduling, out *v1.Scheduling, s conversion.Scope) error {
out.NodeSelector = *(*map[string]string)(unsafe.Pointer(&in.NodeSelector))
out.Tolerations = *(*[]corev1.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_node_Scheduling_To_v1_Scheduling is an autogenerated conversion function.
func Convert_node_Scheduling_To_v1_Scheduling(in *node.Scheduling, out *v1.Scheduling, s conversion.Scope) error {
return autoConvert_node_Scheduling_To_v1_Scheduling(in, out, s)
}