controllers

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 62 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ControllerName string = "configuration-policy-controller"
	CRDName        string = "configurationpolicies.policy.open-cluster-management.io"
)
View Source
const (
	OperatorControllerName string = "operator-policy-controller"
	CatalogSourceReady     string = "READY"

	ManagedByLabel        string = "operatorpolicy.policy.open-cluster-management.io/managed"
	ManagedByAnnotation   string = ManagedByLabel
	ClusterNameLabel      string = "policy.open-cluster-management.io/cluster-name"
	ClusterNamespaceLabel string = "policy.open-cluster-management.io/cluster-namespace"
)
View Source
const IVAnnotation = "policy.open-cluster-management.io/encryption-iv"

Variables

View Source
var (
	ErrPackageManifest = errors.New("")
)
View Source
var ErrPolicyInvalid = errors.New("the Policy is invalid")

PlcChan a channel used to pass policies ready for update

Functions

func IsBeingUninstalled added in v0.13.0

func IsBeingUninstalled(client client.Client) (bool, error)

Types

type ConfigurationPolicyReconciler

type ConfigurationPolicyReconciler struct {
	// This client, initialized using mgr.Client() above, is a split client
	// that reads objects from the cache and writes to the apiserver
	client.Client
	DecryptionConcurrency uint8
	DynamicWatcher        depclient.DynamicWatcher
	Scheme                *runtime.Scheme
	Recorder              record.EventRecorder

	InstanceName string
	// The Kubernetes client to use when evaluating/enforcing policies. Most times, this will be the same cluster
	// where the controller is running.
	TargetK8sClient        kubernetes.Interface
	TargetK8sDynamicClient dynamic.Interface
	SelectorReconciler     common.SelectorReconciler
	// Whether custom metrics collection is enabled
	EnableMetrics bool
	ServerVersion string

	// When true, the controller has detected it is being uninstalled and only basic cleanup should be performed before
	// exiting.
	UninstallMode bool
	// The number of seconds before a policy is eligible for reevaluation in watch mode (throttles frequently evaluated
	// policies)
	EvalBackoffSeconds uint32
	// contains filtered or unexported fields
}

ConfigurationPolicyReconciler reconciles a ConfigurationPolicy object

func (*ConfigurationPolicyReconciler) Reconcile

func (r *ConfigurationPolicyReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error)

Reconcile is responsible for evaluating and rescheduling ConfigurationPolicy evaluations.

func (*ConfigurationPolicyReconciler) SetupWithManager

func (r *ConfigurationPolicyReconciler) SetupWithManager(
	mgr ctrl.Manager, evaluationConcurrency uint16, rawSources ...source.TypedSource[reconcile.Request],
) error

SetupWithManager sets up the controller with the Manager.

type OperatorPolicyReconciler added in v0.12.0

type OperatorPolicyReconciler struct {
	client.Client
	DynamicClient    dynamic.Interface
	DynamicWatcher   depclient.DynamicWatcher
	InstanceName     string
	DefaultNamespace string
	TargetClient     client.Client
}

OperatorPolicyReconciler reconciles a OperatorPolicy object

func (*OperatorPolicyReconciler) Reconcile added in v0.12.0

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. (user): Modify the Reconcile function to compare the state specified by the OperatorPolicy object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.14.4/pkg/reconcile

func (*OperatorPolicyReconciler) SetupWithManager added in v0.12.0

func (r *OperatorPolicyReconciler) SetupWithManager(
	mgr ctrl.Manager, depEvents source.TypedSource[reconcile.Request],
) error

SetupWithManager sets up the controller with the Manager and will reconcile when the dynamic watcher sees that an object is updated

Jump to

Keyboard shortcuts

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