Documentation
¶
Index ¶
- func ApiextensionsJsonToKyvernoConditions(original apiextensions.JSON) (interface{}, error)
- func CRDsInstalled(discovery client.IDiscovery) bool
- func ContainsNamepace(patterns []string, ns string) bool
- func ContainsPod(list []string, element string) bool
- func ContainsString(list []string, element string) bool
- func ConvertResource(raw []byte, group, version, kind, namespace string) (unstructured.Unstructured, error)
- func ExtractResources(newRaw []byte, request *v1beta1.AdmissionRequest) (unstructured.Unstructured, unstructured.Unstructured, error)
- func GetPolicy(bytes []byte) (clusterPolicies []*v1.ClusterPolicy, err error)
- func HigherThanKubernetesVersion(client *client.Client, log logr.Logger, major, minor, patch int) bool
- func JoinPatches(patches [][]byte) []byte
- func MarshalPolicy(policy v1.ClusterPolicy) []byte
- func NewKubeClient(config *rest.Config) (kubernetes.Interface, error)
- func SliceContains(slice []string, values ...string) bool
- func SplitYAMLDocuments(yamlBytes []byte) (policies [][]byte, error error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 ContainsPod ¶ added in v1.5.0
func ContainsString ¶ added in v0.10.0
ContainsString check if the string is contains in a 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 ExtractResources ¶ added in v1.2.0
func ExtractResources(newRaw []byte, request *v1beta1.AdmissionRequest) (unstructured.Unstructured, unstructured.Unstructured, error)
ExtractResources extracts the new and old resource as unstructured
func GetPolicy ¶ added in v1.2.0
func GetPolicy(bytes []byte) (clusterPolicies []*v1.ClusterPolicy, err error)
GetPolicy - extracts policies from YAML bytes
func HigherThanKubernetesVersion ¶ added in v1.2.0
func HigherThanKubernetesVersion(client *client.Client, log logr.Logger, major, minor, patch int) bool
HigherThanKubernetesVersion compare Kubernetes client version to user given version
func JoinPatches ¶ added in v0.8.0
JoinPatches joins array of serialized JSON patches to the single JSONPatch array
func MarshalPolicy ¶ added in v1.2.0
func MarshalPolicy(policy v1.ClusterPolicy) []byte
MarshalPolicy accurately marshals a policy to JSON, normal marshal would cause empty sub structs in policy to be non nil. TODO This needs to be removed. A simpler way to encode and decode Policy is needed.
func NewKubeClient ¶ added in v0.8.0
func NewKubeClient(config *rest.Config) (kubernetes.Interface, error)
NewKubeClient returns a new kubernetes client
func SliceContains ¶ added in v1.2.0
SliceContains checks whether values are contained in slice
func SplitYAMLDocuments ¶ added in v1.2.0
SplitYAMLDocuments reads the YAML bytes per-document, unmarshals the TypeMeta information from each document and returns a map between the GroupVersionKind of the document and the document bytes
Types ¶
This section is empty.