This is a huge commit, it does following things: (#1942)

1. Remove ks-iam standalone binary, move it to ks-apiserver
2. Generate all devops apis inside kubesphere repository, no need to
import s2ioperator.
3. Reorganize ldap code, make it more flexible to use.
This commit is contained in:
zryfish
2020-03-10 13:50:17 +08:00
committed by GitHub
parent 7270307b66
commit 641615b299
235 changed files with 5538 additions and 38064 deletions

View File

@@ -26,6 +26,12 @@ import (
type Interface interface {
// S2iBinaries returns a S2iBinaryInformer.
S2iBinaries() S2iBinaryInformer
// S2iBuilders returns a S2iBuilderInformer.
S2iBuilders() S2iBuilderInformer
// S2iBuilderTemplates returns a S2iBuilderTemplateInformer.
S2iBuilderTemplates() S2iBuilderTemplateInformer
// S2iRuns returns a S2iRunInformer.
S2iRuns() S2iRunInformer
}
type version struct {
@@ -43,3 +49,18 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (v *version) S2iBinaries() S2iBinaryInformer {
return &s2iBinaryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// S2iBuilders returns a S2iBuilderInformer.
func (v *version) S2iBuilders() S2iBuilderInformer {
return &s2iBuilderInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// S2iBuilderTemplates returns a S2iBuilderTemplateInformer.
func (v *version) S2iBuilderTemplates() S2iBuilderTemplateInformer {
return &s2iBuilderTemplateInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// S2iRuns returns a S2iRunInformer.
func (v *version) S2iRuns() S2iRunInformer {
return &s2iRunInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@@ -0,0 +1,89 @@
/*
Copyright 2019 The KubeSphere authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha1"
)
// S2iBuilderInformer provides access to a shared informer and lister for
// S2iBuilders.
type S2iBuilderInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.S2iBuilderLister
}
type s2iBuilderInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewS2iBuilderInformer constructs a new informer for S2iBuilder type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewS2iBuilderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredS2iBuilderInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredS2iBuilderInformer constructs a new informer for S2iBuilder type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredS2iBuilderInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DevopsV1alpha1().S2iBuilders(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DevopsV1alpha1().S2iBuilders(namespace).Watch(options)
},
},
&devopsv1alpha1.S2iBuilder{},
resyncPeriod,
indexers,
)
}
func (f *s2iBuilderInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredS2iBuilderInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *s2iBuilderInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&devopsv1alpha1.S2iBuilder{}, f.defaultInformer)
}
func (f *s2iBuilderInformer) Lister() v1alpha1.S2iBuilderLister {
return v1alpha1.NewS2iBuilderLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,88 @@
/*
Copyright 2019 The KubeSphere authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha1"
)
// S2iBuilderTemplateInformer provides access to a shared informer and lister for
// S2iBuilderTemplates.
type S2iBuilderTemplateInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.S2iBuilderTemplateLister
}
type s2iBuilderTemplateInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewS2iBuilderTemplateInformer constructs a new informer for S2iBuilderTemplate type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewS2iBuilderTemplateInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredS2iBuilderTemplateInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredS2iBuilderTemplateInformer constructs a new informer for S2iBuilderTemplate type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredS2iBuilderTemplateInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DevopsV1alpha1().S2iBuilderTemplates().List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DevopsV1alpha1().S2iBuilderTemplates().Watch(options)
},
},
&devopsv1alpha1.S2iBuilderTemplate{},
resyncPeriod,
indexers,
)
}
func (f *s2iBuilderTemplateInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredS2iBuilderTemplateInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *s2iBuilderTemplateInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&devopsv1alpha1.S2iBuilderTemplate{}, f.defaultInformer)
}
func (f *s2iBuilderTemplateInformer) Lister() v1alpha1.S2iBuilderTemplateLister {
return v1alpha1.NewS2iBuilderTemplateLister(f.Informer().GetIndexer())
}

View File

@@ -0,0 +1,89 @@
/*
Copyright 2019 The KubeSphere authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1alpha1
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
devopsv1alpha1 "kubesphere.io/kubesphere/pkg/apis/devops/v1alpha1"
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
v1alpha1 "kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha1"
)
// S2iRunInformer provides access to a shared informer and lister for
// S2iRuns.
type S2iRunInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.S2iRunLister
}
type s2iRunInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewS2iRunInformer constructs a new informer for S2iRun type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewS2iRunInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredS2iRunInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredS2iRunInformer constructs a new informer for S2iRun type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredS2iRunInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DevopsV1alpha1().S2iRuns(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DevopsV1alpha1().S2iRuns(namespace).Watch(options)
},
},
&devopsv1alpha1.S2iRun{},
resyncPeriod,
indexers,
)
}
func (f *s2iRunInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredS2iRunInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *s2iRunInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&devopsv1alpha1.S2iRun{}, f.defaultInformer)
}
func (f *s2iRunInformer) Lister() v1alpha1.S2iRunLister {
return v1alpha1.NewS2iRunLister(f.Informer().GetIndexer())
}

View File

@@ -58,6 +58,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=devops.kubesphere.io, Version=v1alpha1
case v1alpha1.SchemeGroupVersion.WithResource("s2ibinaries"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha1().S2iBinaries().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("s2ibuilders"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha1().S2iBuilders().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("s2ibuildertemplates"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha1().S2iBuilderTemplates().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("s2iruns"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Devops().V1alpha1().S2iRuns().Informer()}, nil
// Group=network.kubesphere.io, Version=v1alpha1
case networkv1alpha1.SchemeGroupVersion.WithResource("namespacenetworkpolicies"):