未验证 提交 ba4ab97c 编写于 作者: R runzexia

fix comment

Signed-off-by: Nrunzexia <runzexia@yunify.com>
上级 91dd8289
......@@ -21,14 +21,16 @@ import (
"k8s.io/klog"
"kubesphere.io/kubesphere/pkg/controller/application"
"kubesphere.io/kubesphere/pkg/controller/destinationrule"
"kubesphere.io/kubesphere/pkg/controller/devopsproject"
"kubesphere.io/kubesphere/pkg/controller/job"
"kubesphere.io/kubesphere/pkg/controller/s2ibinary"
"kubesphere.io/kubesphere/pkg/controller/s2irun"
"kubesphere.io/kubesphere/pkg/controller/storage/expansion"
"kubesphere.io/kubesphere/pkg/controller/virtualservice"
"kubesphere.io/kubesphere/pkg/informers"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
fakeS3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
......@@ -36,6 +38,8 @@ func AddControllers(
mgr manager.Manager,
client k8s.Client,
informerFactory informers.InformerFactory,
devopsClient devops.Interface,
s3Client s3.Interface,
stopCh <-chan struct{}) error {
kubernetesInformer := informerFactory.KubernetesSharedInformerFactory()
......@@ -73,12 +77,17 @@ func AddControllers(
s2iBinaryController := s2ibinary.NewController(client.Kubernetes(),
client.KubeSphere(),
kubesphereInformer.Devops().V1alpha1().S2iBinaries(),
fakeS3.NewFakeS3())
s3Client,
)
s2iRunController := s2irun.NewS2iRunController(client.Kubernetes(),
client.KubeSphere(),
kubesphereInformer.Devops().V1alpha1().S2iBinaries(),
kubesphereInformer.Devops().V1alpha1().S2iRuns())
devopsProjectController := devopsproject.NewController(client.Kubernetes(),
client.KubeSphere(), devopsClient,
informerFactory.KubeSphereSharedInformerFactory().Devops().V1alpha3().DevOpsProjects(),
)
volumeExpansionController := expansion.NewVolumeExpansionController(
client.Kubernetes(),
......@@ -97,6 +106,7 @@ func AddControllers(
"s2ibinary-controller": s2iBinaryController,
"s2irun-controller": s2iRunController,
"volumeexpansion-controller": volumeExpansionController,
"devopsprojects-controller": devopsProjectController,
}
for name, ctrl := range controllers {
......
......@@ -37,9 +37,11 @@ import (
"kubesphere.io/kubesphere/pkg/controller/namespace"
"kubesphere.io/kubesphere/pkg/controller/workspace"
"kubesphere.io/kubesphere/pkg/informers"
"kubesphere.io/kubesphere/pkg/simple/client/devops/jenkins"
"kubesphere.io/kubesphere/pkg/simple/client/k8s"
kclient "kubesphere.io/kubesphere/pkg/simple/client/kubesphere"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
"kubesphere.io/kubesphere/pkg/utils/term"
"os"
"sigs.k8s.io/controller-runtime/pkg/manager"
......@@ -103,22 +105,18 @@ func Run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{})
klog.Errorf("Failed to create openpitrix client %v", err)
return err
}
/*
devopsClient, err := jenkins.NewDevopsClient(s.DevopsOptions)
if err != nil {
klog.Errorf("Failed to create devops client %v", err)
return err
}
s3Client, err := s3.NewS3Client(s.S3Options)
if err != nil {
klog.Errorf("Failed to create s3 client", err)
return err
}
devopsClient, err := jenkins.NewDevopsClient(s.DevopsOptions)
if err != nil {
klog.Errorf("Failed to create devops client %v", err)
return err
}
*/
s3Client, err := s3.NewS3Client(s.S3Options)
if err != nil {
klog.Errorf("Failed to create s3 client", err)
return err
}
informerFactory := informers.NewInformerFactories(kubernetesClient.Kubernetes(), kubernetesClient.KubeSphere(), kubernetesClient.Istio(), kubernetesClient.Application())
informerFactory.Start(stopCh)
......@@ -146,7 +144,7 @@ func Run(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{})
klog.Fatal("Unable to create namespace controller")
}
if err := AddControllers(mgr, kubernetesClient, informerFactory, stopCh); err != nil {
if err := AddControllers(mgr, kubernetesClient, informerFactory, devopsClient, s3Client, stopCh); err != nil {
klog.Fatalf("unable to register controllers to the manager: %v", err)
}
......
......@@ -19,7 +19,7 @@ import (
"kubesphere.io/kubesphere/pkg/simple/client/mysql"
"kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/simple/client/s3"
fakeS3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake"
fakes3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake"
"kubesphere.io/kubesphere/pkg/simple/client/servicemesh"
"kubesphere.io/kubesphere/pkg/simple/client/sonarqube"
"net/http"
......@@ -125,7 +125,7 @@ func (s *ServerRunOptions) NewAPIServer(stopCh <-chan struct{}) (*apiserver.APIS
if s.S3Options.Endpoint != "" {
if s.S3Options.Endpoint == fakeInterface && s.DebugMode {
apiServer.S3Client = fakeS3.NewFakeS3()
apiServer.S3Client = fakes3.NewFakeS3()
} else {
s3Client, err := s3.NewS3Client(s.S3Options)
if err != nil {
......
package s2ibinary
import (
fakeS3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake"
fakes3 "kubesphere.io/kubesphere/pkg/simple/client/s3/fake"
"reflect"
"testing"
"time"
......@@ -35,8 +35,8 @@ type fixture struct {
// Objects from here preloaded into NewSimpleFake.
objects []runtime.Object
// Objects from here preloaded into s3
initS3Objects []*fakeS3.Object
expectS3Objects []*fakeS3.Object
initS3Objects []*fakes3.Object
expectS3Objects []*fakes3.Object
}
func newFixture(t *testing.T) *fixture {
......@@ -69,12 +69,12 @@ func newDeletingS2iBinary(name string) *s2i.S2iBinary {
}
}
func (f *fixture) newController() (*Controller, informers.SharedInformerFactory, *fakeS3.FakeS3) {
func (f *fixture) newController() (*Controller, informers.SharedInformerFactory, *fakes3.FakeS3) {
f.client = fake.NewSimpleClientset(f.objects...)
f.kubeclient = k8sfake.NewSimpleClientset()
i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc())
s3I := fakeS3.NewFakeS3(f.expectS3Objects...)
s3I := fakes3.NewFakeS3(f.expectS3Objects...)
c := NewController(f.kubeclient, f.client, i.Devops().V1alpha1().S2iBinaries(), s3I)
......@@ -225,10 +225,10 @@ func TestDeleteS3Object(t *testing.T) {
f.s2ibinaryLister = append(f.s2ibinaryLister, s2iBinary)
f.objects = append(f.objects, s2iBinary)
f.initS3Objects = []*fakeS3.Object{&fakeS3.Object{
f.initS3Objects = []*fakes3.Object{&fakes3.Object{
Key: "default-test",
}}
f.expectS3Objects = []*fakeS3.Object{}
f.expectS3Objects = []*fakes3.Object{}
f.expectUpdateS2iBinaryAction(s2iBinary)
f.run(getKey(s2iBinary, t))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册