diff --git a/admission/admission.go b/admission/admission.go index dda09b8f..ebc639c3 100644 --- a/admission/admission.go +++ b/admission/admission.go @@ -89,9 +89,11 @@ func NewAdmission(opts ...Option) admission.Admission { ctx, cancel := context.WithCancel(context.Background()) p := &localAdmission{ - cancelFunc: cancel, - options: options, - logger: options.logger, + ipMatcher: matcher.NopMatcher(), + cidrMatcher: matcher.NopMatcher(), + cancelFunc: cancel, + options: options, + logger: options.logger, } if p.logger == nil { p.logger = xlogger.Nop() diff --git a/bypass/bypass.go b/bypass/bypass.go index 93ad176f..901ebf76 100644 --- a/bypass/bypass.go +++ b/bypass/bypass.go @@ -100,9 +100,13 @@ func NewBypass(opts ...Option) bypass.Bypass { ctx, cancel := context.WithCancel(context.Background()) p := &localBypass{ - cancelFunc: cancel, - options: options, - logger: options.logger, + cidrMatcher: matcher.NopMatcher(), + addrMatcher: matcher.NopMatcher(), + wildcardMatcher: matcher.NopMatcher(), + ipRangeMatcher: matcher.NopMatcher(), + cancelFunc: cancel, + options: options, + logger: options.logger, } if p.logger == nil { p.logger = xlogger.Nop() diff --git a/ingress/ingress.go b/ingress/ingress.go index e40be772..635dc4ab 100644 --- a/ingress/ingress.go +++ b/ingress/ingress.go @@ -80,6 +80,7 @@ func NewIngress(opts ...Option) ingress.Ingress { ctx, cancel := context.WithCancel(context.TODO()) ing := &localIngress{ + rules: make(map[string]*ingress.Rule), cancelFunc: cancel, options: options, logger: options.logger, diff --git a/internal/matcher/matcher.go b/internal/matcher/matcher.go index 33e77aa7..3057b312 100644 --- a/internal/matcher/matcher.go +++ b/internal/matcher/matcher.go @@ -259,3 +259,14 @@ func (m *ipRangeMatcher) Match(addr string) bool { } return false } + +type nopMatcher struct { +} + +func NopMatcher() Matcher { + return &nopMatcher{} +} + +func (m *nopMatcher) Match(addr string) bool { + return false +}