hybrid deploy

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2024-12-04 15:49:44 +08:00
parent 0ea4eb563a
commit 11cd6d922b
10 changed files with 140 additions and 21 deletions

View File

@@ -239,17 +239,34 @@ func newServer(f client.Factory, config *config.Config, logger *logrus.Logger) (
ctrl.SetLogger(logrusr.New(logger))
mgr, err := ctrl.NewManager(clientConfig, ctrl.Options{
Scheme: scheme,
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
f.Namespace(): {},
var mgr manager.Manager
retry := 10
for {
mgr, err = ctrl.NewManager(clientConfig, ctrl.Options{
Scheme: scheme,
Cache: cache.Options{
DefaultNamespaces: map[string]cache.Config{
f.Namespace(): {},
},
},
},
})
})
if err == nil {
break
}
retry--
if retry == 0 {
break
}
logger.WithError(err).Warn("Failed to create controller manager, need retry")
time.Sleep(time.Second)
}
if err != nil {
cancelFunc()
return nil, err
return nil, errors.Wrap(err, "error creating controller manager")
}
credentialFileStore, err := credentials.NewNamespacedFileStore(