-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
- Loading branch information
Showing
22 changed files
with
129 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
charts/policy-reporter/templates/plugins/kyverno/rolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
package email | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/kyverno/policy-reporter/pkg/kubernetes/namespaces" | ||
"github.com/kyverno/policy-reporter/pkg/validate" | ||
"go.uber.org/zap" | ||
) | ||
|
||
type Filter struct { | ||
client namespaces.Client | ||
namespace validate.RuleSets | ||
sources validate.RuleSets | ||
} | ||
|
||
func (f Filter) ValidateSource(source string) bool { | ||
return validate.ContainsRuleSet(source, f.sources) | ||
return validate.MatchRuleSet(source, f.sources) | ||
} | ||
|
||
func (f Filter) ValidateNamespace(namespace string) bool { | ||
return validate.Namespace(namespace, f.namespace) | ||
ruleset := f.namespace | ||
|
||
if len(f.namespace.Selector) > 0 { | ||
list, err := f.client.List(context.Background(), f.namespace.Selector) | ||
if err != nil { | ||
zap.L().Error("failed to resolve namespace selector", zap.Error(err)) | ||
} | ||
|
||
ruleset = validate.RuleSets{ | ||
Include: list, | ||
} | ||
} | ||
|
||
return validate.Namespace(namespace, ruleset) | ||
} | ||
|
||
func NewFilter(namespaces, sources validate.RuleSets) Filter { | ||
return Filter{namespaces, sources} | ||
func NewFilter(client namespaces.Client, namespaces, sources validate.RuleSets) Filter { | ||
return Filter{client, namespaces, sources} | ||
} |
Oops, something went wrong.