provisioning

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: Apache-2.0 Imports: 29 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(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 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 NewProvisioner added in v0.5.2

func NewProvisioner(ctx context.Context, provisioner *v1alpha5.Provisioner, kubeClient client.Client, coreV1Client corev1.CoreV1Interface, cloudProvider cloudprovider.CloudProvider) *Provisioner

func (*Provisioner) Add

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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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