controlplane: return client error

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
This commit is contained in:
Dr. Stefan Schimanski 2024-04-29 17:54:20 +02:00
parent b5fc001bba
commit 8c9bad8503
No known key found for this signature in database
GPG Key ID: 4C68E0F19F95EC33

View File

@ -133,7 +133,10 @@ func (c completedConfig) New(name string, delegationTarget genericapiserver.Dele
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 {
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)