Skip to content

Commit

Permalink
Merge pull request #601 from hzxuzhonghu/rm-resync
Browse files Browse the repository at this point in the history
remove resync period
  • Loading branch information
kmesh-bot authored Jul 19, 2024
2 parents 0d2e1af + df1c32c commit d0f10ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
10 changes: 3 additions & 7 deletions pkg/controller/bypass/bypass_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"os"
"time"

netns "github.com/containernetworking/plugins/pkg/ns"
corev1 "k8s.io/api/core/v1"
Expand All @@ -42,16 +41,13 @@ var (
)

const (
DefaultInformerSyncPeriod = 30 * time.Second
LabelSelectorBypass = "kmesh.net/bypass=enabled"
KmeshAnnotation = "kmesh.net/redirection"
SidecarAnnotation = "sidecar.istio.io/inject"
SidecarAnnotation = "sidecar.istio.io/inject"
)

func StartByPassController(client kubernetes.Interface, stopChan <-chan struct{}) error {
nodeName := os.Getenv("NODE_NAME")

informerFactory := informers.NewSharedInformerFactoryWithOptions(client, DefaultInformerSyncPeriod,
informerFactory := informers.NewSharedInformerFactoryWithOptions(client, 0,
informers.WithTweakListOptions(func(options *metav1.ListOptions) {
options.FieldSelector = fmt.Sprintf("spec.nodeName=%s", nodeName)
}))
Expand Down Expand Up @@ -242,7 +238,7 @@ func checkSidecar(client kubernetes.Interface, pod *corev1.Pod) (bool, error) {
func isKmeshManaged(pod *corev1.Pod) bool {
annotations := pod.Annotations
if annotations != nil {
if value, ok := annotations[KmeshAnnotation]; ok && value == "enabled" {
if value, ok := annotations[constants.KmeshRedirectionAnnotation]; ok && value == "enabled" {
return true
}
}
Expand Down
10 changes: 4 additions & 6 deletions pkg/controller/manage/kmesh_manage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"os"
"strings"
"time"

netns "github.com/containernetworking/plugins/pkg/ns"
"istio.io/istio/pkg/spiffe"
Expand Down Expand Up @@ -54,10 +53,9 @@ var (
)

const (
DefaultInformerSyncPeriod = 2 * time.Second
MaxRetries = 5
ActionAddAnnotation = "add"
ActionDeleteAnnotation = "delete"
MaxRetries = 5
ActionAddAnnotation = "add"
ActionDeleteAnnotation = "delete"
)

type QueueItem struct {
Expand All @@ -68,7 +66,7 @@ type QueueItem struct {
func NewKmeshManageController(client kubernetes.Interface, security *kmeshsecurity.SecretManager) (*KmeshManageController, error) {
nodeName := os.Getenv("NODE_NAME")

informerFactory := informers.NewSharedInformerFactoryWithOptions(client, DefaultInformerSyncPeriod,
informerFactory := informers.NewSharedInformerFactoryWithOptions(client, 0,
informers.WithTweakListOptions(func(options *metav1.ListOptions) {
options.FieldSelector = fmt.Sprintf("spec.nodeName=%s", nodeName)
}))
Expand Down

0 comments on commit d0f10ea

Please sign in to comment.