mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-09-07 03:44:14 +00:00
Add net-attach-def informer for thick plugin
This change introduces net-attach-def informer in multus-daemon, thick pluign case. It could reduced API calls to get net-attach-def.
This commit is contained in:
@@ -31,13 +31,14 @@ import (
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
"k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/transport"
|
||||
"k8s.io/client-go/util/certificate"
|
||||
"k8s.io/klog"
|
||||
|
||||
netclient "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned/typed/k8s.cni.cncf.io/v1"
|
||||
netclient "github.com/k8snetworkplumbingwg/network-attachment-definition-client/pkg/client/clientset/versioned"
|
||||
"gopkg.in/k8snetworkplumbingwg/multus-cni.v4/pkg/logging"
|
||||
)
|
||||
|
||||
@@ -149,6 +150,12 @@ func InClusterK8sClient() (*ClientInfo, error) {
|
||||
return clientInfo, err
|
||||
}
|
||||
|
||||
// SetK8sClientInformers adds informer structure to ClientInfo to utilize in thick daemon
|
||||
func (c *ClientInfo) SetK8sClientInformers(podInformer, netDefInformer cache.SharedIndexInformer) {
|
||||
c.PodInformer = podInformer
|
||||
c.NetDefInformer = netDefInformer
|
||||
}
|
||||
|
||||
// GetK8sClient gets client info from kubeconfig
|
||||
func GetK8sClient(kubeconfig string, kubeClient *ClientInfo) (*ClientInfo, error) {
|
||||
logging.Debugf("GetK8sClient: %s, %v", kubeconfig, kubeClient)
|
||||
|
Reference in New Issue
Block a user