support clean up the notification configure when delete cluster (#5077)
This commit is contained in:
@@ -26,6 +26,8 @@ import (
|
||||
type Interface interface {
|
||||
// Configs returns a ConfigInformer.
|
||||
Configs() ConfigInformer
|
||||
// NotificationManagers returns a NotificationManagerInformer.
|
||||
NotificationManagers() NotificationManagerInformer
|
||||
// Receivers returns a ReceiverInformer.
|
||||
Receivers() ReceiverInformer
|
||||
// Routers returns a RouterInformer.
|
||||
@@ -50,6 +52,11 @@ func (v *version) Configs() ConfigInformer {
|
||||
return &configInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// NotificationManagers returns a NotificationManagerInformer.
|
||||
func (v *version) NotificationManagers() NotificationManagerInformer {
|
||||
return ¬ificationManagerInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// Receivers returns a ReceiverInformer.
|
||||
func (v *version) Receivers() ReceiverInformer {
|
||||
return &receiverInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
Copyright 2020 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 v2beta2
|
||||
|
||||
import (
|
||||
"context"
|
||||
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"
|
||||
notificationv2beta2 "kubesphere.io/api/notification/v2beta2"
|
||||
versioned "kubesphere.io/kubesphere/pkg/client/clientset/versioned"
|
||||
internalinterfaces "kubesphere.io/kubesphere/pkg/client/informers/externalversions/internalinterfaces"
|
||||
v2beta2 "kubesphere.io/kubesphere/pkg/client/listers/notification/v2beta2"
|
||||
)
|
||||
|
||||
// NotificationManagerInformer provides access to a shared informer and lister for
|
||||
// NotificationManagers.
|
||||
type NotificationManagerInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2beta2.NotificationManagerLister
|
||||
}
|
||||
|
||||
type notificationManagerInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewNotificationManagerInformer constructs a new informer for NotificationManager 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 NewNotificationManagerInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredNotificationManagerInformer(client, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredNotificationManagerInformer constructs a new informer for NotificationManager 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 NewFilteredNotificationManagerInformer(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.NotificationV2beta2().NotificationManagers().List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.NotificationV2beta2().NotificationManagers().Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
¬ificationv2beta2.NotificationManager{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *notificationManagerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredNotificationManagerInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *notificationManagerInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(¬ificationv2beta2.NotificationManager{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *notificationManagerInformer) Lister() v2beta2.NotificationManagerLister {
|
||||
return v2beta2.NewNotificationManagerLister(f.Informer().GetIndexer())
|
||||
}
|
||||
Reference in New Issue
Block a user