controller

package
v0.2.7-beta.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

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)

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
	SidecarImage      string
	SidecarPullPolicy corev1.PullPolicy
}

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 pod, upload pod (if applicable) and upload service (if applicable) for a given pipeline. It ensures that the pods 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. Fetch referenced resources (profile, downloader, uploaders) 3. Update status to indicate if scan only (exit if updated) 4. Fetch or create upload pod if applicable (exit if created) 5. Fetch or create upload service if applicable (exit if created) 6. Await upload pod running, and create scan pod if applicable (exit if created) 8. Continually Update the pipeline status accordingly based on the state of the pods 9. Once completed, await TTL if set For more details, check Reconcile and its Result here: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler

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
	SidecarImage      string
	SidecarPullPolicy corev1.PullPolicy
}

SearchReconciler reconciles a Search object

func (*SearchReconciler) Reconcile

func (r *SearchReconciler) 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 Search reconciler is responsible for creating and managing the search pod, role binding, and service account. It ensures that the search pod is created and tied to the service account with the necessary permissions. Users can supply a service account in which case a role binding will reference it but the search controller will not update. Breakdown of the reconciliation steps: 1. Fetch the search instance 2. Fetch referenced resources (crawler) 4. Fetch or create serivceaccount (exit if created) 5. Fetch or create role binding (exit if created) 6. Fetch or create pod (exit if created) 7. Continually Update the search status accordingly based on the state of the pod 9. Once completed, await TTL if set For more details, check Reconcile and its Result here: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler

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