controller

package
v0.2.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultsVolumeName = "results"
	ResultsDirectory  = "/mnt/results"

	TargetVolumeName = "target"
	TargetDirectory  = "/mnt/target"

	ExtractorPort = 2121
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock knows how to get the current time. It can be used to fake out timing for testing.

type CronSearchReconciler

type CronSearchReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	SearchClusterRole string
	Clock
}

CronSearchReconciler reconciles a CronSearch object

func (*CronSearchReconciler) Reconcile

func (r *CronSearchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. This function is designed to behave the same as k8s.io/api/batch/v1.CronJob controller, The actual implementation is copied and modified from the kubebuilder tutorial, where a CronJob controller is implemented. https://github.com/kubernetes-sigs/kubebuilder/blob/master/docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go why re-invent the wheel?

func (*CronSearchReconciler) SetupWithManager

func (r *CronSearchReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type PipelineReconciler

type PipelineReconciler struct {
	client.Client
	Scheme         *runtime.Scheme
	ExtractorImage string
}

PipelineReconciler reconciles a Pipeline object

func (*PipelineReconciler) Reconcile

func (r *PipelineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. The pipeline reconciler is responsible for creating and managing the scan and upload jobs for a given pipeline. It ensures that the jobs are created and updated as necessary, and that the status of the pipeline is updated accordingly. Breakdown of the reconciliation steps: 1. Fetch the pipeline instance 2. Handle finalizers 3. If the pipeline has a completion time, check if it needs to be deleted based on TTL 4. Fetch and validate the profile and downloader references 5. Determine if an upload job is needed based on the profile's artifacts and uploader references 6. If an upload job is needed, fetch or create the upload job and service 7. Fetch or create the scan job 8. Update the pipeline status accordingly based on the state of the jobs For more details, check Reconcile and its Result here:

func (*PipelineReconciler) SetupWithManager

func (r *PipelineReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type SearchReconciler

type SearchReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	SearchClusterRole string
}

SearchReconciler reconciles a Search object

func (*SearchReconciler) Reconcile

func (r *SearchReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*SearchReconciler) SetupWithManager

func (r *SearchReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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