Documentation
¶
Index ¶
- Constants
- Variables
- func JobFromClusterVersionMapper(c client.Reader, cvName string) handler.MapFunc
- func NodeToNodeForceDrainMapper(c client.Reader) handler.TypedMapFunc[*corev1.Node, reconcile.Request]
- type Clock
- type ClusterVersionCollector
- type ClusterVersionReconciler
- type MachineCollector
- type NodeCollector
- type NodeForceDrainReconciler
- type UpgradeConfigReconciler
- type UpgradeInformationCollector
- type UpgradeJobReconciler
- type UpgradeSuspensionWindowReconciler
Constants ¶
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" )
const ( EventReasonUpgradeConfigSuspended = "UpgradeConfigSuspended" EventReasonUpgradeConfigSuspendedBySuspensionWindow = "UpgradeConfigSuspendedBySuspensionWindow" )
const MetricsNamespace = "openshift_upgrade_controller"
const (
UpgradeJobHookJobTrackerFinalizer = "upgradejobs.managedupgrade.appuio.io/hook-job-tracker"
)
Variables ¶
var JobLockAnnotation = managedupgradev1beta1.GroupVersion.Group + "/upgrade-job"
Functions ¶
func JobFromClusterVersionMapper ¶
JobFromClusterVersionMapper returns the job locking the cluster version or nothing. The given object is ignored.
func NodeToNodeForceDrainMapper ¶ added in v0.11.0
func NodeToNodeForceDrainMapper(c client.Reader) handler.TypedMapFunc[*corev1.Node, reconcile.Request]
NodeToNodeForceDrainMapper maps Nodes to NodeForceDrain requests. It matches the nodes labels to the NodeForceDrain.spec.nodeSelector.
Types ¶
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 ¶
func (r *ClusterVersionReconciler) Reconcile(ctx context.Context, _ ctrl.Request) (ctrl.Result, error)
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 MachineCollector ¶ added in v0.12.0
type MachineCollector struct { client.Client // MachineNamespace is the namespace where the machines are located. MachineNamespace string }
MachineCollector collects metrics from Machines
func (*MachineCollector) Collect ¶ added in v0.12.0
func (c *MachineCollector) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector. Sends a metric with the current state of the machines to the provided channel.
func (*MachineCollector) Describe ¶ added in v0.12.0
func (*MachineCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector. Sends the static description of the metrics to the provided channel.
type NodeCollector ¶ added in v0.12.0
NodeCollector collects metrics from Nodes
func (*NodeCollector) Collect ¶ added in v0.12.0
func (c *NodeCollector) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector. Sends a metric with the current value of the Node draining status to the provided channel.
func (*NodeCollector) Describe ¶ added in v0.12.0
func (*NodeCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector. Sends the static description of the metrics to the provided channel.
type NodeForceDrainReconciler ¶ added in v0.11.0
type NodeForceDrainReconciler struct { client.Client // APIReader is used to read objects directly from the API. // It is used to avoid caching all pods in the controller. APIReader client.Reader Scheme *runtime.Scheme // Recorder is used to record pod deletion events on nodes. Recorder record.EventRecorder Clock Clock // MaxReconcileIntervalDuringActiveDrain is the longest possible interval at which the controller reconciles during active node drains. // It is used to guard against edge cases where the controller might miss a pod deletion. // One example would be if a daemon set orphans a pod after the controller has reconciled. // It will also guard against any logic errors in the controller. MaxReconcileIntervalDuringActiveDrain time.Duration }
NodeForceDrainReconciler reconciles the NodeForceDrain object It should be called on node change events. It force drains nodes after a certain period of time.
func (*NodeForceDrainReconciler) Reconcile ¶ added in v0.11.0
func (r *NodeForceDrainReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile reacts to Node changes and force drains nodes after a certain period of time.
func (*NodeForceDrainReconciler) SetupWithManager ¶ added in v0.11.0
func (r *NodeForceDrainReconciler) 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
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.
type UpgradeSuspensionWindowReconciler ¶ added in v0.9.0
UpgradeSuspensionWindowReconciler reconciles a UpgradeSuspensionWindow object
func (*UpgradeSuspensionWindowReconciler) Reconcile ¶ added in v0.9.0
func (r *UpgradeSuspensionWindowReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile implements the reconcile loop for UpgradeSuspensionWindow. It writes the list of matching UpgradeConfigs and UpgradeJobs to the status.
func (*UpgradeSuspensionWindowReconciler) SetupWithManager ¶ added in v0.9.0
func (r *UpgradeSuspensionWindowReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.