Skip to content
Permalink
Browse files

Merge pull request #81154 from yue9944882/bugfix/fixes-local-up-failure

[FEATURE BRANCH] Fixes type registration and post-start-hook failures
  • Loading branch information...
k8s-ci-robot committed Aug 9, 2019
2 parents 01ddb41 + 329b33b commit 3eb5b22b3b9518153f249e175212141e31a5c605

Large diffs are not rendered by default.

@@ -34,4 +34,5 @@ func init() {
func Install(scheme *runtime.Scheme) {
utilruntime.Must(flowcontrol.AddToScheme(scheme))
utilruntime.Must(flowcontrolv1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(flowcontrolv1alpha1.SchemeGroupVersion))
}
@@ -14,7 +14,6 @@ go_library(
deps = [
"//pkg/apis/flowcontrol: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/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
@@ -17,7 +17,7 @@ limitations under the License.
package v1alpha1

import (
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
"k8s.io/apimachinery/pkg/runtime/schema"
)

@@ -33,7 +33,7 @@ func Resource(resource string) schema.GroupResource {
}

var (
localSchemeBuilder = &extensionsv1beta1.SchemeBuilder
localSchemeBuilder = &flowcontrolv1alpha1.SchemeBuilder
// AddToScheme adds api to a scheme
AddToScheme = localSchemeBuilder.AddToScheme
)
@@ -92,6 +92,7 @@ go_library(
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/events/v1beta1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_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",
@@ -46,6 +46,7 @@ import (
apiv1 "k8s.io/api/core/v1"
eventsv1beta1 "k8s.io/api/events/v1beta1"
extensionsapiv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
networkingapiv1 "k8s.io/api/networking/v1"
networkingapiv1beta1 "k8s.io/api/networking/v1beta1"
nodev1alpha1 "k8s.io/api/node/v1alpha1"
@@ -538,6 +539,7 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig {
schedulingv1alpha1.SchemeGroupVersion,
settingsv1alpha1.SchemeGroupVersion,
storageapiv1alpha1.SchemeGroupVersion,
flowcontrolv1alpha1.SchemeGroupVersion,
)

return ret
@@ -8,9 +8,6 @@ go_library(
deps = [
"//pkg/apis/flowcontrol:go_default_library",
"//pkg/apis/flowcontrol/bootstrap:go_default_library",
"//pkg/printers:go_default_library",
"//pkg/printers/internalversion:go_default_library",
"//pkg/printers/storage:go_default_library",
"//pkg/registry/flowcontrol/flowschema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
@@ -28,9 +28,6 @@ import (
"k8s.io/apiserver/pkg/registry/rest"
"k8s.io/kubernetes/pkg/apis/flowcontrol"
flowcontrolbootstrap "k8s.io/kubernetes/pkg/apis/flowcontrol/bootstrap"
"k8s.io/kubernetes/pkg/printers"
printersinternal "k8s.io/kubernetes/pkg/printers/internalversion"
printerstorage "k8s.io/kubernetes/pkg/printers/storage"
"k8s.io/kubernetes/pkg/registry/flowcontrol/flowschema"
)

@@ -58,15 +55,15 @@ type REST struct {
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST) {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &flowcontrol.FlowSchema{} },
NewListFunc: func() runtime.Object { return &flowcontrol.FlowSchema{} },
NewListFunc: func() runtime.Object { return &flowcontrol.FlowSchemaList{} },
DefaultQualifiedResource: flowcontrol.Resource("flowschemas"),

CreateStrategy: flowschema.Strategy,
UpdateStrategy: flowschema.Strategy,
DeleteStrategy: flowschema.Strategy,

// TODO: develop printer handler for flowschema resource
TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
// TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
}
options := &generic.StoreOptions{RESTOptions: optsGetter}
if err := store.CompleteWithOptions(options); err != nil {
@@ -8,9 +8,6 @@ go_library(
deps = [
"//pkg/apis/flowcontrol:go_default_library",
"//pkg/apis/flowcontrol/bootstrap:go_default_library",
"//pkg/printers:go_default_library",
"//pkg/printers/internalversion:go_default_library",
"//pkg/printers/storage:go_default_library",
"//pkg/registry/flowcontrol/flowschema:go_default_library",
"//pkg/registry/flowcontrol/prioritylevelconfiguration:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
@@ -28,9 +28,6 @@ import (
"k8s.io/apiserver/pkg/registry/rest"
"k8s.io/kubernetes/pkg/apis/flowcontrol"
flowcontrolbootstrap "k8s.io/kubernetes/pkg/apis/flowcontrol/bootstrap"
"k8s.io/kubernetes/pkg/printers"
printersinternal "k8s.io/kubernetes/pkg/printers/internalversion"
printerstorage "k8s.io/kubernetes/pkg/printers/storage"
"k8s.io/kubernetes/pkg/registry/flowcontrol/flowschema"
"k8s.io/kubernetes/pkg/registry/flowcontrol/prioritylevelconfiguration"
)
@@ -59,15 +56,15 @@ type REST struct {
func NewREST(optsGetter generic.RESTOptionsGetter) (*REST, *StatusREST) {
store := &genericregistry.Store{
NewFunc: func() runtime.Object { return &flowcontrol.PriorityLevelConfiguration{} },
NewListFunc: func() runtime.Object { return &flowcontrol.PriorityLevelConfiguration{} },
NewListFunc: func() runtime.Object { return &flowcontrol.PriorityLevelConfigurationList{} },
DefaultQualifiedResource: flowcontrol.Resource("prioritylevelconfigurations"),

CreateStrategy: prioritylevelconfiguration.Strategy,
UpdateStrategy: prioritylevelconfiguration.Strategy,
DeleteStrategy: prioritylevelconfiguration.Strategy,

// TODO: develop printer handler for prioritylevelconfiguration resource
TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
// TableConvertor: printerstorage.TableConvertor{TableGenerator: printers.NewTableGenerator().With(printersinternal.AddHandlers)},
}
options := &generic.StoreOptions{RESTOptions: optsGetter}
if err := store.CompleteWithOptions(options); err != nil {
@@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
@@ -52,5 +53,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&PriorityLevelConfiguration{},
&PriorityLevelConfigurationList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
@@ -553,8 +553,8 @@ func (c completedConfig) New(name string, delegationTarget DelegationTarget) (*G
}
}

if feature.DefaultFeatureGate.Enabled(features.RequestManagement) {
requestManagementHookName := "generic-apiserver-request-management"
requestManagementHookName := "generic-apiserver-request-management"
if feature.DefaultFeatureGate.Enabled(features.RequestManagement) && !s.isPostStartHookRegistered(requestManagementHookName) {
err := s.AddPostStartHook(requestManagementHookName, func(context PostStartHookContext) error {
return c.RequestManagement.Run(context.StopCh)
})
@@ -136,6 +136,8 @@ var missingHanlders = sets.NewString(
"AuditSink",
"CSINode",
"CSIDriver",
"FlowSchema",
"PriorityLevelConfiguration",
)

func TestServerSidePrint(t *testing.T) {
@@ -152,6 +154,7 @@ func TestServerSidePrint(t *testing.T) {
appsv1beta2.SchemeGroupVersion,
extensionsv1beta1.SchemeGroupVersion,
nodev1alpha1.SchemeGroupVersion,
//flowcontrolv1alph1.SchemeGroupVersion,
},
[]schema.GroupVersionResource{
extensionsv1beta1.SchemeGroupVersion.WithResource("daemonsets"),

0 comments on commit 3eb5b22

Please sign in to comment.
You can’t perform that action at this time.