Documentation ¶
Index ¶
- Variables
- func ApplyPolicyOnResource(policy *v1.ClusterPolicy, resource *unstructured.Unstructured, ...) ([]*response.EngineResponse, policyreport.Info, error)
- func CheckVariableForPolicy(valuesMap map[string]map[string]Resource, globalValMap map[string]string, ...) (map[string]string, error)
- func GetCRD(path string) (unstructuredCrds []*unstructured.Unstructured, err error)
- func GetCRDs(paths []string) (unstructuredCrds []*unstructured.Unstructured, err error)
- func GetKindsFromPolicy(policy *v1.ClusterPolicy) map[string]struct{}
- func GetPatchedResource(patchResourceBytes []byte) (patchedResource unstructured.Unstructured, err error)
- func GetPatchedResourceFromPath(fs billy.Filesystem, path string, isGit bool, policyResourcePath string) (unstructured.Unstructured, error)
- func GetPolicies(paths []string) (policies []*v1.ClusterPolicy, errors []error)
- func GetPoliciesFromPaths(fs billy.Filesystem, dirPath []string, isGit bool, policyResourcePath string) (policies []*v1.ClusterPolicy, err error)
- func GetResource(resourceBytes []byte) ([]*unstructured.Unstructured, error)
- func GetResourceAccordingToResourcePath(fs billy.Filesystem, resourcePaths []string, cluster bool, ...) (resources []*unstructured.Unstructured, err error)
- func GetResources(policies []*v1.ClusterPolicy, resourcePaths []string, dClient *client.Client, ...) ([]*unstructured.Unstructured, error)
- func GetResourcesWithTest(fs billy.Filesystem, policies []*v1.ClusterPolicy, resourcePaths []string, ...) ([]*unstructured.Unstructured, 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 *v1.ClusterPolicy) [][]string
- func IsInputFromPipe() bool
- func MutatePolices(policies []*v1.ClusterPolicy) ([]*v1.ClusterPolicy, error)
- func MutatePolicy(policy *v1.ClusterPolicy, logger logr.Logger) (*v1.ClusterPolicy, error)
- func PrintMutatedOutput(mutateLogPath string, mutateLogPathIsDir bool, yaml string, fileName string) error
- func PrintMutatedPolicy(mutatedPolicies []*v1.ClusterPolicy) error
- func ProcessValidateEngineResponse(policy *v1.ClusterPolicy, validateResponse *response.EngineResponse, ...) policyreport.Info
- func RemoveDuplicateAndObjectVariables(matches [][]string) string
- func SetInStoreContext(mutatedPolicies []*v1.ClusterPolicy, 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 ¶ added in v1.3.2
func ApplyPolicyOnResource(policy *v1.ClusterPolicy, resource *unstructured.Unstructured, mutateLogPath string, mutateLogPathIsDir bool, variables map[string]string, policyReport bool, namespaceSelectorMap map[string]map[string]string, stdin bool, rc *ResultCounts, printPatchResource bool) ([]*response.EngineResponse, policyreport.Info, error)
ApplyPolicyOnResource - function to apply policy on resource
func CheckVariableForPolicy ¶ added in v1.4.3
func GetCRD ¶
func GetCRD(path string) (unstructuredCrds []*unstructured.Unstructured, err error)
GetCRD - Extracts crds from a YAML
func GetCRDs ¶
func GetCRDs(paths []string) (unstructuredCrds []*unstructured.Unstructured, err error)
GetCRDs - Extracting the crds from multiple YAML
func GetKindsFromPolicy ¶ added in v1.4.3
func GetKindsFromPolicy(policy *v1.ClusterPolicy) map[string]struct{}
func GetPatchedResource ¶ added in v1.5.0
func GetPatchedResource(patchResourceBytes []byte) (patchedResource unstructured.Unstructured, err error)
GetPatchedResource converts raw bytes to unstructured object
func GetPatchedResourceFromPath ¶ added in v1.5.0
func GetPatchedResourceFromPath(fs billy.Filesystem, path string, isGit bool, policyResourcePath string) (unstructured.Unstructured, error)
GetPatchedResourceFromPath - get patchedResource from given path
func GetPolicies ¶
func GetPolicies(paths []string) (policies []*v1.ClusterPolicy, errors []error)
GetPolicies - Extracting the policies from multiple YAML
func GetPoliciesFromPaths ¶ added in v1.3.2
func GetPoliciesFromPaths(fs billy.Filesystem, dirPath []string, isGit bool, policyResourcePath string) (policies []*v1.ClusterPolicy, err error)
GetPoliciesFromPaths - get policies according to the resource path
func GetResource ¶ added in v1.3.0
func GetResource(resourceBytes []byte) ([]*unstructured.Unstructured, error)
GetResource converts raw bytes to unstructured object
func GetResourceAccordingToResourcePath ¶ added in v1.3.2
func GetResourceAccordingToResourcePath(fs billy.Filesystem, resourcePaths []string, cluster bool, policies []*v1.ClusterPolicy, dClient *client.Client, namespace string, policyReport bool, isGit bool, policyResourcePath string) (resources []*unstructured.Unstructured, err error)
GetResourceAccordingToResourcePath - get resources according to the resource path
func GetResources ¶ added in v1.3.0
func GetResources(policies []*v1.ClusterPolicy, resourcePaths []string, dClient *client.Client, 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 ¶ added in v1.3.2
func GetResourcesWithTest(fs billy.Filesystem, policies []*v1.ClusterPolicy, resourcePaths []string, isGit bool, policyResourcePath string) ([]*unstructured.Unstructured, error)
GetResourcesWithTest with gets matched resources by the given policies
func GetVariable ¶ added in v1.3.2
func HasVariables ¶ added in v1.5.2
func HasVariables(policy *v1.ClusterPolicy) [][]string
HasVariables - check for variables in the policy
func IsInputFromPipe ¶
func IsInputFromPipe() bool
IsInputFromPipe - check if input is passed using pipe
func MutatePolices ¶ added in v1.3.2
func MutatePolices(policies []*v1.ClusterPolicy) ([]*v1.ClusterPolicy, error)
MutatePolices - function to apply mutation on policies
func MutatePolicy ¶
func MutatePolicy(policy *v1.ClusterPolicy, logger logr.Logger) (*v1.ClusterPolicy, error)
MutatePolicy - applies mutation to a policy
func PrintMutatedOutput ¶ added in v1.3.2
func PrintMutatedOutput(mutateLogPath string, mutateLogPathIsDir bool, yaml string, fileName string) error
PrintMutatedOutput - function to print output in provided file or directory
func PrintMutatedPolicy ¶ added in v1.4.3
func PrintMutatedPolicy(mutatedPolicies []*v1.ClusterPolicy) error
func ProcessValidateEngineResponse ¶ added in v1.4.3
func ProcessValidateEngineResponse(policy *v1.ClusterPolicy, validateResponse *response.EngineResponse, resPath string, rc *ResultCounts, policyReport bool) policyreport.Info
func RemoveDuplicateAndObjectVariables ¶ added in v1.4.2
RemoveDuplicateAndObjectVariables - remove duplicate variables