Documentation
¶
Overview ¶
Package utils contains utilities common to all units of the Operator
The package includes:
- Common utilities
- Common test utilities, like constructors for test doubles etc
Index ¶
- Constants
- Variables
- func AddCommandToChannel(ctx context.Context, cmd *apis.Command, workerPool *ants.PoolWithFunc)
- func ExtractContainersToImageIDsFromPod(pod *core1.Pod) map[string]string
- func ExtractImageID(imageID string) string
- func InitKubescapeHttpClient() httputils.IHttpClient
- func InitReporterHttpClient() httputils.IHttpClient
- func InitVulnScanHttpClient() httputils.IHttpClient
- func LoadEnvironmentVariables(ctx context.Context) (err error)
- func MapToString(m map[string]interface{}) []string
- func NewJobTracking(reporter reporterlib.IReporter) *apis.JobTracking
- func NewK8sInterfaceFake(k8sClient k8s.Interface) *k8sinterface.KubernetesApi
- type ClientMock
- type CredStruct
- type Job
- type SessionObj
Constants ¶
View Source
const ( ReleaseBuildTagEnvironmentVariable = "RELEASE" NamespaceEnvironmentVariable = "NAMESPACE" ConfigEnvironmentVariable = "CONFIG" PortEnvironmentVariable = "PORT" CleanUpDelayEnvironmentVariable = "CLEANUP_DELAY" TriggerSecurityFrameworkEnvironmentVariable = "TRIGGER_SECURITY_FRAMEWORK" ConcurrencyEnvironmentVariable = "WORKER_CONCURRENCY" )
View Source
const ContainerToImageIdsArg = "containerToImageIDs"
View Source
const KubescapeRequestPathV1 = "v1/scan"
View Source
const KubescapeRequestStatusV1 = "v1/status"
View Source
const KubescapeScanV1 = "scanV1"
Variables ¶
View Source
var ( Namespace string = "default" // default namespace RestAPIPort string = "4002" // default port CleanUpRoutineInterval time.Duration = 10 * time.Minute ConcurrencyWorkers int = 3 TriggerSecurityFramework bool = false )
View Source
var ClusterConfig = &utilsmetadata.ClusterConfig{}
View Source
var ReporterHttpClient httputils.IHttpClient
Functions ¶
func AddCommandToChannel ¶ added in v0.1.21
func ExtractContainersToImageIDsFromPod ¶ added in v0.1.21
func ExtractImageID ¶ added in v0.1.21
func InitKubescapeHttpClient ¶
func InitKubescapeHttpClient() httputils.IHttpClient
func InitReporterHttpClient ¶
func InitReporterHttpClient() httputils.IHttpClient
func InitVulnScanHttpClient ¶
func InitVulnScanHttpClient() httputils.IHttpClient
func MapToString ¶
func NewJobTracking ¶
func NewJobTracking(reporter reporterlib.IReporter) *apis.JobTracking
func NewK8sInterfaceFake ¶ added in v0.1.21
func NewK8sInterfaceFake(k8sClient k8s.Interface) *k8sinterface.KubernetesApi
NewK8sInterfaceFake returns a new K8sInterface with a fake Kubernetes Client attached
This function is a Dependency Injection-friendly version for the `KubernetesApi` constructor that allows to inject any Kubernetes Clients. For example, the official fake Kubernetes client, so unit tests would have a suitable test double instead of trying to talk to a real cluster
Types ¶
type ClientMock ¶
type ClientMock struct {
}
type CredStruct ¶
type CredStruct struct {
User string `json:"user"`
Password string `json:"password"`
Customer string `json:"customer"`
}
CredStruct holds the various credentials needed to do login into CA BE
type Job ¶ added in v0.1.39
type Job struct {
// contains filtered or unexported fields
}
func (*Job) Obj ¶ added in v0.1.39
func (j *Job) Obj() SessionObj
func (*Job) SetContext ¶ added in v0.1.39
func (*Job) SetObj ¶ added in v0.1.39
func (j *Job) SetObj(sessionObj SessionObj)
type SessionObj ¶
type SessionObj struct {
Command apis.Command `json:"command"`
Reporter reporterlib.IReporter `json:"reporter"`
ErrChan chan error `json:"-"`
}
Commands list of commands received from websocket
func NewSessionObj ¶
func (*SessionObj) WatchErrors ¶
func (sessionObj *SessionObj) WatchErrors(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.