operator

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 62 Imported by: 0

Documentation

Overview

Package operator provides primitives for implementing Trivy-Operator Operator.

Index

Constants

View Source
const (
	K8sRepo     = "kubernetes"
	K8sRegistry = "k8s.io"
)

Variables

This section is empty.

Functions

func CacheTransform added in v0.35.0

func CacheTransform() toolscache.TransformFunc

CacheTransform returns the transform applied to every object entering the operator's shared informer cache. It strips managed fields, the last-applied-configuration annotation and the Data and BinaryData of every ConfigMap, all of which keep the cache small.

ConfigMap contents are stripped even though ConfigMap is in ClientCacheOptions' DisableFor list, because the two settings act on different paths. DisableFor only changes where reads through the manager client go; it does not stop the informers. Config-audit, ChecksLoader and PolicyConfigController all watch ConfigMaps, so without this transform the informer store would hold the contents of every watched ConfigMap in memory while nothing ever read them from there.

Stripping is therefore safe: every ConfigMap read through the manager client - including the object config-audit serializes into Rego - is served by the API server and carries full contents.

func ClientCacheOptions added in v0.35.0

func ClientCacheOptions() *client.CacheOptions

ClientCacheOptions returns the cache configuration for the manager's client, listing the object types whose reads bypass the shared informer cache and go straight to the API server.

Secret and ServiceAccount are listed because their contents are never served from the cache. ConfigMap is listed because CacheTransform strips ConfigMap contents on the way in, so a cached read would return an object with no Data.

Both Start and the envtest suite configure their manager from this function, so the tests exercise the production configuration instead of a copy that can drift. Each call returns independent values, including a new DisableFor slice, so one caller cannot mutate the configuration used by another.

func Start

func Start(ctx context.Context, buildInfo trivyoperator.BuildInfo, operatorConfig etc.Config) error

Start starts all registered reconcilers and blocks until the context is canceled. Returns an error if there is an error starting any reconciler.

Types

type ClusterController added in v0.18.0

type ClusterController struct {
	logr.Logger
	*vc.WorkloadController
	// contains filtered or unexported fields
}
ClusterReconciler reconciles corev1.Node and corev1.Pod objects

to collect cluster nodes and cluster core components (api-server,kubelet,etcd and more) information for vulnerability scanning the node information will be evaluated by the compliance control checks per relevant reports, examples: cis-benchmark and nsa

func (*ClusterController) SetupWithManager added in v0.18.0

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

type TTLReportReconciler added in v0.5.0

func (*TTLReportReconciler) DeleteReportIfExpired added in v0.5.0

func (r *TTLReportReconciler) DeleteReportIfExpired(ctx context.Context, namespacedName types.NamespacedName, reportType client.Object, _ ...string) (ctrl.Result, error)

func (*TTLReportReconciler) SetupWithManager added in v0.5.0

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

type TTLSecretReconciler added in v0.19.0

type TTLSecretReconciler struct {
	logr.Logger
	etc.Config
	client.Client
	ext.Clock
}

func (*TTLSecretReconciler) SetupWithManager added in v0.19.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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