github.com/dhaiducek/policy-generator-plugin@v1.99.99/internal/expanders/expanders.go (about)

     1  // Copyright Contributors to the Open Cluster Management project
     2  package expanders
     3  
     4  import (
     5  	"github.com/dhaiducek/policy-generator-plugin/internal/types"
     6  )
     7  
     8  // GetExpanders returns the list of available expanders.
     9  func GetExpanders() map[string]Expander {
    10  	return map[string]Expander{
    11  		"gatekeeper": GatekeeperPolicyExpander{},
    12  		"kyverno":    KyvernoPolicyExpander{},
    13  	}
    14  }
    15  
    16  // Expander is the interface for all policy expander instances.
    17  type Expander interface {
    18  	// CanHandle determines if the manifest is a policy that can be expanded.
    19  	CanHandle(manifest map[string]interface{}) bool
    20  	// Enabled determines if the policy configuration allows a policy to be expanded.
    21  	Enabled(policyConf *types.PolicyConfig) bool
    22  	// Expand will generate additional policy templates for the policy for auditing purposes.
    23  	Expand(manifest map[string]interface{}, severity string) []map[string]interface{}
    24  }
    25  
    26  // Common constants for the expanders.
    27  const (
    28  	configPolicyAPIVersion = "policy.open-cluster-management.io/v1"
    29  	configPolicyKind       = "ConfigurationPolicy"
    30  )