Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6149df08
Commit
6149df08
authored
Dec 01, 2017
by
xuzhonghu
Committed by
hzxuzhonghu
Dec 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add admission into RecommendedOption
parent
45db5e72
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
69 additions
and
27 deletions
+69
-27
start.go
...rc/k8s.io/apiextensions-apiserver/pkg/cmd/server/start.go
+1
-1
start.go
...extensions-apiserver/test/integration/testserver/start.go
+2
-1
config.go
staging/src/k8s.io/apiserver/pkg/server/config.go
+5
-0
admission.go
staging/src/k8s.io/apiserver/pkg/server/options/admission.go
+4
-0
recommended.go
...ng/src/k8s.io/apiserver/pkg/server/options/recommended.go
+41
-1
start.go
staging/src/k8s.io/kube-aggregator/pkg/cmd/server/start.go
+1
-1
admission_test.go
...iserver/pkg/admission/plugin/banflunder/admission_test.go
+1
-4
wardleinitializer.go
...rver/pkg/admission/wardleinitializer/wardleinitializer.go
+2
-2
wardleinitializer_test.go
...pkg/admission/wardleinitializer/wardleinitializer_test.go
+2
-4
start.go
staging/src/k8s.io/sample-apiserver/pkg/cmd/server/start.go
+10
-13
No files found.
staging/src/k8s.io/apiextensions-apiserver/pkg/cmd/server/start.go
View file @
6149df08
...
@@ -98,7 +98,7 @@ func (o CustomResourceDefinitionsServerOptions) Config() (*apiserver.Config, err
...
@@ -98,7 +98,7 @@ func (o CustomResourceDefinitionsServerOptions) Config() (*apiserver.Config, err
}
}
serverConfig
:=
genericapiserver
.
NewRecommendedConfig
(
apiserver
.
Codecs
)
serverConfig
:=
genericapiserver
.
NewRecommendedConfig
(
apiserver
.
Codecs
)
if
err
:=
o
.
RecommendedOptions
.
ApplyTo
(
serverConfig
);
err
!=
nil
{
if
err
:=
o
.
RecommendedOptions
.
ApplyTo
(
serverConfig
,
apiserver
.
Scheme
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
staging/src/k8s.io/apiextensions-apiserver/test/integration/testserver/start.go
View file @
6149df08
...
@@ -45,6 +45,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
...
@@ -45,6 +45,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
options
.
RecommendedOptions
.
SecureServing
.
BindPort
=
port
options
.
RecommendedOptions
.
SecureServing
.
BindPort
=
port
options
.
RecommendedOptions
.
Authentication
=
nil
// disable
options
.
RecommendedOptions
.
Authentication
=
nil
// disable
options
.
RecommendedOptions
.
Authorization
=
nil
// disable
options
.
RecommendedOptions
.
Authorization
=
nil
// disable
options
.
RecommendedOptions
.
Admission
=
nil
// disable
options
.
RecommendedOptions
.
SecureServing
.
BindAddress
=
net
.
ParseIP
(
"127.0.0.1"
)
options
.
RecommendedOptions
.
SecureServing
.
BindAddress
=
net
.
ParseIP
(
"127.0.0.1"
)
etcdURL
,
ok
:=
os
.
LookupEnv
(
"KUBE_INTEGRATION_ETCD_URL"
)
etcdURL
,
ok
:=
os
.
LookupEnv
(
"KUBE_INTEGRATION_ETCD_URL"
)
if
!
ok
{
if
!
ok
{
...
@@ -58,7 +59,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
...
@@ -58,7 +59,7 @@ func DefaultServerConfig() (*extensionsapiserver.Config, error) {
if
err
:=
options
.
RecommendedOptions
.
SecureServing
.
MaybeDefaultWithSelfSignedCerts
(
"localhost"
,
nil
,
[]
net
.
IP
{
net
.
ParseIP
(
"127.0.0.1"
)});
err
!=
nil
{
if
err
:=
options
.
RecommendedOptions
.
SecureServing
.
MaybeDefaultWithSelfSignedCerts
(
"localhost"
,
nil
,
[]
net
.
IP
{
net
.
ParseIP
(
"127.0.0.1"
)});
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error creating self-signed certificates: %v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"error creating self-signed certificates: %v"
,
err
)
}
}
if
err
:=
options
.
RecommendedOptions
.
ApplyTo
(
genericConfig
);
err
!=
nil
{
if
err
:=
options
.
RecommendedOptions
.
ApplyTo
(
genericConfig
,
nil
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
staging/src/k8s.io/apiserver/pkg/server/config.go
View file @
6149df08
...
@@ -188,9 +188,13 @@ type Config struct {
...
@@ -188,9 +188,13 @@ type Config struct {
PublicAddress
net
.
IP
PublicAddress
net
.
IP
}
}
type
AdmissionInitializersInitFunc
func
()
(
admission
.
PluginInitializer
,
error
)
type
RecommendedConfig
struct
{
type
RecommendedConfig
struct
{
Config
Config
ExtraAdmissionInitializersInitFunc
[]
AdmissionInitializersInitFunc
// SharedInformerFactory provides shared informers for Kubernetes resources. This value is set by
// SharedInformerFactory provides shared informers for Kubernetes resources. This value is set by
// RecommendedOptions.CoreAPI.ApplyTo called by RecommendedOptions.ApplyTo. It uses an in-cluster client config
// RecommendedOptions.CoreAPI.ApplyTo called by RecommendedOptions.ApplyTo. It uses an in-cluster client config
// by default, or the kubeconfig given with kubeconfig command line flag.
// by default, or the kubeconfig given with kubeconfig command line flag.
...
@@ -259,6 +263,7 @@ func NewConfig(codecs serializer.CodecFactory) *Config {
...
@@ -259,6 +263,7 @@ func NewConfig(codecs serializer.CodecFactory) *Config {
func
NewRecommendedConfig
(
codecs
serializer
.
CodecFactory
)
*
RecommendedConfig
{
func
NewRecommendedConfig
(
codecs
serializer
.
CodecFactory
)
*
RecommendedConfig
{
return
&
RecommendedConfig
{
return
&
RecommendedConfig
{
Config
:
*
NewConfig
(
codecs
),
Config
:
*
NewConfig
(
codecs
),
ExtraAdmissionInitializersInitFunc
:
make
([]
AdmissionInitializersInitFunc
,
0
),
}
}
}
}
...
...
staging/src/k8s.io/apiserver/pkg/server/options/admission.go
View file @
6149df08
...
@@ -100,6 +100,10 @@ func (a *AdmissionOptions) ApplyTo(
...
@@ -100,6 +100,10 @@ func (a *AdmissionOptions) ApplyTo(
scheme
*
runtime
.
Scheme
,
scheme
*
runtime
.
Scheme
,
pluginInitializers
...
admission
.
PluginInitializer
,
pluginInitializers
...
admission
.
PluginInitializer
,
)
error
{
)
error
{
if
a
==
nil
{
return
nil
}
pluginNames
:=
a
.
PluginNames
pluginNames
:=
a
.
PluginNames
if
len
(
a
.
PluginNames
)
==
0
{
if
len
(
a
.
PluginNames
)
==
0
{
pluginNames
=
a
.
enabledPluginNames
()
pluginNames
=
a
.
enabledPluginNames
()
...
...
staging/src/k8s.io/apiserver/pkg/server/options/recommended.go
View file @
6149df08
...
@@ -17,9 +17,12 @@ limitations under the License.
...
@@ -17,9 +17,12 @@ limitations under the License.
package
options
package
options
import
(
import
(
"fmt"
"github.com/spf13/pflag"
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/admission"
"k8s.io/apiserver/pkg/server"
"k8s.io/apiserver/pkg/server"
"k8s.io/apiserver/pkg/storage/storagebackend"
"k8s.io/apiserver/pkg/storage/storagebackend"
)
)
...
@@ -35,6 +38,7 @@ type RecommendedOptions struct {
...
@@ -35,6 +38,7 @@ type RecommendedOptions struct {
Audit
*
AuditOptions
Audit
*
AuditOptions
Features
*
FeatureOptions
Features
*
FeatureOptions
CoreAPI
*
CoreAPIOptions
CoreAPI
*
CoreAPIOptions
Admission
*
AdmissionOptions
}
}
func
NewRecommendedOptions
(
prefix
string
,
codec
runtime
.
Codec
)
*
RecommendedOptions
{
func
NewRecommendedOptions
(
prefix
string
,
codec
runtime
.
Codec
)
*
RecommendedOptions
{
...
@@ -46,6 +50,7 @@ func NewRecommendedOptions(prefix string, codec runtime.Codec) *RecommendedOptio
...
@@ -46,6 +50,7 @@ func NewRecommendedOptions(prefix string, codec runtime.Codec) *RecommendedOptio
Audit
:
NewAuditOptions
(),
Audit
:
NewAuditOptions
(),
Features
:
NewFeatureOptions
(),
Features
:
NewFeatureOptions
(),
CoreAPI
:
NewCoreAPIOptions
(),
CoreAPI
:
NewCoreAPIOptions
(),
Admission
:
NewAdmissionOptions
(),
}
}
}
}
...
@@ -57,9 +62,13 @@ func (o *RecommendedOptions) AddFlags(fs *pflag.FlagSet) {
...
@@ -57,9 +62,13 @@ func (o *RecommendedOptions) AddFlags(fs *pflag.FlagSet) {
o
.
Audit
.
AddFlags
(
fs
)
o
.
Audit
.
AddFlags
(
fs
)
o
.
Features
.
AddFlags
(
fs
)
o
.
Features
.
AddFlags
(
fs
)
o
.
CoreAPI
.
AddFlags
(
fs
)
o
.
CoreAPI
.
AddFlags
(
fs
)
o
.
Admission
.
AddFlags
(
fs
)
}
}
func
(
o
*
RecommendedOptions
)
ApplyTo
(
config
*
server
.
RecommendedConfig
)
error
{
// ApplyTo adds RecommendedOptions to the server configuration.
// scheme is the scheme of the apiserver types that are sent to the admission chain.
// pluginInitializers can be empty, it is only need for additional initializers.
func
(
o
*
RecommendedOptions
)
ApplyTo
(
config
*
server
.
RecommendedConfig
,
scheme
*
runtime
.
Scheme
)
error
{
if
err
:=
o
.
Etcd
.
ApplyTo
(
&
config
.
Config
);
err
!=
nil
{
if
err
:=
o
.
Etcd
.
ApplyTo
(
&
config
.
Config
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -81,6 +90,36 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error {
...
@@ -81,6 +90,36 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error {
if
err
:=
o
.
CoreAPI
.
ApplyTo
(
config
);
err
!=
nil
{
if
err
:=
o
.
CoreAPI
.
ApplyTo
(
config
);
err
!=
nil
{
return
err
return
err
}
}
if
o
.
Admission
!=
nil
{
// Admission depends on CoreAPI to set SharedInformerFactory and ClientConfig.
if
o
.
CoreAPI
==
nil
{
return
fmt
.
Errorf
(
"admission depends on CoreAPI, so it must be set"
)
}
// Admission need scheme to construct admission initializer.
if
scheme
==
nil
{
return
fmt
.
Errorf
(
"admission depends on shceme, so it must be set"
)
}
pluginInitializers
:=
[]
admission
.
PluginInitializer
{}
for
_
,
initFunc
:=
range
config
.
ExtraAdmissionInitializersInitFunc
{
intializer
,
err
:=
initFunc
()
if
err
!=
nil
{
return
err
}
pluginInitializers
=
append
(
pluginInitializers
,
intializer
)
}
err
:=
o
.
Admission
.
ApplyTo
(
&
config
.
Config
,
config
.
SharedInformerFactory
,
config
.
ClientConfig
,
scheme
,
pluginInitializers
...
)
if
err
!=
nil
{
return
err
}
}
return
nil
return
nil
}
}
...
@@ -93,6 +132,7 @@ func (o *RecommendedOptions) Validate() []error {
...
@@ -93,6 +132,7 @@ func (o *RecommendedOptions) Validate() []error {
errors
=
append
(
errors
,
o
.
Audit
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Audit
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Features
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Features
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
CoreAPI
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
CoreAPI
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Admission
.
Validate
()
...
)
return
errors
return
errors
}
}
staging/src/k8s.io/kube-aggregator/pkg/cmd/server/start.go
View file @
6149df08
...
@@ -109,7 +109,7 @@ func (o AggregatorOptions) RunAggregator(stopCh <-chan struct{}) error {
...
@@ -109,7 +109,7 @@ func (o AggregatorOptions) RunAggregator(stopCh <-chan struct{}) error {
serverConfig
:=
genericapiserver
.
NewRecommendedConfig
(
apiserver
.
Codecs
)
serverConfig
:=
genericapiserver
.
NewRecommendedConfig
(
apiserver
.
Codecs
)
if
err
:=
o
.
RecommendedOptions
.
ApplyTo
(
serverConfig
);
err
!=
nil
{
if
err
:=
o
.
RecommendedOptions
.
ApplyTo
(
serverConfig
,
apiserver
.
Scheme
);
err
!=
nil
{
return
err
return
err
}
}
serverConfig
.
LongRunningFunc
=
filters
.
BasicLongRunningRequestCheck
(
serverConfig
.
LongRunningFunc
=
filters
.
BasicLongRunningRequestCheck
(
...
...
staging/src/k8s.io/sample-apiserver/pkg/admission/plugin/banflunder/admission_test.go
View file @
6149df08
...
@@ -113,10 +113,7 @@ func TestBanflunderAdmissionPlugin(t *testing.T) {
...
@@ -113,10 +113,7 @@ func TestBanflunderAdmissionPlugin(t *testing.T) {
t
.
Fatalf
(
"scenario %d: failed to create banflunder admission plugin due to = %v"
,
index
,
err
)
t
.
Fatalf
(
"scenario %d: failed to create banflunder admission plugin due to = %v"
,
index
,
err
)
}
}
targetInitializer
,
err
:=
wardleinitializer
.
New
(
informersFactory
)
targetInitializer
:=
wardleinitializer
.
New
(
informersFactory
)
if
err
!=
nil
{
t
.
Fatalf
(
"scenario %d: failed to crate wardle plugin initializer due to = %v"
,
index
,
err
)
}
targetInitializer
.
Initialize
(
target
)
targetInitializer
.
Initialize
(
target
)
err
=
admission
.
ValidateInitialization
(
target
)
err
=
admission
.
ValidateInitialization
(
target
)
...
...
staging/src/k8s.io/sample-apiserver/pkg/admission/wardleinitializer/wardleinitializer.go
View file @
6149df08
...
@@ -28,10 +28,10 @@ type pluginInitializer struct {
...
@@ -28,10 +28,10 @@ type pluginInitializer struct {
var
_
admission
.
PluginInitializer
=
pluginInitializer
{}
var
_
admission
.
PluginInitializer
=
pluginInitializer
{}
// New creates an instance of wardle admission plugins initializer.
// New creates an instance of wardle admission plugins initializer.
func
New
(
informers
informers
.
SharedInformerFactory
)
(
pluginInitializer
,
error
)
{
func
New
(
informers
informers
.
SharedInformerFactory
)
pluginInitializer
{
return
pluginInitializer
{
return
pluginInitializer
{
informers
:
informers
,
informers
:
informers
,
}
,
nil
}
}
}
// Initialize checks the initialization interfaces implemented by a plugin
// Initialize checks the initialization interfaces implemented by a plugin
...
...
staging/src/k8s.io/sample-apiserver/pkg/admission/wardleinitializer/wardleinitializer_test.go
View file @
6149df08
...
@@ -31,10 +31,8 @@ import (
...
@@ -31,10 +31,8 @@ import (
func
TestWantsInternalWardleInformerFactory
(
t
*
testing
.
T
)
{
func
TestWantsInternalWardleInformerFactory
(
t
*
testing
.
T
)
{
cs
:=
&
fake
.
Clientset
{}
cs
:=
&
fake
.
Clientset
{}
sf
:=
informers
.
NewSharedInformerFactory
(
cs
,
time
.
Duration
(
1
)
*
time
.
Second
)
sf
:=
informers
.
NewSharedInformerFactory
(
cs
,
time
.
Duration
(
1
)
*
time
.
Second
)
target
,
err
:=
wardleinitializer
.
New
(
sf
)
target
:=
wardleinitializer
.
New
(
sf
)
if
err
!=
nil
{
t
.
Fatalf
(
"expected to create an instance of initializer but got an error = %s"
,
err
.
Error
())
}
wantWardleInformerFactory
:=
&
wantInternalWardleInformerFactory
{}
wantWardleInformerFactory
:=
&
wantInternalWardleInformerFactory
{}
target
.
Initialize
(
wantWardleInformerFactory
)
target
.
Initialize
(
wantWardleInformerFactory
)
if
wantWardleInformerFactory
.
sf
!=
sf
{
if
wantWardleInformerFactory
.
sf
!=
sf
{
...
...
staging/src/k8s.io/sample-apiserver/pkg/cmd/server/start.go
View file @
6149df08
...
@@ -24,6 +24,7 @@ import (
...
@@ -24,6 +24,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apiserver/pkg/admission"
genericapiserver
"k8s.io/apiserver/pkg/server"
genericapiserver
"k8s.io/apiserver/pkg/server"
genericoptions
"k8s.io/apiserver/pkg/server/options"
genericoptions
"k8s.io/apiserver/pkg/server/options"
"k8s.io/sample-apiserver/pkg/admission/plugin/banflunder"
"k8s.io/sample-apiserver/pkg/admission/plugin/banflunder"
...
@@ -38,8 +39,8 @@ const defaultEtcdPathPrefix = "/registry/wardle.kubernetes.io"
...
@@ -38,8 +39,8 @@ const defaultEtcdPathPrefix = "/registry/wardle.kubernetes.io"
type
WardleServerOptions
struct
{
type
WardleServerOptions
struct
{
RecommendedOptions
*
genericoptions
.
RecommendedOptions
RecommendedOptions
*
genericoptions
.
RecommendedOptions
Admission
*
genericoptions
.
AdmissionOptions
SharedInformerFactory
informers
.
SharedInformerFactory
StdOut
io
.
Writer
StdOut
io
.
Writer
StdErr
io
.
Writer
StdErr
io
.
Writer
}
}
...
@@ -47,7 +48,6 @@ type WardleServerOptions struct {
...
@@ -47,7 +48,6 @@ type WardleServerOptions struct {
func
NewWardleServerOptions
(
out
,
errOut
io
.
Writer
)
*
WardleServerOptions
{
func
NewWardleServerOptions
(
out
,
errOut
io
.
Writer
)
*
WardleServerOptions
{
o
:=
&
WardleServerOptions
{
o
:=
&
WardleServerOptions
{
RecommendedOptions
:
genericoptions
.
NewRecommendedOptions
(
defaultEtcdPathPrefix
,
apiserver
.
Codecs
.
LegacyCodec
(
v1alpha1
.
SchemeGroupVersion
)),
RecommendedOptions
:
genericoptions
.
NewRecommendedOptions
(
defaultEtcdPathPrefix
,
apiserver
.
Codecs
.
LegacyCodec
(
v1alpha1
.
SchemeGroupVersion
)),
Admission
:
genericoptions
.
NewAdmissionOptions
(),
StdOut
:
out
,
StdOut
:
out
,
StdErr
:
errOut
,
StdErr
:
errOut
,
...
@@ -79,7 +79,6 @@ func NewCommandStartWardleServer(out, errOut io.Writer, stopCh <-chan struct{})
...
@@ -79,7 +79,6 @@ func NewCommandStartWardleServer(out, errOut io.Writer, stopCh <-chan struct{})
flags
:=
cmd
.
Flags
()
flags
:=
cmd
.
Flags
()
o
.
RecommendedOptions
.
AddFlags
(
flags
)
o
.
RecommendedOptions
.
AddFlags
(
flags
)
o
.
Admission
.
AddFlags
(
flags
)
return
cmd
return
cmd
}
}
...
@@ -87,7 +86,6 @@ func NewCommandStartWardleServer(out, errOut io.Writer, stopCh <-chan struct{})
...
@@ -87,7 +86,6 @@ func NewCommandStartWardleServer(out, errOut io.Writer, stopCh <-chan struct{})
func
(
o
WardleServerOptions
)
Validate
(
args
[]
string
)
error
{
func
(
o
WardleServerOptions
)
Validate
(
args
[]
string
)
error
{
errors
:=
[]
error
{}
errors
:=
[]
error
{}
errors
=
append
(
errors
,
o
.
RecommendedOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
RecommendedOptions
.
Validate
()
...
)
errors
=
append
(
errors
,
o
.
Admission
.
Validate
()
...
)
return
utilerrors
.
NewAggregate
(
errors
)
return
utilerrors
.
NewAggregate
(
errors
)
}
}
...
@@ -95,9 +93,9 @@ func (o *WardleServerOptions) Complete() error {
...
@@ -95,9 +93,9 @@ func (o *WardleServerOptions) Complete() error {
return
nil
return
nil
}
}
func
(
o
WardleServerOptions
)
Config
()
(
*
apiserver
.
Config
,
error
)
{
func
(
o
*
WardleServerOptions
)
Config
()
(
*
apiserver
.
Config
,
error
)
{
// register admission plugins
// register admission plugins
banflunder
.
Register
(
o
.
Admission
.
Plugins
)
banflunder
.
Register
(
o
.
RecommendedOptions
.
Admission
.
Plugins
)
// TODO have a "real" external address
// TODO have a "real" external address
if
err
:=
o
.
RecommendedOptions
.
SecureServing
.
MaybeDefaultWithSelfSignedCerts
(
"localhost"
,
nil
,
[]
net
.
IP
{
net
.
ParseIP
(
"127.0.0.1"
)});
err
!=
nil
{
if
err
:=
o
.
RecommendedOptions
.
SecureServing
.
MaybeDefaultWithSelfSignedCerts
(
"localhost"
,
nil
,
[]
net
.
IP
{
net
.
ParseIP
(
"127.0.0.1"
)});
err
!=
nil
{
...
@@ -105,21 +103,20 @@ func (o WardleServerOptions) Config() (*apiserver.Config, error) {
...
@@ -105,21 +103,20 @@ func (o WardleServerOptions) Config() (*apiserver.Config, error) {
}
}
serverConfig
:=
genericapiserver
.
NewRecommendedConfig
(
apiserver
.
Codecs
)
serverConfig
:=
genericapiserver
.
NewRecommendedConfig
(
apiserver
.
Codecs
)
if
err
:=
o
.
RecommendedOptions
.
ApplyTo
(
serverConfig
);
err
!=
nil
{
return
nil
,
err
}
admissionInitializerInitFunc
:=
func
()
(
admission
.
PluginInitializer
,
error
)
{
client
,
err
:=
clientset
.
NewForConfig
(
serverConfig
.
LoopbackClientConfig
)
client
,
err
:=
clientset
.
NewForConfig
(
serverConfig
.
LoopbackClientConfig
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
informerFactory
:=
informers
.
NewSharedInformerFactory
(
client
,
serverConfig
.
LoopbackClientConfig
.
Timeout
)
informerFactory
:=
informers
.
NewSharedInformerFactory
(
client
,
serverConfig
.
LoopbackClientConfig
.
Timeout
)
admissionInitializer
,
err
:=
wardleinitializer
.
New
(
informerFactory
)
o
.
SharedInformerFactory
=
informerFactory
if
err
!=
nil
{
return
wardleinitializer
.
New
(
informerFactory
),
nil
return
nil
,
err
}
}
if
err
:=
o
.
Admission
.
ApplyTo
(
&
serverConfig
.
Config
,
serverConfig
.
SharedInformerFactory
,
serverConfig
.
ClientConfig
,
apiserver
.
Scheme
,
admissionInitializer
);
err
!=
nil
{
serverConfig
.
ExtraAdmissionInitializersInitFunc
=
[]
genericapiserver
.
AdmissionInitializersInitFunc
{
admissionInitializerInitFunc
}
if
err
:=
o
.
RecommendedOptions
.
ApplyTo
(
serverConfig
,
apiserver
.
Scheme
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment