提交 070aa863 编写于 作者: P pengcong06

init opClient

上级 d358d9ab
...@@ -177,6 +177,14 @@ func (s *ServerRunOptions) NewAPIServer(stopCh <-chan struct{}) (*apiserver.APIS ...@@ -177,6 +177,14 @@ func (s *ServerRunOptions) NewAPIServer(stopCh <-chan struct{}) (*apiserver.APIS
} }
} }
if s.OpenPitrixOptions != nil {
opClient, err := openpitrix.NewClient(s.OpenPitrixOptions)
if err != nil {
return nil, err
}
apiServer.OpenpitrixClient = opClient
}
server := &http.Server{ server := &http.Server{
Addr: fmt.Sprintf(":%d", s.GenericServerRunOptions.InsecurePort), Addr: fmt.Sprintf(":%d", s.GenericServerRunOptions.InsecurePort),
} }
......
...@@ -40,7 +40,9 @@ const ( ...@@ -40,7 +40,9 @@ const (
var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
func AddToContainer(c *restful.Container, factory informers.InformerFactory, op op.Client) error { func AddToContainer(c *restful.Container, factory informers.InformerFactory, op op.Client) error {
if op == nil {
return nil
}
mimePatch := []string{restful.MIME_JSON, runtime.MimeMergePatchJson, runtime.MimeJsonPatchJson} mimePatch := []string{restful.MIME_JSON, runtime.MimeMergePatchJson, runtime.MimeJsonPatchJson}
webservice := runtime.NewWebService(GroupVersion) webservice := runtime.NewWebService(GroupVersion)
handler := newOpenpitrixHandler(factory, op) handler := newOpenpitrixHandler(factory, op)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册