serverless

package
v0.0.0-...-696ba86 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Progressing:
	// NewRSAvailableReason is added in a deployment when its newest replica set is made available
	// ie. the number of new pods that have passed readiness checks and run for at least minReadySeconds
	// is at least the minimum available pods that need to run for the deployment.
	NewRSAvailableReason = "NewReplicaSetAvailable"

	// Available:
	// MinimumReplicasAvailable is added in a deployment when it has its minimum replicas required available.
	MinimumReplicasAvailable   = "MinimumReplicasAvailable"
	MinimumReplicasUnavailable = "MinimumReplicasUnavailable"
)
View Source
const (
	FunctionSourceKey = "source"
	FunctionDepsKey   = "dependencies"
)
View Source
const DefaultDeploymentReplicas int32 = 1
View Source
const HealthEvent = "" /* 324-byte string literal not displayed */

This const should be longer than 253 characters to avoid collisions with real k8s objects. https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names This event is artificial and it's only used to check if reconciliation loop didn't stop reconciling The event is not fully validated, that's why we can use invalid name.

Variables

View Source
var (
	// ErrBuildReconcilerFailed is returned if it is impossible to create reconciler build function
	ErrBuildReconcilerFailed = errors.New("build reconciler failed")
)

Functions

func IsHealthCheckRequest

func IsHealthCheckRequest(req ctrl.Request) bool

func IsNotFunctionStatusUpdate

func IsNotFunctionStatusUpdate(log *zap.SugaredLogger) func(event.UpdateEvent) bool

func NextRequeue

func NextRequeue(err error) (res ctrl.Result, errMsg string)

Types

type BuildConfig

type BuildConfig struct {
	ExecutorArgs        []string `envconfig:"default=--insecure;--skip-tls-verify;--skip-unused-stages;--log-format=text;--cache=true"`
	ExecutorImage       string   `envconfig:"default=gcr.io/kaniko-project/executor:v0.22.0"`
	RepoFetcherImage    string   `envconfig:"default=europe-docker.pkg.dev/kyma-project/prod/function-build-init:v20230426-37b02524"`
	MaxSimultaneousJobs int      `envconfig:"default=5"`
}

type BuildJobResourceConfig

type BuildJobResourceConfig struct {
	Resources Resources `yaml:"resources"`
}

type DockerConfig

type DockerConfig struct {
	ActiveRegistryConfigSecretName string
	PushAddress                    string
	PullAddress                    string
}

type FunctionConfig

type FunctionConfig struct {
	PublisherProxyAddress                       string         `envconfig:"optional"`
	TraceCollectorEndpoint                      string         `envconfig:"optional"`
	ImageRegistryDefaultDockerConfigSecretName  string         `envconfig:"default=serverless-registry-config-default"`
	ImageRegistryExternalDockerConfigSecretName string         `envconfig:"default=serverless-registry-config"`
	PackageRegistryConfigSecretName             string         `envconfig:"default=serverless-package-registry-config"`
	ImagePullAccountName                        string         `envconfig:"default=serverless-function"`
	TargetCPUUtilizationPercentage              int32          `envconfig:"default=50"`
	RequeueDuration                             time.Duration  `envconfig:"default=1m"`
	FunctionReadyRequeueDuration                time.Duration  `envconfig:"default=5m"`
	GitFetchRequeueDuration                     time.Duration  `envconfig:"default=30s"`
	ResourceConfig                              ResourceConfig `envconfig:"optional"`
	Build                                       BuildConfig
}

type FunctionReconciler

type FunctionReconciler struct {
	Log *zap.SugaredLogger
	// contains filtered or unexported fields
}

func NewFunctionReconciler

func NewFunctionReconciler(client resource.Client, log *zap.SugaredLogger, config FunctionConfig, gitFactory GitClientFactory, recorder record.EventRecorder, statsCollector StatsCollector, healthCh chan bool) *FunctionReconciler

func (*FunctionReconciler) Reconcile

func (r *FunctionReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error)

func (*FunctionReconciler) SetupWithManager

func (r *FunctionReconciler) SetupWithManager(mgr ctrl.Manager) (controller.Controller, error)

type FunctionResourceConfig

type FunctionResourceConfig struct {
	Resources Resources `yaml:"resources"`
}

type GitClient

type GitClient interface {
	LastCommit(options git.Options) (string, error)
	Clone(path string, options git.Options) (string, error)
}

type GitClientFactory

type GitClientFactory interface {
	GetGitClient(logger *zap.SugaredLogger) git.GitClient
}

type HealthChecker

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

func NewHealthChecker

func NewHealthChecker(timeout time.Duration, logger *zap.SugaredLogger) (HealthChecker, chan event.GenericEvent, chan bool)

func (HealthChecker) Checker

func (h HealthChecker) Checker(req *http.Request) error

type Preset

type Preset map[string]Resource

func (Preset) ToResourceRequirements

func (p Preset) ToResourceRequirements() map[string]v1.ResourceRequirements

type Quantity

type Quantity struct {
	resource.Quantity
}

func (*Quantity) UnmarshalYAML

func (q *Quantity) UnmarshalYAML(unmarshal func(interface{}) error) error

type Resource

type Resource struct {
	RequestCPU    Quantity `yaml:"requestCpu"`
	RequestMemory Quantity `yaml:"requestMemory"`
	LimitCPU      Quantity `yaml:"limitCpu"`
	LimitMemory   Quantity `yaml:"limitMemory"`
}

type ResourceConfig

type ResourceConfig struct {
	Function FunctionResourceConfig `yaml:"function"`
	BuildJob BuildJobResourceConfig `yaml:"buildJob"`
}

func (*ResourceConfig) Unmarshal

func (rc *ResourceConfig) Unmarshal(input string) error

type Resources

type Resources struct {
	Presets            Preset         `yaml:"presets"`
	RuntimePresets     RuntimePresets `yaml:"runtimePresets"`
	DefaultPreset      string         `yaml:"defaultPreset"`
	MinRequestedCPU    Quantity       `yaml:"minRequestedCPU"`
	MinRequestedMemory Quantity       `yaml:"minRequestedMemory"`
}

type RuntimePresets

type RuntimePresets map[string]Preset

type StatsCollector

type StatsCollector interface {
	UpdateReconcileStats(f *serverlessv1alpha2.Function, cond serverlessv1alpha2.Condition)
}

type SystemState

type SystemState interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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