Documentation ¶
Index ¶
- Variables
- func ApplyPolicyOnResource(policy kyvernov1.PolicyInterface, resource *unstructured.Unstructured, ...) ([]*response.EngineResponse, policyreport.Info, error)
- func CheckVariableForPolicy(valuesMap map[string]map[string]Resource, globalValMap map[string]string, ...) (map[string]interface{}, error)
- func GetKindsFromPolicy(policy kyvernov1.PolicyInterface) map[string]struct{}
- func GetKindsFromRule(rule kyvernov1.Rule) map[string]bool
- func GetPatchedAndGeneratedResource(resourceBytes []byte) (unstructured.Unstructured, error)
- func GetPolicies(paths []string) (policies []kyvernov1.PolicyInterface, errors []error)
- func GetPoliciesFromPaths(fs billy.Filesystem, dirPath []string, isGit bool, policyResourcePath string) (policies []kyvernov1.PolicyInterface, err error)
- func GetResource(resourceBytes []byte) ([]*unstructured.Unstructured, error)
- func GetResourceAccordingToResourcePath(fs billy.Filesystem, resourcePaths []string, cluster bool, ...) (resources []*unstructured.Unstructured, err error)
- func GetResourceFromPath(fs billy.Filesystem, path string, isGit bool, policyResourcePath string, ...) (unstructured.Unstructured, error)
- func GetResources(policies []kyvernov1.PolicyInterface, resourcePaths []string, ...) ([]*unstructured.Unstructured, error)
- func GetResourcesWithTest(fs billy.Filesystem, policies []kyvernov1.PolicyInterface, ...) ([]*unstructured.Unstructured, error)
- func GetUserInfoFromPath(fs billy.Filesystem, path string, isGit bool, policyResourcePath string) (kyvernov1beta1.RequestInfo, store.Subject, error)
- func GetVariable(variablesString, valuesFile string, fs billy.Filesystem, isGit bool, ...) (map[string]string, map[string]string, map[string]map[string]Resource, ...)
- func HasVariables(policy kyvernov1.PolicyInterface) [][]string
- func IsInputFromPipe() bool
- func MutatePolicies(policies []kyvernov1.PolicyInterface) ([]kyvernov1.PolicyInterface, error)
- func MutatePolicy(policy kyvernov1.PolicyInterface, logger logr.Logger) (kyvernov1.PolicyInterface, error)
- func PrintMutatedOutput(mutateLogPath string, mutateLogPathIsDir bool, yaml string, fileName string) error
- func PrintMutatedPolicy(mutatedPolicies []kyvernov1.PolicyInterface) error
- func ProcessValidateEngineResponse(policy kyvernov1.PolicyInterface, validateResponse *response.EngineResponse, ...) policyreport.Info
- func RemoveDuplicateAndObjectVariables(matches [][]string) string
- func SetInStoreContext(mutatedPolicies []kyvernov1.PolicyInterface, variables map[string]string) map[string]string
- type NamespaceSelector
- type Policy
- type Resource
- type ResultCounts
- type Rule
- type Values
Constants ¶
This section is empty.
Variables ¶
var IsHTTPRegex = regexp.MustCompile("^(http|https)://")
IsHTTPRegex represents regex for starts with http:// or https://
var RegexVariables = regexp.MustCompile(`\{\{[^{}]*\}\}`)
RegexVariables represents regex for '{{}}'
Functions ¶
func ApplyPolicyOnResource ¶
func ApplyPolicyOnResource(policy kyvernov1.PolicyInterface, resource *unstructured.Unstructured, mutateLogPath string, mutateLogPathIsDir bool, variables map[string]interface{}, userInfo kyvernov1beta1.RequestInfo, policyReport bool, namespaceSelectorMap map[string]map[string]string, stdin bool, rc *ResultCounts, printPatchResource bool, ruleToCloneSourceResource map[string]string, ) ([]*response.EngineResponse, policyreport.Info, error)
ApplyPolicyOnResource - function to apply policy on resource
func CheckVariableForPolicy ¶
func GetKindsFromPolicy ¶
func GetKindsFromPolicy(policy kyvernov1.PolicyInterface) map[string]struct{}
func GetKindsFromRule ¶
GetKindsFromRule will return the kinds from policy match block
func GetPatchedAndGeneratedResource ¶ added in v1.8.0
func GetPatchedAndGeneratedResource(resourceBytes []byte) (unstructured.Unstructured, error)
GetPatchedResource converts raw bytes to unstructured object
func GetPolicies ¶
func GetPolicies(paths []string) (policies []kyvernov1.PolicyInterface, errors []error)
GetPolicies - Extracting the policies from multiple YAML
func GetPoliciesFromPaths ¶
func GetPoliciesFromPaths(fs billy.Filesystem, dirPath []string, isGit bool, policyResourcePath string) (policies []kyvernov1.PolicyInterface, err error)
GetPoliciesFromPaths - get policies according to the resource path
func GetResource ¶
func GetResource(resourceBytes []byte) ([]*unstructured.Unstructured, error)
GetResource converts raw bytes to unstructured object
func GetResourceAccordingToResourcePath ¶
func GetResourceAccordingToResourcePath(fs billy.Filesystem, resourcePaths []string, cluster bool, policies []kyvernov1.PolicyInterface, dClient dclient.Interface, namespace string, policyReport bool, isGit bool, policyResourcePath string, ) (resources []*unstructured.Unstructured, err error)
GetResourceAccordingToResourcePath - get resources according to the resource path
func GetResourceFromPath ¶ added in v1.8.0
func GetResourceFromPath(fs billy.Filesystem, path string, isGit bool, policyResourcePath string, resourceType string) (unstructured.Unstructured, error)
GetResourceFromPath - get patchedResource and generatedResource from given path
func GetResources ¶
func GetResources(policies []kyvernov1.PolicyInterface, resourcePaths []string, dClient dclient.Interface, cluster bool, namespace string, policyReport bool) ([]*unstructured.Unstructured, error)
GetResources gets matched resources by the given policies the resources are fetched from - local paths to resources, if given - the k8s cluster, if given
func GetResourcesWithTest ¶
func GetResourcesWithTest(fs billy.Filesystem, policies []kyvernov1.PolicyInterface, resourcePaths []string, isGit bool, policyResourcePath string) ([]*unstructured.Unstructured, error)
GetResourcesWithTest with gets matched resources by the given policies
func GetUserInfoFromPath ¶
func GetUserInfoFromPath(fs billy.Filesystem, path string, isGit bool, policyResourcePath string) (kyvernov1beta1.RequestInfo, store.Subject, error)
GetUserInfoFromPath - get the request info as user info from a given path
func GetVariable ¶
func HasVariables ¶
func HasVariables(policy kyvernov1.PolicyInterface) [][]string
HasVariables - check for variables in the policy
func IsInputFromPipe ¶
func IsInputFromPipe() bool
IsInputFromPipe - check if input is passed using pipe
func MutatePolicies ¶
func MutatePolicies(policies []kyvernov1.PolicyInterface) ([]kyvernov1.PolicyInterface, error)
MutatePolicies - function to apply mutation on policies
func MutatePolicy ¶
func MutatePolicy(policy kyvernov1.PolicyInterface, logger logr.Logger) (kyvernov1.PolicyInterface, error)
MutatePolicy - applies mutation to a policy
func PrintMutatedOutput ¶
func PrintMutatedOutput(mutateLogPath string, mutateLogPathIsDir bool, yaml string, fileName string) error
PrintMutatedOutput - function to print output in provided file or directory
func PrintMutatedPolicy ¶
func PrintMutatedPolicy(mutatedPolicies []kyvernov1.PolicyInterface) error
func ProcessValidateEngineResponse ¶
func ProcessValidateEngineResponse(policy kyvernov1.PolicyInterface, validateResponse *response.EngineResponse, resPath string, rc *ResultCounts, policyReport bool) policyreport.Info
func RemoveDuplicateAndObjectVariables ¶
RemoveDuplicateAndObjectVariables - remove duplicate variables