mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #73647 from deads2k/check-some-errors
catch some unhandled errors
This commit is contained in:
commit
5323aed97b
@ -66,12 +66,15 @@ func createAggregatorConfig(
|
|||||||
|
|
||||||
// override genericConfig.AdmissionControl with kube-aggregator's scheme,
|
// override genericConfig.AdmissionControl with kube-aggregator's scheme,
|
||||||
// because aggregator apiserver should use its own scheme to convert its own resources.
|
// because aggregator apiserver should use its own scheme to convert its own resources.
|
||||||
commandOptions.Admission.ApplyTo(
|
err := commandOptions.Admission.ApplyTo(
|
||||||
&genericConfig,
|
&genericConfig,
|
||||||
externalInformers,
|
externalInformers,
|
||||||
genericConfig.LoopbackClientConfig,
|
genericConfig.LoopbackClientConfig,
|
||||||
aggregatorscheme.Scheme,
|
aggregatorscheme.Scheme,
|
||||||
pluginInitializers...)
|
pluginInitializers...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// copy the etcd options so we don't mutate originals.
|
// copy the etcd options so we don't mutate originals.
|
||||||
etcdOptions := *commandOptions.Etcd
|
etcdOptions := *commandOptions.Etcd
|
||||||
@ -87,7 +90,6 @@ func createAggregatorConfig(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
|
||||||
var certBytes, keyBytes []byte
|
var certBytes, keyBytes []byte
|
||||||
if len(commandOptions.ProxyClientCertFile) > 0 && len(commandOptions.ProxyClientKeyFile) > 0 {
|
if len(commandOptions.ProxyClientCertFile) > 0 && len(commandOptions.ProxyClientKeyFile) > 0 {
|
||||||
certBytes, err = ioutil.ReadFile(commandOptions.ProxyClientCertFile)
|
certBytes, err = ioutil.ReadFile(commandOptions.ProxyClientCertFile)
|
||||||
@ -133,7 +135,7 @@ func createAggregatorServer(aggregatorConfig *aggregatorapiserver.Config, delega
|
|||||||
apiExtensionInformers.Apiextensions().InternalVersion().CustomResourceDefinitions(),
|
apiExtensionInformers.Apiextensions().InternalVersion().CustomResourceDefinitions(),
|
||||||
autoRegistrationController)
|
autoRegistrationController)
|
||||||
|
|
||||||
aggregatorServer.GenericAPIServer.AddPostStartHook("kube-apiserver-autoregistration", func(context genericapiserver.PostStartHookContext) error {
|
err = aggregatorServer.GenericAPIServer.AddPostStartHook("kube-apiserver-autoregistration", func(context genericapiserver.PostStartHookContext) error {
|
||||||
go crdRegistrationController.Run(5, context.StopCh)
|
go crdRegistrationController.Run(5, context.StopCh)
|
||||||
go func() {
|
go func() {
|
||||||
// let the CRD controller process the initial set of CRDs before starting the autoregistration controller.
|
// let the CRD controller process the initial set of CRDs before starting the autoregistration controller.
|
||||||
@ -146,14 +148,20 @@ func createAggregatorServer(aggregatorConfig *aggregatorapiserver.Config, delega
|
|||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
aggregatorServer.GenericAPIServer.AddHealthzChecks(
|
err = aggregatorServer.GenericAPIServer.AddHealthzChecks(
|
||||||
makeAPIServiceAvailableHealthzCheck(
|
makeAPIServiceAvailableHealthzCheck(
|
||||||
"autoregister-completion",
|
"autoregister-completion",
|
||||||
apiServices,
|
apiServices,
|
||||||
aggregatorServer.APIRegistrationInformers.Apiregistration().InternalVersion().APIServices(),
|
aggregatorServer.APIRegistrationInformers.Apiregistration().InternalVersion().APIServices(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return aggregatorServer, nil
|
return aggregatorServer, nil
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,15 @@ func createAPIExtensionsConfig(
|
|||||||
|
|
||||||
// override genericConfig.AdmissionControl with apiextensions' scheme,
|
// override genericConfig.AdmissionControl with apiextensions' scheme,
|
||||||
// because apiextentions apiserver should use its own scheme to convert resources.
|
// because apiextentions apiserver should use its own scheme to convert resources.
|
||||||
commandOptions.Admission.ApplyTo(
|
err := commandOptions.Admission.ApplyTo(
|
||||||
&genericConfig,
|
&genericConfig,
|
||||||
externalInformers,
|
externalInformers,
|
||||||
genericConfig.LoopbackClientConfig,
|
genericConfig.LoopbackClientConfig,
|
||||||
apiextensionsapiserver.Scheme,
|
apiextensionsapiserver.Scheme,
|
||||||
pluginInitializers...)
|
pluginInitializers...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// copy the etcd options so we don't mutate originals.
|
// copy the etcd options so we don't mutate originals.
|
||||||
etcdOptions := *commandOptions.Etcd
|
etcdOptions := *commandOptions.Etcd
|
||||||
|
Loading…
Reference in New Issue
Block a user