provisioning

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxBatchDuration = time.Second * 10
	MinBatchDuration = time.Second * 1
	// MaxPodsPerBatch limits the number of pods we process at one time to avoid using too much memory
	MaxPodsPerBatch = 2_000
)

Functions

This section is empty.

Types

type Controller

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

Controller for the resource

func NewController

func NewController(ctx context.Context, kubeClient client.Client, coreV1Client corev1.CoreV1Interface, cloudProvider cloudprovider.CloudProvider) *Controller

NewController is a constructor

func (*Controller) Apply

func (c *Controller) Apply(ctx context.Context, provisioner *v1alpha5.Provisioner) error

Apply creates or updates the provisioner to the latest configuration

func (*Controller) Delete

func (c *Controller) Delete(ctx context.Context, name string)

Delete stops and removes a provisioner. Enqueued pods will be provisioned.

func (*Controller) List

func (c *Controller) List(ctx context.Context) []*Provisioner

List active provisioners in order of priority

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

Reconcile a control loop for the resource

func (*Controller) Register

func (c *Controller) Register(_ context.Context, m manager.Manager) error

Register the controller to the manager

type Launcher

type Launcher struct {
	Packer        *binpacking.Packer
	KubeClient    client.Client
	CoreV1Client  corev1.CoreV1Interface
	CloudProvider cloudprovider.CloudProvider
}

func (*Launcher) Launch

func (l *Launcher) Launch(ctx context.Context, provisioner *v1alpha5.Provisioner, schedules []*scheduling.Schedule,
	instanceTypes []cloudprovider.InstanceType) error

type Provisioner

type Provisioner struct {
	// State
	*v1alpha5.Provisioner

	Stop context.CancelFunc
	// contains filtered or unexported fields
}

Provisioner waits for enqueued pods, batches them, creates capacity and binds the pods to the capacity.

func (*Provisioner) Add

func (p *Provisioner) Add(ctx context.Context, pod *v1.Pod) (err error)

Add a pod to the provisioner and block until it's processed. The caller is responsible for verifying that the pod was scheduled correctly. In the future, this may be expanded to include concepts such as retriable errors.

func (*Provisioner) Batch

func (p *Provisioner) Batch(ctx context.Context) (pods []*v1.Pod)

Batch returns a slice of enqueued pods after idle or timeout

func (*Provisioner) FilterProvisionable

func (p *Provisioner) FilterProvisionable(ctx context.Context, pods []*v1.Pod) []*v1.Pod

FilterProvisionable removes pods that have been assigned a node. This check is needed to prevent duplicate binds when a pod is scheduled to a node between the time it was ingested into the scheduler and the time it is included in a provisioner batch.

func (*Provisioner) Start

func (p *Provisioner) Start(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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