clusterautoscaler

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoscalerArgs

func AutoscalerArgs(ca *v1alpha1.ClusterAutoscaler, namespace string) []string

AutoscalerArgs returns a slice of strings representing command line arguments to the cluster-autoscaler corresponding to the values in the given ClusterAutoscaler resource.

func ResourceArgs

func ResourceArgs(rl *v1alpha1.ResourceLimits) []string

ResourceArgs returns a slice of strings representing command line arguments to the cluster-autoscaler corresponding to the values in the given ResourceLimits object.

func ScaleDownArgs

func ScaleDownArgs(sd *v1alpha1.ScaleDownConfig) []string

ScaleDownArgs returns a slice of strings representing command line arguments to the cluster-autoscaler corresponding to the values in the given ScaleDownConfig object.

Types

type AutoscalerArg

type AutoscalerArg string

AutoscalerArg represents a command line argument to the cluster-autoscaler that may be combined with a value or numerical range.

const (
	LogToStderrArg                  AutoscalerArg = "--logtostderr"
	NamespaceArg                    AutoscalerArg = "--namespace"
	CloudProviderArg                AutoscalerArg = "--cloud-provider"
	MaxGracefulTerminationSecArg    AutoscalerArg = "--max-graceful-termination-sec"
	ExpendablePodsPriorityCutoffArg AutoscalerArg = "--expendable-pods-priority-cutoff"
	ScaleDownEnabledArg             AutoscalerArg = "--scale-down-enabled"
	ScaleDownDelayAfterAddArg       AutoscalerArg = "--scale-down-delay-after-add"
	ScaleDownDelayAfterDeleteArg    AutoscalerArg = "--scale-down-delay-after-delete"
	ScaleDownDelayAfterFailureArg   AutoscalerArg = "--scale-down-delay-after-failure"
	MaxNodesTotalArg                AutoscalerArg = "--max-nodes-total"
	CoresTotalArg                   AutoscalerArg = "--cores-total"
	MemoryTotalArg                  AutoscalerArg = "--memory-total"
	GPUTotalArg                     AutoscalerArg = "--gpu-total"
)

These constants represent the cluster-autoscaler arguments used by the operator when processing ClusterAutoscaler resources.

func (AutoscalerArg) Range

func (a AutoscalerArg) Range(min, max int) string

Range returns the argument with the given numerical range set.

func (AutoscalerArg) String

func (a AutoscalerArg) String() string

String returns the argument as a plain string.

func (AutoscalerArg) TypeRange

func (a AutoscalerArg) TypeRange(t string, min, max int) string

TypeRange returns the argument with the given type and numerical range set.

func (AutoscalerArg) Value

func (a AutoscalerArg) Value(v interface{}) string

Value returns the argument with the given value set.

type Config

type Config struct {
	// The name of the singleton ClusterAutoscaler resource.
	Name string
	// The namespace for cluster-autoscaler deployments.
	Namespace string
	// The cluster-autoscaler image to use in deployments.
	Image string
	// The number of replicas in cluster-autoscaler deployments.
	Replicas int32
}

Config represents the configuration for a reconciler instance.

type Reconciler

type Reconciler struct {
	// contains filtered or unexported fields
}

Reconciler reconciles a ClusterAutoscaler object

func NewReconciler

func NewReconciler(mgr manager.Manager, cfg *Config) *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) AutoscalerDeployment

func (r *Reconciler) AutoscalerDeployment(ca *autoscalingv1alpha1.ClusterAutoscaler) *appsv1.Deployment

AutoscalerDeployment returns the expected deployment belonging to the given ClusterAutoscaler.

func (*Reconciler) AutoscalerName

AutoscalerName returns the expected NamespacedName for the deployment belonging to the given ClusterAutoscaler.

func (*Reconciler) AutoscalerPodSpec

func (r *Reconciler) AutoscalerPodSpec(ca *autoscalingv1alpha1.ClusterAutoscaler) *corev1.PodSpec

AutoscalerPodSpec returns the expected podSpec for the deployment belonging to the given ClusterAutoscaler.

func (*Reconciler) CreateAutoscaler

func (r *Reconciler) CreateAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) error

CreateAutoscaler will create the deployment for the given the ClusterAutoscaler custom resource instance.

func (*Reconciler) GetAutoscaler

GetAutoscaler will return the deployment for the given ClusterAutoscaler custom resource instance.

func (*Reconciler) NamePredicate

func (r *Reconciler) NamePredicate(meta metav1.Object) bool

NamePredicate is used in predicate functions. It returns true if the object's name matches the configured name of the singleton ClusterAutoscaler resource.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile reads that state of the cluster for a ClusterAutoscaler object and makes changes based on the state read and what is in the ClusterAutoscaler.Spec

func (*Reconciler) SetConfig

func (r *Reconciler) SetConfig(cfg *Config)

SetConfig sets the given config on the reconciler.

func (*Reconciler) UpdateAutoscaler

func (r *Reconciler) UpdateAutoscaler(ca *autoscalingv1alpha1.ClusterAutoscaler) error

UpdateAutoscaler will retrieve the deployment for the given ClusterAutoscaler custom resource instance and update it to match the expected spec if needed.

Jump to

Keyboard shortcuts

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