Documentation ¶
Index ¶
- func Btoi(b bool) int
- func CRDInstalled(discovery client.IDiscovery, log logr.Logger) bool
- func CleanupOldCrd(client *dclient.Client, log logr.Logger)
- 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 HigherThanKubernetesVersion(client *client.Client, log logr.Logger, k8smajor, k8sminor, k8ssub 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
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 CleanupOldCrd ¶ added in v1.1.0
CleanupOldCrd deletes any existing NamespacedPolicyViolation resources in cluster If resource violates policy, new Violations will be generated
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.1.6
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.1.6
func ExtractResources(newRaw []byte, request *v1beta1.AdmissionRequest) (unstructured.Unstructured, unstructured.Unstructured, error)
extracts the new and old resource as unstructured
func HigherThanKubernetesVersion ¶ added in v1.1.6
func HigherThanKubernetesVersion(client *client.Client, log logr.Logger, k8smajor, k8sminor, k8ssub int) bool
HigherThanKubernetesVersion compare kuberneates 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.1.5
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.1.6
Types ¶
This section is empty.