volume snapshot

This commit is contained in:
zhangmin
2020-05-07 10:47:44 +08:00
parent 87e567eaf5
commit 4f17b7a07f
95 changed files with 15025 additions and 590 deletions

View File

@@ -18,6 +18,8 @@
package informers
import (
snapshotclient "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/clientset/versioned"
snapshotinformer "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions"
applicationclient "github.com/kubernetes-sigs/application/pkg/client/clientset/versioned"
applicationinformers "github.com/kubernetes-sigs/application/pkg/client/informers/externalversions"
istioclient "istio.io/client-go/pkg/clientset/versioned"
@@ -39,19 +41,22 @@ type InformerFactory interface {
KubeSphereSharedInformerFactory() ksinformers.SharedInformerFactory
IstioSharedInformerFactory() istioinformers.SharedInformerFactory
ApplicationSharedInformerFactory() applicationinformers.SharedInformerFactory
SnapshotSharedInformerFactory() snapshotinformer.SharedInformerFactory
// Start shared informer factory one by one if they are not nil
Start(stopCh <-chan struct{})
}
type informerFactories struct {
informerFactory k8sinformers.SharedInformerFactory
ksInformerFactory ksinformers.SharedInformerFactory
istioInformerFactory istioinformers.SharedInformerFactory
appInformerFactory applicationinformers.SharedInformerFactory
informerFactory k8sinformers.SharedInformerFactory
ksInformerFactory ksinformers.SharedInformerFactory
istioInformerFactory istioinformers.SharedInformerFactory
appInformerFactory applicationinformers.SharedInformerFactory
snapshotInformerFactory snapshotinformer.SharedInformerFactory
}
func NewInformerFactories(client kubernetes.Interface, ksClient versioned.Interface, istioClient istioclient.Interface, appClient applicationclient.Interface) InformerFactory {
func NewInformerFactories(client kubernetes.Interface, ksClient versioned.Interface, istioClient istioclient.Interface,
appClient applicationclient.Interface, snapshotClient snapshotclient.Interface) InformerFactory {
factory := &informerFactories{}
if client != nil {
@@ -70,6 +75,10 @@ func NewInformerFactories(client kubernetes.Interface, ksClient versioned.Interf
factory.istioInformerFactory = istioinformers.NewSharedInformerFactory(istioClient, defaultResync)
}
if snapshotClient != nil {
factory.snapshotInformerFactory = snapshotinformer.NewSharedInformerFactory(snapshotClient, defaultResync)
}
return factory
}
@@ -89,6 +98,10 @@ func (f *informerFactories) IstioSharedInformerFactory() istioinformers.SharedIn
return f.istioInformerFactory
}
func (f *informerFactories) SnapshotSharedInformerFactory() snapshotinformer.SharedInformerFactory {
return f.snapshotInformerFactory
}
func (f *informerFactories) Start(stopCh <-chan struct{}) {
if f.informerFactory != nil {
f.informerFactory.Start(stopCh)

View File

@@ -1,6 +1,7 @@
package informers
import (
snapshotinformer "github.com/kubernetes-csi/external-snapshotter/v2/pkg/client/informers/externalversions"
appinformers "github.com/kubernetes-sigs/application/pkg/client/informers/externalversions"
istioinformers "istio.io/client-go/pkg/informers/externalversions"
"k8s.io/client-go/informers"
@@ -30,5 +31,9 @@ func (n nullInformerFactory) ApplicationSharedInformerFactory() appinformers.Sha
return nil
}
func (n nullInformerFactory) SnapshotSharedInformerFactory() snapshotinformer.SharedInformerFactory {
return nil
}
func (n nullInformerFactory) Start(stopCh <-chan struct{}) {
}