mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
new clientset
This commit is contained in:
parent
cb0392c47a
commit
dee14ce89b
@ -50,11 +50,13 @@ func Run(s *option.GWServer) error {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
var clientset kubernetes.Interface
|
||||
if s.Config.K8SConfPath == "" {
|
||||
clientset = k8sutil.MustNewKubeClient()
|
||||
} else {
|
||||
k8sutil.NewClientset(s.K8SConfPath)
|
||||
config, err := k8sutil.NewRestConfig(s.K8SConfPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
clientset, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//create cluster node manage
|
||||
|
@ -72,7 +72,11 @@ func Run(s *option.Worker) error {
|
||||
logrus.Errorf("create kube rest config error: %s", err.Error())
|
||||
return err
|
||||
}
|
||||
clientset, _ := kubernetes.NewForConfig(restConfig)
|
||||
clientset, err := kubernetes.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
logrus.Error("Error creating clientset: %v", err)
|
||||
return err
|
||||
}
|
||||
s.Config.KubeClient = clientset
|
||||
|
||||
kubeaggregatorclientset, err := kubeaggregatorclientset.NewForConfig(restConfig)
|
||||
|
@ -22,8 +22,9 @@ import (
|
||||
"path"
|
||||
|
||||
"github.com/goodrain/rainbond/builder/sources"
|
||||
|
||||
k8sutil "github.com/goodrain/rainbond/util/k8s"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
)
|
||||
|
||||
@ -44,6 +45,10 @@ func InitClient(kubeconfig string) error {
|
||||
config.QPS = 50
|
||||
config.Burst = 100
|
||||
|
||||
K8SClient, _ = kubernetes.NewForConfig(config)
|
||||
K8SClient, err = kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
logrus.Error("Create kubernetes client error.", err.Error())
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -80,7 +80,10 @@ func NewKubeClient(cfg *conf.Conf) (KubeClient, error) {
|
||||
config.QPS = 50
|
||||
config.Burst = 100
|
||||
|
||||
cli, _ := kubernetes.NewForConfig(config)
|
||||
cli, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
stop := make(chan struct{})
|
||||
sharedInformers := informers.NewFilteredSharedInformerFactory(cli, cfg.MinResyncPeriod, v1.NamespaceAll,
|
||||
|
Loading…
Reference in New Issue
Block a user