Skip to content

Commit

Permalink
Merge pull request #199 from Azanul/updates-reduction
Browse files Browse the repository at this point in the history
Updates reduction
  • Loading branch information
leecalcote authored May 24, 2023
2 parents 8f08521 + 4562a34 commit c23bb81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion meshsync/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/layer5io/meshsync/internal/channels"
"github.com/layer5io/meshsync/internal/config"
"github.com/layer5io/meshsync/pkg/model"
"golang.org/x/net/context"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/remotecommand"
Expand Down Expand Up @@ -136,7 +137,7 @@ func (h *Handler) streamSession(id string, req model.ExecRequest, cfg config.Lis
return err
}

if err := exec.Stream(remotecommand.StreamOptions{
if err := exec.StreamWithContext(context.TODO(), remotecommand.StreamOptions{
Stdin: stdin,
Stdout: stdout,
Stderr: stdout,
Expand Down
21 changes: 20 additions & 1 deletion meshsync/meshsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,26 @@ func New(config config.Handler, log logger.Handler, br broker.Handler, pool map[
return nil, ErrKubeConfig(err)
}

informer := dynamicinformer.NewFilteredDynamicSharedInformerFactory(kubeClient.DynamicKubeClient, 0, v1.NamespaceAll, nil)
var blacklist []string
err = config.GetObject("spec.informer_config", blacklist)
if err != nil {
return nil, err
}

listOptionsFunc := func(lo *v1.ListOptions) {
// Create a label selector to include all objects
labelSelector := &v1.LabelSelector{}

// Add label selector requirements to exclude blacklisted types
labelSelectorReq := v1.LabelSelectorRequirement{
Key: "type",
Operator: v1.LabelSelectorOpNotIn,
Values: blacklist,
}
labelSelector.MatchExpressions = append(labelSelector.MatchExpressions, labelSelectorReq)
}

informer := dynamicinformer.NewFilteredDynamicSharedInformerFactory(kubeClient.DynamicKubeClient, 0, v1.NamespaceAll, listOptionsFunc)

return &Handler{
Config: config,
Expand Down

0 comments on commit c23bb81

Please sign in to comment.