-
Notifications
You must be signed in to change notification settings - Fork 31
/
expanders.go
30 lines (26 loc) · 1.04 KB
/
expanders.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
// Copyright Contributors to the Open Cluster Management project
package expanders
import (
"open-cluster-management.io/policy-generator-plugin/internal/types"
)
// GetExpanders returns the list of available expanders.
func GetExpanders() map[string]Expander {
return map[string]Expander{
"gatekeeper": GatekeeperPolicyExpander{},
"kyverno": KyvernoPolicyExpander{},
}
}
// Expander is the interface for all policy expander instances.
type Expander interface {
// CanHandle determines if the manifest is a policy that can be expanded.
CanHandle(manifest map[string]interface{}) bool
// Enabled determines if the policy configuration allows a policy to be expanded.
Enabled(policyConf *types.PolicyConfig) bool
// Expand will generate additional policy templates for the policy for auditing purposes.
Expand(manifest map[string]interface{}, severity string) []map[string]interface{}
}
// Common constants for the expanders.
const (
configPolicyAPIVersion = "policy.open-cluster-management.io/v1"
configPolicyKind = "ConfigurationPolicy"
)