Documentation ¶
Overview ¶
Package util contains helper functions needed by unit tests
Index ¶
- func AnnotateNS(name, key, value string) error
- func AnnotationsMatch(pod corev1.Pod, ants []string) bool
- func AssertCommand(wp string, namespace string, cmd []string, match gomegaTypes.GomegaMatcher, ...)
- func ContainerInfo() (*pb.ProbeResponse, error)
- func DeleteAllCsp() error
- func DeleteAllHsp() error
- func DeleteAllKsp() error
- func DeleteKAConfigMap() error
- func GetK8sClient() *kcli.Client
- func GetOperations(logs []*pb.Log) []string
- func IsOperationsExpected(operations []string, expected []string) bool
- func K8sApply(files []string) error
- func K8sApplyFile(fileName string) error
- func K8sDaemonSetCheck(dsname string, ns string, timeout time.Duration) error
- func K8sDelete(files []string) error
- func K8sDeploymentCheck(depname string, ns string, timeout time.Duration) error
- func K8sExecInPod(pod string, ns string, cmd []string) (string, string, error)
- func K8sExecInPodWithContainer(pod string, ns string, container string, cmd []string) (string, string, error)
- func K8sGetPods(podstr string, ns string, ants []string, timeout int) ([]string, error)
- func K8sRuntime() string
- func K8sRuntimeEnforcer() string
- func KarmorGetLogs(timeout time.Duration, maxEvents int) ([]*pb.Log, []*pb.Alert, error)
- func KarmorLogStart(logFilter string, ns string, op string, pod string) error
- func KarmorLogStop()
- func KspDeleteAll()
- func Kubectl(cmdstr string) (string, error)
- func RandString(n int) string
- func RunDockerCommand(cmdstr string) (string, error)
- func SendPolicy(eventType, path string) error
- type ConditionFunc
- type ConfigMapData
- type EventResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCommand ¶
func AssertCommand(wp string, namespace string, cmd []string, match gomegaTypes.GomegaMatcher, eventual bool)
func ContainerInfo ¶
func ContainerInfo() (*pb.ProbeResponse, error)
ContainerInfo function receives container info from kuberamor in nonk8s mode using grpc client
func DeleteAllKsp ¶
func DeleteAllKsp() error
DeleteAllKsp delete all the kubearmorpolicies from all namespaces
func GetK8sClient ¶
GetK8sClient function return instance of k8s client
func IsOperationsExpected ¶
IsOperationsExpected validates what KubeArmor Operation is expected based on visibility configuration
func K8sApplyFile ¶
K8sApplyFile can apply deployments, services, namespace, and kubearmorhostpolicy
func K8sDaemonSetCheck ¶
K8sDaemonSetCheck Check if the daemonset exists and is ready
func K8sDeploymentCheck ¶
K8sDeploymentCheck Check if the deployment exists and is ready
func K8sExecInPod ¶
K8sExecInPod Exec into the pod. Output: stdout, stderr, err
func K8sExecInPodWithContainer ¶
func K8sExecInPodWithContainer(pod string, ns string, container string, cmd []string) (string, string, error)
K8sExecInPodWithContainer Exec into the pod. Output: stdout, stderr, err
func K8sGetPods ¶
K8sGetPods Check if Pods exists and is/are Running
func K8sRuntime ¶
func K8sRuntime() string
func K8sRuntimeEnforcer ¶
func K8sRuntimeEnforcer() string
K8sRuntimeEnforcer extracts Runtime Enforcer from the Node Labels
func KarmorGetLogs ¶
KarmorGetLogs waits for logs from kubearmor. KarmorQueueLog() has to be called before this so that the channel is established.
func KarmorLogStart ¶
KarmorLogStart start observing for kubearmor telemetry events
func RunDockerCommand ¶
RunDockerCommand() executes docker commmands
func SendPolicy ¶
SendPolicy sends kubearmor policy using grpc client
Types ¶
type ConditionFunc ¶
ConditionFunc functions that fulfills the condition handling
type ConfigMapData ¶
type ConfigMapData struct { GRPC string Visibility string Cluster string DefaultFilePosture string DefaultCapabilitiesPosture string DefaultNetworkPosture string AlertThrottling string MaxAlertPerSec string ThrottleSec string }
ConfigMapData hosts the structure which is used to configure Config Map Data
func NewDefaultConfigMapData ¶
func NewDefaultConfigMapData() *ConfigMapData
NewDefaultConfigMapData returns Config Map Data with KubeArmor defaults set
func (*ConfigMapData) CreateKAConfigMap ¶
func (data *ConfigMapData) CreateKAConfigMap() error
CreateKAConfigMap function
type EventResult ¶
EventResult type
func KarmorGetTargetAlert ¶
KarmorGetTargetAlert looks for target alert in telemetry events
func KarmorGetTargetLogs ¶
KarmorGetTargetLogs waits for logs from kubearmor. KarmorLogStart() has to be called before this so that the channel is established.