Documentation
¶
Index ¶
- func CRDInstalled(discovery client.IDiscovery, log logr.Logger) 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 ExtractResources(newRaw []byte, request *v1beta1.AdmissionRequest) (unstructured.Unstructured, unstructured.Unstructured, error)
- func GetPolicy(file []byte) (clusterPolicies []*v1.ClusterPolicy, errors []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 CRDInstalled ¶ added in v0.9.0
func CRDInstalled(discovery client.IDiscovery, log logr.Logger) bool
CRDInstalled to check if the CRD is 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 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)
extracts the new and old resource as unstructured
func GetPolicy ¶ added in v1.2.0
func GetPolicy(file []byte) (clusterPolicies []*v1.ClusterPolicy, errors []error)
GetPolicy - Extracts policies from a YAML
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
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.