controllers

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: BSD-3-Clause Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://github.com/openshift/machine-config-operator/blob/b36482885ba1304e122e7c01c26cd671dfdd0418/pkg/daemon/constants/constants.go#L17
	// https://github.com/openshift/machine-config-operator/blob/b36482885ba1304e122e7c01c26cd671dfdd0418/pkg/daemon/drain.go#L79
	// DesiredDrainerAnnotationKey is set by OCP to indicate drain/uncordon requests
	DesiredDrainerAnnotationKey = "machineconfiguration.openshift.io/desiredDrain"
	// LastAppliedDrainerAnnotationKey is by OCP to indicate the last request applied
	LastAppliedDrainerAnnotationKey = "machineconfiguration.openshift.io/lastAppliedDrain"
)
View Source
const (
	EventReasonUpgradeConfigSuspended                   = "UpgradeConfigSuspended"
	EventReasonUpgradeConfigSuspendedBySuspensionWindow = "UpgradeConfigSuspendedBySuspensionWindow"
)
View Source
const MetricsNamespace = "openshift_upgrade_controller"
View Source
const (
	UpgradeJobHookJobTrackerFinalizer = "upgradejobs.managedupgrade.appuio.io/hook-job-tracker"
)

Variables

View Source
var ClusterVersionLockAnnotation = managedupgradev1beta1.GroupVersion.Group + "/upgrade-job"

Functions

func JobFromClusterVersionMapper

func JobFromClusterVersionMapper(c client.Reader, cvName string) handler.MapFunc

JobFromClusterVersionMapper returns the job locking the cluster version or nothing. The given object is ignored.

Types

type Clock

type Clock interface {
	Now() time.Time
}

type ClusterVersionCollector added in v0.7.0

type ClusterVersionCollector struct {
	Client client.Client

	ManagedClusterVersionName      string
	ManagedClusterVersionNamespace string
}

ClusterVersionCollector is a Prometheus collector that collects cluster info metrics.

func (*ClusterVersionCollector) Collect added in v0.7.0

func (m *ClusterVersionCollector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector. Collects metrics from the cluster version object and sends them to the channel.

func (*ClusterVersionCollector) Describe added in v0.7.0

func (*ClusterVersionCollector) Describe(d chan<- *prometheus.Desc)

Describe implements prometheus.Collector. Sends the descriptors of the metrics to the channel.

type ClusterVersionReconciler

type ClusterVersionReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	Clock

	ManagedUpstreamClusterVersionName string
	ManagedClusterVersionName         string
	ManagedClusterVersionNamespace    string
}

ClusterVersionReconciler reconciles a ClusterVersion object

func (*ClusterVersionReconciler) Filter

func (r *ClusterVersionReconciler) Filter(obj client.Object) bool

Filter filters the ClusterVersion objects to only reconcile the managed ClusterVersion object. Returns true if the object is managed by this controller.

func (*ClusterVersionReconciler) Reconcile

Reconcile compares the ClusterVersion object with the upstream ClusterVersion object and updates the upstream ClusterVersion object if necessary.

func (*ClusterVersionReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager. The controller is setup to watch the managed ClusterVersion object and the upstream ClusterVersion object.

type NodeReconciler

type NodeReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

NodeReconciler reconciles a Node object

func (*NodeReconciler) Reconcile

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

Reconcile reacts to Node changes and updates the node draining metric.

func (*NodeReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type UpgradeConfigReconciler

type UpgradeConfigReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder

	Clock Clock

	ManagedUpstreamClusterVersionName string
}

UpgradeConfigReconciler reconciles a UpgradeConfig object

func (*UpgradeConfigReconciler) Reconcile

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

Reconcile implements the reconcile loop for UpgradeConfig. It schedules UpgradeJobs based on the UpgradeConfig's schedule - if an update is available.

func (*UpgradeConfigReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type UpgradeInformationCollector added in v0.7.0

type UpgradeInformationCollector struct {
	client.Client

	ManagedUpstreamClusterVersionName string
}

UpgradeInformationCollector is a Prometheus collector that exposes various metrics about the upgrade process.

func (*UpgradeInformationCollector) Collect added in v0.7.0

func (m *UpgradeInformationCollector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector. Sends a metric if the cluster is currently upgrading and an upgrading metric for each machine config pool. It also collects job states and whether they have matching disruptive hooks.

func (*UpgradeInformationCollector) Describe added in v0.7.0

func (*UpgradeInformationCollector) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector. Sends the static description of the metrics to the provided channel.

type UpgradeJobReconciler

type UpgradeJobReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	Clock Clock

	ManagedUpstreamClusterVersionName string
}

UpgradeJobReconciler reconciles a UpgradeJob object

func (*UpgradeJobReconciler) Reconcile

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

Reconcile reconciles a UpgradeJob object and starts the upgrade if necessary.

func (*UpgradeJobReconciler) SetupWithManager

func (r *UpgradeJobReconciler) 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