-
Notifications
You must be signed in to change notification settings - Fork 4
/
filters.go
31 lines (26 loc) · 907 Bytes
/
filters.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package agent
import (
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
"github.com/argoproj/argo-cd/v2/util/glob"
"github.com/jannfis/argocd-agent/internal/filter"
)
// DefaultFilterChain returns a FilterChain with a set of default filters that
// the agent will evaluate for every change.
func (a *Agent) DefaultFilterChain() *filter.Chain {
fc := &filter.Chain{}
// Admit based on namespace of the application
fc.AppendAdmitFilter(func(app *v1alpha1.Application) bool {
if !glob.MatchStringInList(append([]string{a.namespace}, a.options.namespaces...), app.Namespace, false) {
log().Warnf("namespace not allowed: %s", app.QualifiedName())
return false
}
// if a.managedApps.IsManaged(app.QualifiedName()) {
// log().Warnf("App is not managed: %s", app.QualifiedName())
// return false
// }
return true
})
return fc
}
func (a *Agent) WithLabelFilter() {
}