mainhandler

package
v0.2.240 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 68 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WaitTimeForKubescapeScanResponse = 40
	KubescapeCronJobTemplateName     = "kubescape-cronjob-template"
)
View Source
const (
	KubescapeResponse string = "KubescapeResponse"
)
View Source
const (
	MaxLimitationInsertToCommandResponseChannelGoRoutine = 10
)
View Source
const VulnScanCronjobTemplateName = "kubevuln-cronjob-template"

Variables

View Source
var KubescapeHttpClient httputils.IHttpClient
View Source
var VulnScanHttpClient httputils.IHttpClient

Functions

func GetStartupActions

func GetStartupActions(config config.IConfig) []apis.Command

func HandleKubescapeResponse

func HandleKubescapeResponse(ctx context.Context, config config.IConfig, payload interface{}) (bool, *time.Duration)

func MigrateScheduleCronJobs added in v0.2.194

func MigrateScheduleCronJobs(ctx context.Context, k8sAPI *k8sinterface.KubernetesApi, namespace string) error

MigrateScheduleCronJobs re-renders the pods of the schedules the operator created for the backend from the current templates. A schedule is rendered once, when it is created, and an update command rewrites only its schedule and annotations, so a schedule keeps the containers of the chart release it was created under after the chart changes them: before helm-charts#964 it posts to the operator's trigger port, which the chart's NetworkPolicy no longer admits, and after a later template change it can need a ConfigMap or image the chart no longer ships. A schedule whose containers differ from the template's is re-rendered. Only the pod spec changes: name, schedule and the request ConfigMap stay. The pod labels and annotations the template sets, such as the chart's podLabels and podAnnotations, are applied to every schedule, and the ones the template does not set, such as the job ID the backend gave the schedule, stay. A CronJob that the operator did not create, such as the chart's own scheduler with the same tier label, and a template that is not installed leave the CronJob alone. The first failed update is returned once every schedule was tried.

Types

type ActionHandler

type ActionHandler struct {
	// contains filtered or unexported fields
}

func NewActionHandler

func NewActionHandler(config config.IConfig, k8sAPI *k8sinterface.KubernetesApi, ksStorageClient kssc.Interface, sessionObj *utils.SessionObj, commandResponseChannel *commandResponseChannelData, exporter exporters.Exporter) *ActionHandler

CreateWebSocketHandler Create ws-handler obj

type AuthMethods

type AuthMethods string

type CommandResponseData

type CommandResponseData struct {
	// contains filtered or unexported fields
}

type HandleCommandResponseCallBack

type HandleCommandResponseCallBack func(ctx context.Context, config config.IConfig, payload interface{}) (bool, *time.Duration)

type ImageScanConfig added in v0.2.6

type ImageScanConfig struct {
	// contains filtered or unexported fields
}

type MainHandler

type MainHandler struct {
	// contains filtered or unexported fields
}

func NewMainHandler

func NewMainHandler(config config.IConfig, k8sAPI *k8sinterface.KubernetesApi, exporter exporters.Exporter, ksStorageClient kssc.Interface) *MainHandler

CreateWebSocketHandler Create ws-handler obj

func (*MainHandler) EventWorkerPool added in v0.1.39

func (mainHandler *MainHandler) EventWorkerPool() *ants.PoolWithFunc

func (*MainHandler) HandleCommandResponse added in v0.1.39

func (mainHandler *MainHandler) HandleCommandResponse(ctx context.Context)

func (*MainHandler) HandleImageScanningScopedRequest added in v0.2.4

func (mainHandler *MainHandler) HandleImageScanningScopedRequest(ctx context.Context, sessionObj *utils.SessionObj)

HandleScopedRequest handle a request of a scope e.g. all workloads in a namespace

func (*MainHandler) HandleScopedRequest

func (mainHandler *MainHandler) HandleScopedRequest(ctx context.Context, sessionObj *utils.SessionObj)

HandleScopedRequest handle a request of a scope e.g. all workloads in a namespace

func (*MainHandler) HandleSingleRequest

func (mainHandler *MainHandler) HandleSingleRequest(ctx context.Context, sessionObj *utils.SessionObj) (err error)

func (*MainHandler) HandleWatchers added in v0.1.21

func (mainHandler *MainHandler) HandleWatchers(ctx context.Context)

HandleWatchers starts the watchers the enabled components need: commands, SBOMs or pods for image scans and the SBOM export, container profiles and security exceptions.

func (*MainHandler) SendReports added in v0.2.31

func (mainHandler *MainHandler) SendReports(ctx context.Context, period time.Duration)

func (*MainHandler) SetupContinuousScanning added in v0.1.70

func (mainHandler *MainHandler) SetupContinuousScanning(ctx context.Context) error

SetupContinuousScanning sets up the continuous cluster scanning function

func (*MainHandler) StartContinuousScanning added in v0.1.70

func (h *MainHandler) StartContinuousScanning(_ context.Context) error

func (*MainHandler) StartupTriggerActions

func (mainHandler *MainHandler) StartupTriggerActions(ctx context.Context, actions []apis.Command)

HandlePostmanRequest Parse received commands and run the command

Directories

Path Synopsis
Package remediators implements the individual cluster operations ("actions") that the operator performs in response to a TypeOperatorAction command.
Package remediators implements the individual cluster operations ("actions") that the operator performs in response to a TypeOperatorAction command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL