mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 16:49:35 +00:00
Merge pull request #124620 from sttts/sttts-controlplane-cosmetics
controlplane: cosmetics
This commit is contained in:
commit
79c81fab61
@ -95,7 +95,9 @@ type Extra struct {
|
|||||||
VersionedInformers clientgoinformers.SharedInformerFactory
|
VersionedInformers clientgoinformers.SharedInformerFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildGenericConfig takes the master server options and produces the genericapiserver.Config associated with it
|
// BuildGenericConfig takes the generic controlplane apiserver options and produces
|
||||||
|
// the genericapiserver.Config associated with it. The genericapiserver.Config is
|
||||||
|
// often shared between multiple delegated apiservers.
|
||||||
func BuildGenericConfig(
|
func BuildGenericConfig(
|
||||||
s controlplaneapiserver.CompletedOptions,
|
s controlplaneapiserver.CompletedOptions,
|
||||||
schemes []*runtime.Scheme,
|
schemes []*runtime.Scheme,
|
||||||
@ -130,7 +132,7 @@ func BuildGenericConfig(
|
|||||||
kubeClientConfig := genericConfig.LoopbackClientConfig
|
kubeClientConfig := genericConfig.LoopbackClientConfig
|
||||||
clientgoExternalClient, err := clientgoclientset.NewForConfig(kubeClientConfig)
|
clientgoExternalClient, err := clientgoclientset.NewForConfig(kubeClientConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastErr = fmt.Errorf("failed to create real external clientset: %v", err)
|
lastErr = fmt.Errorf("failed to create real external clientset: %w", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
versionedInformers = clientgoinformers.NewSharedInformerFactory(clientgoExternalClient, 10*time.Minute)
|
versionedInformers = clientgoinformers.NewSharedInformerFactory(clientgoExternalClient, 10*time.Minute)
|
||||||
@ -203,7 +205,7 @@ func BuildGenericConfig(
|
|||||||
versionedInformers,
|
versionedInformers,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastErr = fmt.Errorf("invalid authorization config: %v", err)
|
lastErr = fmt.Errorf("invalid authorization config: %w", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if s.Authorization != nil && !enablesRBAC {
|
if s.Authorization != nil && !enablesRBAC {
|
||||||
|
@ -133,7 +133,10 @@ func (c completedConfig) New(name string, delegationTarget genericapiserver.Dele
|
|||||||
VersionedInformers: c.VersionedInformers,
|
VersionedInformers: c.VersionedInformers,
|
||||||
}
|
}
|
||||||
|
|
||||||
client := kubernetes.NewForConfigOrDie(s.GenericAPIServer.LoopbackClientConfig)
|
client, err := kubernetes.NewForConfig(s.GenericAPIServer.LoopbackClientConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if len(c.SystemNamespaces) > 0 {
|
if len(c.SystemNamespaces) > 0 {
|
||||||
s.GenericAPIServer.AddPostStartHookOrDie("start-system-namespaces-controller", func(hookContext genericapiserver.PostStartHookContext) error {
|
s.GenericAPIServer.AddPostStartHookOrDie("start-system-namespaces-controller", func(hookContext genericapiserver.PostStartHookContext) error {
|
||||||
go systemnamespaces.NewController(c.SystemNamespaces, client, s.VersionedInformers.Core().V1().Namespaces()).Run(hookContext.StopCh)
|
go systemnamespaces.NewController(c.SystemNamespaces, client, s.VersionedInformers.Core().V1().Namespaces()).Run(hookContext.StopCh)
|
||||||
|
Loading…
Reference in New Issue
Block a user