Documentation
¶
Index ¶
- Constants
- Variables
- func ApiextensionsJsonToKyvernoConditions(original apiextensions.JSON) (interface{}, error)
- func CRDsInstalled(discovery client.IDiscovery) bool
- func ContainsNamepace(patterns []string, ns string) bool
- func ContainsString(list []string, element string) bool
- func ConvertResource(raw []byte, group, version, kind, namespace string) (unstructured.Unstructured, error)
- func CopyMap(m map[string]interface{}) map[string]interface{}
- func CopySlice(s []interface{}) []interface{}
- func CopySliceOfMaps(s []map[string]interface{}) []interface{}
- func ExtractResources(newRaw []byte, request *admissionv1.AdmissionRequest) (unstructured.Unstructured, unstructured.Unstructured, error)
- func GenerateAnnotationPatches(engineResponses []*response.EngineResponse, log logr.Logger) [][]byte
- func GetPolicy(bytes []byte) (policies []kyverno.PolicyInterface, err error)
- func HigherThanKubernetesVersion(client discovery.ServerVersionInterface, log logr.Logger, ...) bool
- func NormalizeSecret(resource *unstructured.Unstructured) (unstructured.Unstructured, error)
- func OverrideRuntimeErrorHandler()
- func SliceContains(slice []string, values ...string) bool
- func ToMap(data interface{}) (map[string]interface{}, error)
- type RulePatch
Constants ¶
const (
PolicyAnnotation = "policies.kyverno.io/last-applied-patches"
)
Variables ¶
var OperationToPastTense = map[string]string{
"add": "added",
"remove": "removed",
"replace": "replaced",
"move": "moved",
"copy": "copied",
"test": "tested",
}
Functions ¶
func ApiextensionsJsonToKyvernoConditions ¶ added in v1.3.4
func ApiextensionsJsonToKyvernoConditions(original apiextensions.JSON) (interface{}, error)
ApiextensionsJsonToKyvernoConditions takes in user-provided conditions in abstract apiextensions.JSON form and converts it into []kyverno.Condition or kyverno.AnyAllConditions according to its content. it also helps in validating the condtions as it returns an error when the conditions are provided wrongfully by the user.
func CRDsInstalled ¶ added in v1.3.2
func CRDsInstalled(discovery client.IDiscovery) bool
CRDsInstalled checks if the Kyverno CRDs are installed or not
func ContainsNamepace ¶ added in v0.10.0
ContainsNamepace check if namespace satisfies any list of pattern(regex)
func ContainsString ¶ added in v0.10.0
ContainsString checks if the string is contained in the list
func ConvertResource ¶ added in v1.2.0
func ConvertResource(raw []byte, group, version, kind, namespace string) (unstructured.Unstructured, error)
ConvertResource converts raw bytes to an unstructured object
func CopySlice ¶ added in v1.7.0
func CopySlice(s []interface{}) []interface{}
CopySlice creates a full copy of the target slice
func CopySliceOfMaps ¶ added in v1.7.0
func CopySliceOfMaps(s []map[string]interface{}) []interface{}
CopySliceOfMaps creates a full copy of the target slice
func ExtractResources ¶ added in v1.2.0
func ExtractResources(newRaw []byte, request *admissionv1.AdmissionRequest) (unstructured.Unstructured, unstructured.Unstructured, error)
ExtractResources extracts the new and old resource as unstructured
func GenerateAnnotationPatches ¶ added in v1.7.0
func GenerateAnnotationPatches(engineResponses []*response.EngineResponse, log logr.Logger) [][]byte
func GetPolicy ¶ added in v1.2.0
func GetPolicy(bytes []byte) (policies []kyverno.PolicyInterface, err error)
GetPolicy - extracts policies from YAML bytes
func HigherThanKubernetesVersion ¶ added in v1.2.0
func HigherThanKubernetesVersion(client discovery.ServerVersionInterface, log logr.Logger, major, minor, patch int) bool
HigherThanKubernetesVersion compare Kubernetes client version to user given version
func NormalizeSecret ¶ added in v1.6.1
func NormalizeSecret(resource *unstructured.Unstructured) (unstructured.Unstructured, error)
func OverrideRuntimeErrorHandler ¶ added in v1.7.2
func OverrideRuntimeErrorHandler()
func SliceContains ¶ added in v1.2.0
SliceContains checks whether values are contained in slice