add openpitrix Client to apiserver

This commit is contained in:
LiHui
2022-05-20 14:44:23 +08:00
parent 32b85cd625
commit 35027a346b
19 changed files with 100 additions and 127 deletions

View File

@@ -17,13 +17,14 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"kubesphere.io/kubesphere/pkg/utils/clusterclient"
"math"
"net/url"
"strconv"
"strings"
"time"
"kubesphere.io/kubesphere/pkg/utils/clusterclient"
restful "github.com/emicklei/go-restful"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -51,7 +52,7 @@ type openpitrixHandler struct {
openpitrix openpitrix.Interface
}
func newOpenpitrixHandler(ksInformers informers.InformerFactory, ksClient versioned.Interface, option *openpitrixoptions.Options, cc clusterclient.ClusterClients, stopCh <-chan struct{}) *openpitrixHandler {
func NewOpenpitrixClient(ksInformers informers.InformerFactory, ksClient versioned.Interface, option *openpitrixoptions.Options, cc clusterclient.ClusterClients, stopCh <-chan struct{}) openpitrix.Interface {
var s3Client s3.Interface
if option != nil && option.S3Options != nil && len(option.S3Options.Endpoint) != 0 {
var err error
@@ -61,9 +62,7 @@ func newOpenpitrixHandler(ksInformers informers.InformerFactory, ksClient versio
}
}
return &openpitrixHandler{
openpitrix.NewOpenpitrixOperator(ksInformers, ksClient, s3Client, cc, stopCh),
}
return openpitrix.NewOpenpitrixOperator(ksInformers, ksClient, s3Client, cc, stopCh)
}
func (h *openpitrixHandler) CreateRepo(req *restful.Request, resp *restful.Response) {