worker

package
v0.0.0-...-d68cec5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: Apache-2.0, MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FinalizerName is the worker controller finalizer.
	FinalizerName = "extensions.gardener.cloud/worker"
	// ControllerName is the name of the controller.
	ControllerName = "worker_controller"
)
View Source
const (
	// DeployCRDsFlag is the name of the command line flag to specify whether the worker CRDs
	// should be deployed or not.
	DeployCRDsFlag = "deploy-crds"
)

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager, args AddArgs) error

Add creates a new Worker Controller and adds it to the Manager. and Start it when the Manager is Started.

func ApplyMachineResources

func ApplyMachineResources(ctx context.Context, c client.Client) error

ApplyMachineResources ensures that all well-known machine CRDs are created or updated. TODO: Use github.com/gardener/gardener/pkg/utils/flow.Parallel as soon as we can vendor a new Gardener version again.

func ApplyMachineResourcesForConfig

func ApplyMachineResourcesForConfig(ctx context.Context, config *rest.Config) error

ApplyMachineResourcesForConfig ensures that all well-known machine CRDs are created or updated.

func ClusterToWorkerMapper

func ClusterToWorkerMapper(predicates []predicate.Predicate) handler.Mapper

ClusterToWorkerMapper returns a mapper that returns requests for Worker whose referenced clusters have been modified.

func DefaultPredicates

func DefaultPredicates(typeName string, ignoreOperationAnnotation bool) []predicate.Predicate

DefaultPredicates returns the default predicates for a Worker reconciler.

func DiskSize

func DiskSize(size string) (int, error)

DiskSize extracts the numerical component of DiskSize strings, i.e. strings like "10Gi" and returns it as string, i.e. "10" will be returned.

func DistributeOverZones

func DistributeOverZones(zoneIndex, size, zoneSize int) int

DistributeOverZones is a function which is used to determine how many nodes should be used for each availability zone. It takes the number of availability zones (<zoneSize>), the index of the current zone (<zoneIndex>) and the number of nodes which must be distributed over the zones (<size>) and returns the number of nodes which should be placed in the zone of index <zoneIndex>. The distribution happens equally. In case of an uneven number <size>, the last zone will have one more node than the others.

func DistributePercentOverZones

func DistributePercentOverZones(zoneIndex int, percent string, zoneSize, total int) string

DistributePercentOverZones distributes a given percentage value over zones in relation to the given total value. In case the total value is evenly divisible over the zones, this always just returns the initial percentage. Otherwise, the total value is used to determine the weight of a specific zone in relation to the other zones and adapt the given percentage accordingly.

func DistributePositiveIntOrPercent

func DistributePositiveIntOrPercent(zoneIndex int, intOrPercent intstr.IntOrString, zoneSize int, total int) intstr.IntOrString

DistributePositiveIntOrPercent distributes a given int or percentage value over zones in relation to the given total value. In case the total value is evenly divisible over the zones, this always just returns the initial percentage. Otherwise, the total value is used to determine the weight of a specific zone in relation to the other zones and adapt the given percentage accordingly.

func MachineClassHash

func MachineClassHash(machineClassSpec map[string]interface{}, version string) string

MachineClassHash returns the SHA256-hash value of the <val> struct's representation concatenated with the provided <version>.

func NewReconciler

func NewReconciler(mgr manager.Manager, actuator Actuator) reconcile.Reconciler

NewReconciler creates a new reconcile.Reconciler that reconciles Worker resources of Gardener's `extensions.gardener.cloud` API group.

Types

type Actuator

type Actuator interface {
	// Reconcile reconciles the Worker.
	Reconcile(context.Context, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
	// Delete deletes the Worker.
	Delete(context.Context, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
}

Actuator acts upon Worker resources.

type AddArgs

type AddArgs struct {
	// Actuator is an worker actuator.
	Actuator Actuator
	// ControllerOptions are the controller options used for creating a controller.
	// The options.Reconciler is always overridden with a reconciler created from the
	// given actuator.
	ControllerOptions controller.Options
	// Predicates are the predicates to use.
	// If unset, GenerationChanged will be used.
	Predicates []predicate.Predicate
}

AddArgs are arguments for adding an worker controller to a manager.

type Config

type Config struct {
	// DeployCRDs defines whether to ignore the operation annotation or not.
	DeployCRDs bool
}

Config is a completed controller configuration.

func (*Config) Apply

func (c *Config) Apply(ignore *bool)

Apply sets the values of this Config in the given controller.Options.

type MachineDeployment

type MachineDeployment struct {
	Name           string
	ClassName      string
	SecretName     string
	Minimum        int
	Maximum        int
	MaxSurge       intstr.IntOrString
	MaxUnavailable intstr.IntOrString
	Labels         map[string]string
	Annotations    map[string]string
	Taints         []corev1.Taint
}

MachineDeployment holds information about the name, class, replicas of a MachineDeployment managed by the machine-controller-manager.

type MachineDeployments

type MachineDeployments []MachineDeployment

MachineDeployments is a list of machine deployments.

func (MachineDeployments) HasClass

func (m MachineDeployments) HasClass(className string) bool

HasClass checks whether the <className> is part of the <machineDeployments> list, i.e. whether there is an entry whose 'ClassName' attribute matches <name>. It returns true or false.

func (MachineDeployments) HasDeployment

func (m MachineDeployments) HasDeployment(name string) bool

HasDeployment checks whether the <name> is part of the <machineDeployments> list, i.e. whether there is an entry whose 'Name' attribute matches <name>. It returns true or false.

func (MachineDeployments) HasSecret

func (m MachineDeployments) HasSecret(secretName string) bool

HasSecret checks whether the <secretName> is part of the <machineDeployments> list, i.e. whether there is an entry whose 'SecretName' attribute matches <name>. It returns true or false.

type Options

type Options struct {
	// DeployCRDs defines whether to ignore the operation annotation or not.
	DeployCRDs bool
	// contains filtered or unexported fields
}

Options are command line options that can be set for controller.Options.

func (*Options) AddFlags

func (c *Options) AddFlags(fs *pflag.FlagSet)

AddFlags implements Flagger.AddFlags.

func (*Options) Complete

func (c *Options) Complete() error

Complete implements Completer.Complete.

func (*Options) Completed

func (c *Options) Completed() *Config

Completed returns the completed Config. Only call this if `Complete` was successful.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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