fix panic for nil pointer
This commit is contained in:
@@ -89,6 +89,8 @@ func NewAdmission(opts ...Option) admission.Admission {
|
|||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
p := &localAdmission{
|
p := &localAdmission{
|
||||||
|
ipMatcher: matcher.NopMatcher(),
|
||||||
|
cidrMatcher: matcher.NopMatcher(),
|
||||||
cancelFunc: cancel,
|
cancelFunc: cancel,
|
||||||
options: options,
|
options: options,
|
||||||
logger: options.logger,
|
logger: options.logger,
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ func NewBypass(opts ...Option) bypass.Bypass {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
p := &localBypass{
|
p := &localBypass{
|
||||||
|
cidrMatcher: matcher.NopMatcher(),
|
||||||
|
addrMatcher: matcher.NopMatcher(),
|
||||||
|
wildcardMatcher: matcher.NopMatcher(),
|
||||||
|
ipRangeMatcher: matcher.NopMatcher(),
|
||||||
cancelFunc: cancel,
|
cancelFunc: cancel,
|
||||||
options: options,
|
options: options,
|
||||||
logger: options.logger,
|
logger: options.logger,
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ func NewIngress(opts ...Option) ingress.Ingress {
|
|||||||
ctx, cancel := context.WithCancel(context.TODO())
|
ctx, cancel := context.WithCancel(context.TODO())
|
||||||
|
|
||||||
ing := &localIngress{
|
ing := &localIngress{
|
||||||
|
rules: make(map[string]*ingress.Rule),
|
||||||
cancelFunc: cancel,
|
cancelFunc: cancel,
|
||||||
options: options,
|
options: options,
|
||||||
logger: options.logger,
|
logger: options.logger,
|
||||||
|
|||||||
@@ -259,3 +259,14 @@ func (m *ipRangeMatcher) Match(addr string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type nopMatcher struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func NopMatcher() Matcher {
|
||||||
|
return &nopMatcher{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *nopMatcher) Match(addr string) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user