mirror of https://github.com/k3s-io/k3s
Add node.k8s.io/v1beta1 API
parent
63f61a6714
commit
820a1dc96b
|
@ -64,6 +64,7 @@ tags_values_pkgs = {"openapi-gen": {
|
|||
"staging/src/k8s.io/api/networking/v1",
|
||||
"staging/src/k8s.io/api/networking/v1beta1",
|
||||
"staging/src/k8s.io/api/node/v1alpha1",
|
||||
"staging/src/k8s.io/api/node/v1beta1",
|
||||
"staging/src/k8s.io/api/policy/v1beta1",
|
||||
"staging/src/k8s.io/api/rbac/v1",
|
||||
"staging/src/k8s.io/api/rbac/v1alpha1",
|
||||
|
@ -140,6 +141,7 @@ tags_pkgs_values = {"openapi-gen": {
|
|||
"staging/src/k8s.io/api/networking/v1": ["true"],
|
||||
"staging/src/k8s.io/api/networking/v1beta1": ["true"],
|
||||
"staging/src/k8s.io/api/node/v1alpha1": ["true"],
|
||||
"staging/src/k8s.io/api/node/v1beta1": ["true"],
|
||||
"staging/src/k8s.io/api/policy/v1beta1": ["true"],
|
||||
"staging/src/k8s.io/api/rbac/v1": ["true"],
|
||||
"staging/src/k8s.io/api/rbac/v1alpha1": ["true"],
|
||||
|
|
|
@ -276,7 +276,8 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{
|
|||
{Group: "coordination.k8s.io", Version: "v1"}: {group: 16500, version: 15},
|
||||
{Group: "coordination.k8s.io", Version: "v1beta1"}: {group: 16500, version: 9},
|
||||
{Group: "auditregistration.k8s.io", Version: "v1alpha1"}: {group: 16400, version: 1},
|
||||
{Group: "node.k8s.io", Version: "v1alpha1"}: {group: 16300, version: 9},
|
||||
{Group: "node.k8s.io", Version: "v1alpha1"}: {group: 16300, version: 1},
|
||||
{Group: "node.k8s.io", Version: "v1beta1"}: {group: 16300, version: 9},
|
||||
// Append a new group to the end of the list if unsure.
|
||||
// You can use min(existing group)-100 as the initial value for a group.
|
||||
// Version can be set to 9 (to have space around) for a new group.
|
||||
|
|
|
@ -50,6 +50,7 @@ pkg/apis/extensions/v1beta1
|
|||
pkg/apis/imagepolicy
|
||||
pkg/apis/networking
|
||||
pkg/apis/networking/v1
|
||||
pkg/apis/node/v1alpha1
|
||||
pkg/apis/policy
|
||||
pkg/apis/policy/v1beta1
|
||||
pkg/apis/policy/validation
|
||||
|
|
|
@ -81,6 +81,7 @@ imagepolicy.k8s.io/v1alpha1 \
|
|||
networking.k8s.io/v1 \
|
||||
networking.k8s.io/v1beta1 \
|
||||
node.k8s.io/v1alpha1 \
|
||||
node.k8s.io/v1beta1 \
|
||||
policy/v1beta1 \
|
||||
rbac.authorization.k8s.io/v1 \
|
||||
rbac.authorization.k8s.io/v1beta1 \
|
||||
|
|
|
@ -29,6 +29,7 @@ filegroup(
|
|||
":package-srcs",
|
||||
"//pkg/apis/node/install:all-srcs",
|
||||
"//pkg/apis/node/v1alpha1:all-srcs",
|
||||
"//pkg/apis/node/v1beta1:all-srcs",
|
||||
"//pkg/apis/node/validation:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
|
|
|
@ -9,6 +9,7 @@ go_library(
|
|||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/apis/node: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",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||
],
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/apis/node"
|
||||
"k8s.io/kubernetes/pkg/apis/node/v1alpha1"
|
||||
"k8s.io/kubernetes/pkg/apis/node/v1beta1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -34,5 +35,6 @@ func init() {
|
|||
func Install(scheme *runtime.Scheme) {
|
||||
utilruntime.Must(node.AddToScheme(scheme))
|
||||
utilruntime.Must(v1alpha1.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
|
||||
utilruntime.Must(v1beta1.AddToScheme(scheme))
|
||||
utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
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/v1beta1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/apis/node:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1beta1: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"],
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2019 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/v1beta1
|
||||
|
||||
// +groupName=node.k8s.io
|
||||
|
||||
package v1beta1 // import "k8s.io/kubernetes/pkg/apis/node/v1beta1"
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
Copyright 2019 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 v1beta1
|
||||
|
||||
import (
|
||||
nodev1beta1 "k8s.io/api/node/v1beta1"
|
||||
"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: "v1beta1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
localSchemeBuilder = &nodev1beta1.SchemeBuilder
|
||||
// AddToScheme node API registration
|
||||
AddToScheme = localSchemeBuilder.AddToScheme
|
||||
)
|
|
@ -92,6 +92,7 @@ go_library(
|
|||
"//staging/src/k8s.io/api/networking/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1alpha1:go_default_library",
|
||||
|
|
|
@ -48,6 +48,7 @@ import (
|
|||
networkingapiv1 "k8s.io/api/networking/v1"
|
||||
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
nodev1alpha1 "k8s.io/api/node/v1alpha1"
|
||||
nodev1beta1 "k8s.io/api/node/v1beta1"
|
||||
policyapiv1beta1 "k8s.io/api/policy/v1beta1"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
|
||||
|
@ -497,6 +498,7 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig {
|
|||
extensionsapiv1beta1.SchemeGroupVersion,
|
||||
networkingapiv1.SchemeGroupVersion,
|
||||
networkingapiv1beta1.SchemeGroupVersion,
|
||||
nodev1beta1.SchemeGroupVersion,
|
||||
policyapiv1beta1.SchemeGroupVersion,
|
||||
rbacv1.SchemeGroupVersion,
|
||||
rbacv1beta1.SchemeGroupVersion,
|
||||
|
|
|
@ -22,6 +22,7 @@ go_test(
|
|||
"//pkg/apis/coordination:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//pkg/apis/node:go_default_library",
|
||||
"//pkg/apis/policy:go_default_library",
|
||||
"//pkg/apis/scheduling:go_default_library",
|
||||
"//pkg/apis/storage:go_default_library",
|
||||
|
@ -69,6 +70,7 @@ go_library(
|
|||
"//pkg/apis/events/install:go_default_library",
|
||||
"//pkg/apis/extensions/install:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//pkg/apis/node:go_default_library",
|
||||
"//pkg/apis/policy:go_default_library",
|
||||
"//pkg/apis/policy/install:go_default_library",
|
||||
"//pkg/apis/rbac:go_default_library",
|
||||
|
|
|
@ -53,6 +53,7 @@ import (
|
|||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/core/helper"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
nodeapi "k8s.io/kubernetes/pkg/apis/node"
|
||||
"k8s.io/kubernetes/pkg/apis/policy"
|
||||
"k8s.io/kubernetes/pkg/apis/rbac"
|
||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||
|
@ -447,6 +448,14 @@ func AddHandlers(h printers.PrintHandler) {
|
|||
h.TableHandler(priorityClassColumnDefinitions, printPriorityClass)
|
||||
h.TableHandler(priorityClassColumnDefinitions, printPriorityClassList)
|
||||
|
||||
runtimeClassColumnDefinitions := []metav1beta1.TableColumnDefinition{
|
||||
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
|
||||
{Name: "Handler", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["handler"]},
|
||||
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
|
||||
}
|
||||
h.TableHandler(runtimeClassColumnDefinitions, printRuntimeClass)
|
||||
h.TableHandler(runtimeClassColumnDefinitions, printRuntimeClassList)
|
||||
|
||||
AddDefaultHandlers(h)
|
||||
}
|
||||
|
||||
|
@ -1971,6 +1980,30 @@ func printPriorityClassList(list *scheduling.PriorityClassList, options printers
|
|||
return rows, nil
|
||||
}
|
||||
|
||||
func printRuntimeClass(obj *nodeapi.RuntimeClass, options printers.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
row := metav1beta1.TableRow{
|
||||
Object: runtime.RawExtension{Object: obj},
|
||||
}
|
||||
|
||||
name := obj.Name
|
||||
handler := obj.Handler
|
||||
row.Cells = append(row.Cells, name, handler, translateTimestampSince(obj.CreationTimestamp))
|
||||
|
||||
return []metav1beta1.TableRow{row}, nil
|
||||
}
|
||||
|
||||
func printRuntimeClassList(list *nodeapi.RuntimeClassList, options printers.PrintOptions) ([]metav1beta1.TableRow, error) {
|
||||
rows := make([]metav1beta1.TableRow, 0, len(list.Items))
|
||||
for i := range list.Items {
|
||||
r, err := printRuntimeClass(&list.Items[i], options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rows = append(rows, r...)
|
||||
}
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
func printBoolPtr(value *bool) string {
|
||||
if value != nil {
|
||||
return printBool(*value)
|
||||
|
|
|
@ -51,6 +51,7 @@ import (
|
|||
"k8s.io/kubernetes/pkg/apis/coordination"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
nodeapi "k8s.io/kubernetes/pkg/apis/node"
|
||||
"k8s.io/kubernetes/pkg/apis/policy"
|
||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||
"k8s.io/kubernetes/pkg/apis/storage"
|
||||
|
@ -3556,6 +3557,50 @@ func TestPrintPriorityClass(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestPrintRuntimeClass(t *testing.T) {
|
||||
tests := []struct {
|
||||
rc nodeapi.RuntimeClass
|
||||
expect string
|
||||
}{
|
||||
{
|
||||
nodeapi.RuntimeClass{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "rc1",
|
||||
CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)},
|
||||
},
|
||||
Handler: "h1",
|
||||
},
|
||||
"rc1\th1\t0s\n",
|
||||
},
|
||||
{
|
||||
nodeapi.RuntimeClass{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "rc2",
|
||||
CreationTimestamp: metav1.Time{Time: time.Now().Add(-3e11)},
|
||||
},
|
||||
Handler: "h2",
|
||||
},
|
||||
"rc2\th2\t5m\n",
|
||||
},
|
||||
}
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
for _, test := range tests {
|
||||
table, err := printers.NewTablePrinter().With(AddHandlers).PrintTable(&test.rc, printers.PrintOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
verifyTable(t, table)
|
||||
if err := printers.PrintTable(table, buf, printers.PrintOptions{NoHeaders: true}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if buf.String() != test.expect {
|
||||
t.Fatalf("Expected: %s, got: %s", test.expect, buf.String())
|
||||
}
|
||||
buf.Reset()
|
||||
}
|
||||
}
|
||||
|
||||
func verifyTable(t *testing.T, table *metav1beta1.Table) {
|
||||
var panicErr interface{}
|
||||
func() {
|
||||
|
|
|
@ -7,8 +7,10 @@ go_library(
|
|||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/apis/node:go_default_library",
|
||||
"//pkg/registry/node/runtimeclass/storage:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/registry/generic:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library",
|
||||
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library",
|
||||
|
|
|
@ -18,11 +18,13 @@ package rest
|
|||
|
||||
import (
|
||||
nodev1alpha1 "k8s.io/api/node/v1alpha1"
|
||||
nodev1beta1 "k8s.io/api/node/v1beta1"
|
||||
"k8s.io/apiserver/pkg/registry/generic"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
genericapiserver "k8s.io/apiserver/pkg/server"
|
||||
serverstorage "k8s.io/apiserver/pkg/server/storage"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
nodeinternal "k8s.io/kubernetes/pkg/apis/node"
|
||||
runtimeclassstorage "k8s.io/kubernetes/pkg/registry/node/runtimeclass/storage"
|
||||
)
|
||||
|
||||
|
@ -31,11 +33,16 @@ type RESTStorageProvider struct{}
|
|||
|
||||
// NewRESTStorage returns a RESTStorageProvider
|
||||
func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool) {
|
||||
apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(nodev1alpha1.GroupName, legacyscheme.Scheme, legacyscheme.ParameterCodec, legacyscheme.Codecs)
|
||||
apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(nodeinternal.GroupName, legacyscheme.Scheme, legacyscheme.ParameterCodec, legacyscheme.Codecs)
|
||||
|
||||
if apiResourceConfigSource.VersionEnabled(nodev1alpha1.SchemeGroupVersion) {
|
||||
apiGroupInfo.VersionedResourcesStorageMap[nodev1alpha1.SchemeGroupVersion.Version] = p.v1alpha1Storage(apiResourceConfigSource, restOptionsGetter)
|
||||
}
|
||||
|
||||
if apiResourceConfigSource.VersionEnabled(nodev1beta1.SchemeGroupVersion) {
|
||||
apiGroupInfo.VersionedResourcesStorageMap[nodev1beta1.SchemeGroupVersion.Version] = p.v1beta1Storage(apiResourceConfigSource, restOptionsGetter)
|
||||
}
|
||||
|
||||
return apiGroupInfo, true
|
||||
}
|
||||
|
||||
|
@ -47,7 +54,15 @@ func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstora
|
|||
return storage
|
||||
}
|
||||
|
||||
func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) map[string]rest.Storage {
|
||||
storage := map[string]rest.Storage{}
|
||||
s := runtimeclassstorage.NewREST(restOptionsGetter)
|
||||
storage["runtimeclasses"] = s
|
||||
|
||||
return storage
|
||||
}
|
||||
|
||||
// GroupName is the group name for the storage provider
|
||||
func (p RESTStorageProvider) GroupName() string {
|
||||
return nodev1alpha1.GroupName
|
||||
return nodeinternal.GroupName
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ filegroup(
|
|||
"//staging/src/k8s.io/api/networking/v1:all-srcs",
|
||||
"//staging/src/k8s.io/api/networking/v1beta1:all-srcs",
|
||||
"//staging/src/k8s.io/api/node/v1alpha1:all-srcs",
|
||||
"//staging/src/k8s.io/api/node/v1beta1:all-srcs",
|
||||
"//staging/src/k8s.io/api/policy/v1beta1:all-srcs",
|
||||
"//staging/src/k8s.io/api/rbac/v1:all-srcs",
|
||||
"//staging/src/k8s.io/api/rbac/v1alpha1:all-srcs",
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"doc.go",
|
||||
"generated.pb.go",
|
||||
"register.go",
|
||||
"types.go",
|
||||
"types_swagger_doc_generated.go",
|
||||
"zz_generated.deepcopy.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/node/v1beta1",
|
||||
importpath = "k8s.io/api/node/v1beta1",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/github.com/gogo/protobuf/proto: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"],
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
Copyright 2019 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:deepcopy-gen=package
|
||||
// +k8s:openapi-gen=true
|
||||
|
||||
// +groupName=node.k8s.io
|
||||
|
||||
package v1beta1 // import "k8s.io/api/node/v1beta1"
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Copyright 2019 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 v1beta1
|
||||
|
||||
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 = "node.k8s.io"
|
||||
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
|
||||
var (
|
||||
// SchemeBuilder is the scheme builder with scheme init functions to run for this API package
|
||||
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
|
||||
// AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// addKnownTypes adds the list of known types to api.Scheme.
|
||||
func addKnownTypes(scheme *runtime.Scheme) error {
|
||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&RuntimeClass{},
|
||||
&RuntimeClassList{},
|
||||
)
|
||||
|
||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
Copyright 2019 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 v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// RuntimeClass defines a class of container runtime supported in the cluster.
|
||||
// The RuntimeClass is used to determine which container runtime is used to run
|
||||
// all containers in a pod. RuntimeClasses are (currently) manually defined by a
|
||||
// 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
|
||||
type RuntimeClass struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Handler specifies the underlying runtime and configuration that the CRI
|
||||
// implementation will use to handle pods of this class. The possible values
|
||||
// are specific to the node & CRI configuration. It is assumed that all
|
||||
// handlers are available on every node, and handlers of the same name are
|
||||
// equivalent on every node.
|
||||
// For example, a handler called "runc" might specify that the runc OCI
|
||||
// runtime (using native Linux containers) will be used to run the containers
|
||||
// in a pod.
|
||||
// The Handler must conform to the DNS Label (RFC 1123) requirements, and is
|
||||
// immutable.
|
||||
Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// RuntimeClassList is a list of RuntimeClass objects.
|
||||
type RuntimeClassList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata.
|
||||
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is a list of schema objects.
|
||||
Items []RuntimeClass `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
|
@ -34,6 +34,7 @@ go_test(
|
|||
"//staging/src/k8s.io/api/batch/v2alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/scheduling/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/settings/v1alpha1:go_default_library",
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
auditregv1alpha1 "k8s.io/api/auditregistration/v1alpha1"
|
||||
batchv2alpha1 "k8s.io/api/batch/v2alpha1"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
nodev1alpha1 "k8s.io/api/node/v1alpha1"
|
||||
rbacv1alpha1 "k8s.io/api/rbac/v1alpha1"
|
||||
schedulerapi "k8s.io/api/scheduling/v1beta1"
|
||||
settingsv1alpha1 "k8s.io/api/settings/v1alpha1"
|
||||
|
@ -150,6 +151,7 @@ func TestServerSidePrint(t *testing.T) {
|
|||
appsv1beta1.SchemeGroupVersion,
|
||||
appsv1beta2.SchemeGroupVersion,
|
||||
extensionsv1beta1.SchemeGroupVersion,
|
||||
nodev1alpha1.SchemeGroupVersion,
|
||||
},
|
||||
[]schema.GroupVersionResource{
|
||||
extensionsv1beta1.SchemeGroupVersion.WithResource("daemonsets"),
|
||||
|
|
|
@ -485,6 +485,21 @@ func GetEtcdStorageData() map[schema.GroupVersionResource]StorageData {
|
|||
ExpectedEtcdPath: "/registry/auditsinks/sink1",
|
||||
},
|
||||
// --
|
||||
|
||||
// k8s.io/kubernetes/pkg/apis/node/v1alpha1
|
||||
gvr("node.k8s.io", "v1alpha1", "runtimeclasses"): {
|
||||
Stub: `{"metadata": {"name": "rc1"}, "spec": {"runtimeHandler": "h1"}}`,
|
||||
ExpectedEtcdPath: "/registry/runtimeclasses/rc1",
|
||||
ExpectedGVK: gvkP("node.k8s.io", "v1beta1", "RuntimeClass"),
|
||||
},
|
||||
// --
|
||||
|
||||
// k8s.io/kubernetes/pkg/apis/node/v1beta1
|
||||
gvr("node.k8s.io", "v1beta1", "runtimeclasses"): {
|
||||
Stub: `{"metadata": {"name": "rc2"}, "handler": "h2"}`,
|
||||
ExpectedEtcdPath: "/registry/runtimeclasses/rc2",
|
||||
},
|
||||
// --
|
||||
}
|
||||
|
||||
// k8s.io/kubernetes/pkg/apis/storage/v1beta1
|
||||
|
|
|
@ -37,6 +37,7 @@ go_library(
|
|||
"//staging/src/k8s.io/api/certificates/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/rbac/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
|
|
|
@ -33,6 +33,7 @@ import (
|
|||
certificates "k8s.io/api/certificates/v1beta1"
|
||||
"k8s.io/api/core/v1"
|
||||
extensions "k8s.io/api/extensions/v1beta1"
|
||||
nodev1alpha1 "k8s.io/api/node/v1alpha1"
|
||||
rbac "k8s.io/api/rbac/v1alpha1"
|
||||
storage "k8s.io/api/storage/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
@ -311,6 +312,10 @@ func NewMasterConfig() *master.Config {
|
|||
schema.GroupResource{Group: auditreg.GroupName, Resource: serverstorage.AllResources},
|
||||
"",
|
||||
ns)
|
||||
storageFactory.SetSerializer(
|
||||
schema.GroupResource{Group: nodev1alpha1.GroupName, Resource: serverstorage.AllResources},
|
||||
"",
|
||||
ns)
|
||||
|
||||
genericConfig := genericapiserver.NewConfig(legacyscheme.Codecs)
|
||||
kubeVersion := version.Get()
|
||||
|
|
Loading…
Reference in New Issue