engine

package
v0.0.0-...-f5dd9be Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LabelPrefix = "wp.autoscaler/"
	LabelPool   = fmt.Sprintf("%spool", LabelPrefix)
	LabelImage  = fmt.Sprintf("%simage", LabelPrefix)
	// editorconfig-checker-disable
	CloudInitUserDataUbuntuDefault = `` /* 978-byte string literal not displayed */

)

Functions

func MergeMaps

func MergeMaps(m1, m2 map[string]string) map[string]string

MergeMaps merges two string maps m1 and m2 into a new map. It copies all key-value pairs from m1 into the result. It then copies all key-value pairs from m2 into the result, overwriting any keys that are present in both m1 and m2. The merged map is returned.

func RandomString

func RandomString(n int) string

RandomString generates a random string of length n using alphanumeric characters.

func RenderUserDataTemplate

func RenderUserDataTemplate(config *config.Config, agent *woodpecker.Agent, tmpl *template.Template) (string, error)

RenderUserDataTemplate renders the user data template for an Agent using the provided configuration.

func SliceToMap

func SliceToMap(list []string, del string) (map[string]string, error)

SliceToMap converts a slice of strings in the format "key=value" into a string map, using the provided delimiter to split the pieces. Returns a map and nil error on success, or nil and an error if a slice element does not contain the delimiter.

Types

type Autoscaler

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

func NewAutoscaler

func NewAutoscaler(provider Provider, client server.Client, config *config.Config) Autoscaler

NewAutoscaler creates a new Autoscaler instance. It takes in a Provider, Client and Config, and returns a configured Autoscaler struct.

func (*Autoscaler) Reconcile

func (a *Autoscaler) Reconcile(ctx context.Context) error

Reconcile periodically checks the status of the agent pool and adjusts it to match the desired capacity based on the current queue state.

type Provider

type Provider interface {
	DeployAgent(context.Context, *woodpecker.Agent) error
	RemoveAgent(context.Context, *woodpecker.Agent) error
	ListDeployedAgentNames(context.Context) ([]string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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