Documentation ¶
Index ¶
- Constants
- Variables
- func SupportedTarget(gvk schema.GroupVersionKind) bool
- type MachineTarget
- type Reconciler
- func (r *Reconciler) AddToManager(mgr manager.Manager) error
- func (r *Reconciler) EnsureFinalizer(ma *autoscalingv1alpha1.MachineAutoscaler) error
- func (r *Reconciler) FinalizeTarget(target *MachineTarget) error
- func (r *Reconciler) GetTarget(ma *autoscalingv1alpha1.MachineAutoscaler) (*MachineTarget, error)
- func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)
- func (r *Reconciler) RemoveFinalizer(ma *autoscalingv1alpha1.MachineAutoscaler) error
- func (r *Reconciler) UpdateTarget(target *MachineTarget, min, max int) error
Constants ¶
const ( // MachineTargetFinalizer is the finalizer added to MachineAutoscaler // instances to allow for cleanup of annotations on target resources. MachineTargetFinalizer = "machinetarget.autoscaling.openshift.io" )
Variables ¶
var ErrTargetMissingAnnotations = errors.New("missing min or max annotation")
ErrTargetMissingAnnotations is the error returned when a target is missing the min or max annotations.
var ErrUnsupportedTarget = errors.New("unsupported MachineAutoscaler target")
ErrUnsupportedTarget is the error returned when a target references an object with an unsupported GroupVersionKind.
var SupportedTargetGVKs = []schema.GroupVersionKind{
{Group: "cluster.k8s.io", Version: "v1alpha1", Kind: "MachineSet"},
}
SupportedTargetGVKs is the list of GroupVersionKinds supported as targers for a MachineAutocaler instance.
Functions ¶
func SupportedTarget ¶
func SupportedTarget(gvk schema.GroupVersionKind) bool
SupportedTarget indicates whether a GVK is supported as a target.
Types ¶
type MachineTarget ¶
type MachineTarget struct {
unstructured.Unstructured
}
MachineTarget represents an unstructured target object for a MachineAutoscaler, used to update metadata only.
func (*MachineTarget) GetLimits ¶
func (mt *MachineTarget) GetLimits() (min, max int, err error)
GetLimits returns the target's min and max limits. An error may be returned if the annotations's contents could not be parsed as ints.
func (*MachineTarget) NeedsUpdate ¶
func (mt *MachineTarget) NeedsUpdate(min, max int) bool
NeedsUpdate indicates whether a target needs to be updates to match the given min and max values. An error may be returned if there was an error parsing the current values.
func (*MachineTarget) RemoveLimits ¶
func (mt *MachineTarget) RemoveLimits()
RemoveLimits removes the target's min and max annotations.
func (*MachineTarget) SetLimits ¶
func (mt *MachineTarget) SetLimits(min, max int)
SetLimits sets the target's min and max annotations.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler reconciles a MachineAutoscaler object
func NewReconciler ¶
func NewReconciler(mgr manager.Manager) *Reconciler
NewReconciler returns a new Reconciler.
func (*Reconciler) AddToManager ¶
func (r *Reconciler) AddToManager(mgr manager.Manager) error
AddToManager adds a new Controller to mgr with r as the reconcile.Reconciler
func (*Reconciler) EnsureFinalizer ¶
func (r *Reconciler) EnsureFinalizer(ma *autoscalingv1alpha1.MachineAutoscaler) error
EnsureFinalizer adds finalizers to the given MachineAutoscaler if necessary.
func (*Reconciler) FinalizeTarget ¶
func (r *Reconciler) FinalizeTarget(target *MachineTarget) error
FinalizeTarget handles finalizers for the given target.
func (*Reconciler) GetTarget ¶
func (r *Reconciler) GetTarget(ma *autoscalingv1alpha1.MachineAutoscaler) (*MachineTarget, error)
GetTarget fetches the object targeted by the given MachineAutoscaler.
func (*Reconciler) Reconcile ¶
Reconcile reads that state of the cluster for a MachineAutoscaler object and makes changes based on the state read and what is in the MachineAutoscaler.Spec
func (*Reconciler) RemoveFinalizer ¶
func (r *Reconciler) RemoveFinalizer(ma *autoscalingv1alpha1.MachineAutoscaler) error
RemoveFinalizer removes this packages's finalizers from the given MachineAutoscaler instance.
func (*Reconciler) UpdateTarget ¶
func (r *Reconciler) UpdateTarget(target *MachineTarget, min, max int) error
UpdateTarget updates the min and max annotations on the given target.