require codecfactory

Kubernetes-commit: 087a03022106c02f82a497f65b945f3cbab3f643
This commit is contained in:
deads2k 2017-03-10 12:38:40 -05:00 committed by Kubernetes Publisher
parent 6e5dbf8e26
commit 8c644986dc
6 changed files with 10 additions and 12 deletions

View File

@ -196,8 +196,9 @@ type SecureServingInfo struct {
}
// NewConfig returns a Config struct with the default values
func NewConfig() *Config {
func NewConfig(codecs serializer.CodecFactory) *Config {
return &Config{
Serializer: codecs,
ReadWritePort: 443,
RequestContextMapper: apirequest.NewRequestContextMapper(),
BuildHandlerChainsFunc: DefaultBuildHandlerChain,
@ -216,11 +217,6 @@ func NewConfig() *Config {
}
}
func (c *Config) WithSerializer(codecs serializer.CodecFactory) *Config {
c.Serializer = codecs
return c
}
func DefaultOpenAPIConfig(getDefinitions openapicommon.GetOpenAPIDefinitions, scheme *runtime.Scheme) *openapicommon.Config {
defNamer := apiopenapi.NewDefinitionNamer(scheme)
return &openapicommon.Config{

View File

@ -33,7 +33,7 @@ import (
)
func TestNewWithDelegate(t *testing.T) {
delegateConfig := NewConfig().WithSerializer(codecs)
delegateConfig := NewConfig(codecs)
delegateConfig.PublicAddress = net.ParseIP("192.168.10.4")
delegateConfig.RequestContextMapper = genericapirequest.NewRequestContextMapper()
delegateConfig.LegacyAPIGroupPrefixes = sets.NewString("/api")
@ -63,7 +63,7 @@ func TestNewWithDelegate(t *testing.T) {
// this wires up swagger
delegateServer.PrepareRun()
wrappingConfig := NewConfig().WithSerializer(codecs)
wrappingConfig := NewConfig(codecs)
wrappingConfig.PublicAddress = net.ParseIP("192.168.10.4")
wrappingConfig.RequestContextMapper = genericapirequest.NewRequestContextMapper()
wrappingConfig.LegacyAPIGroupPrefixes = sets.NewString("/api")

View File

@ -86,7 +86,7 @@ func testGetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi
func setUp(t *testing.T) (*etcdtesting.EtcdTestServer, Config, *assert.Assertions) {
etcdServer, _ := etcdtesting.NewUnsecuredEtcd3TestClientServer(t, scheme)
config := NewConfig().WithSerializer(codecs)
config := NewConfig(codecs)
config.PublicAddress = net.ParseIP("192.168.10.4")
config.RequestContextMapper = genericapirequest.NewRequestContextMapper()
config.LegacyAPIGroupPrefixes = sets.NewString("/api")

View File

@ -19,6 +19,7 @@ package options
import (
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apiserver/pkg/server"
)
@ -29,7 +30,7 @@ type FeatureOptions struct {
}
func NewFeatureOptions() *FeatureOptions {
defaults := server.NewConfig()
defaults := server.NewConfig(serializer.CodecFactory{})
return &FeatureOptions{
EnableProfiling: defaults.EnableProfiling,

View File

@ -22,6 +22,7 @@ import (
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/serializer"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/server"
utilfeature "k8s.io/apiserver/pkg/util/feature"
@ -48,7 +49,7 @@ type ServerRunOptions struct {
}
func NewServerRunOptions() *ServerRunOptions {
defaults := server.NewConfig()
defaults := server.NewConfig(serializer.CodecFactory{})
return &ServerRunOptions{
AdmissionControl: "AlwaysAdmit",

View File

@ -46,7 +46,7 @@ func setUp(t *testing.T) Config {
scheme := runtime.NewScheme()
codecs := serializer.NewCodecFactory(scheme)
config := NewConfig().WithSerializer(codecs)
config := NewConfig(codecs)
config.RequestContextMapper = genericapirequest.NewRequestContextMapper()
return *config