Skip to content

Commit

Permalink
pass dynamic kubeclient for downstream functions to
Browse files Browse the repository at this point in the history
utilize

Signed-off-by: Daniel Kiptoon <[email protected]>
  • Loading branch information
KiptoonKipkurui committed Sep 14, 2023
1 parent 9bd87b2 commit f3fe79b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions meshsync/meshsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/layer5io/meshsync/internal/channels"

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/dynamic/dynamicinformer"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
Expand All @@ -21,11 +22,12 @@ type Handler struct {
Log logger.Handler
Broker broker.Handler

restConfig rest.Config
informer dynamicinformer.DynamicSharedInformerFactory
staticClient *kubernetes.Clientset
channelPool map[string]channels.GenericChannel
stores map[string]cache.Store
restConfig rest.Config
informer dynamicinformer.DynamicSharedInformerFactory
staticClient *kubernetes.Clientset
dynamicClient dynamic.Interface
channelPool map[string]channels.GenericChannel
stores map[string]cache.Store
}

func New(config config.Handler, log logger.Handler, br broker.Handler, pool map[string]channels.GenericChannel) (*Handler, error) {
Expand Down Expand Up @@ -57,12 +59,13 @@ func New(config config.Handler, log logger.Handler, br broker.Handler, pool map[
informer := dynamicinformer.NewFilteredDynamicSharedInformerFactory(kubeClient.DynamicKubeClient, 0, v1.NamespaceAll, listOptionsFunc)

return &Handler{
Config: config,
Log: log,
Broker: br,
informer: informer,
restConfig: kubeClient.RestConfig,
staticClient: kubeClient.KubeClient,
channelPool: pool,
Config: config,
Log: log,
Broker: br,
informer: informer,
restConfig: kubeClient.RestConfig,
staticClient: kubeClient.KubeClient,
channelPool: pool,
dynamicClient: kubeClient.DynamicKubeClient,
}, nil
}

0 comments on commit f3fe79b

Please sign in to comment.