config

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config holds the typed objects that define the schemas for ConfigMap objects that pertain to our API objects.

Index

Constants

View Source
const (
	// DefaultsConfigName is the name of config map for the defaults.
	DefaultsConfigName = "config-defaults"

	// DefaultRevisionTimeoutSeconds will be set if timeoutSeconds not specified.
	DefaultRevisionTimeoutSeconds = 5 * 60

	// DefaultMaxRevisionTimeoutSeconds will be set if MaxRevisionTimeoutSeconds is not specified.
	DefaultMaxRevisionTimeoutSeconds = 10 * 60

	// DefaultUserContainerName is the default name we give to the container
	// specified by the user, if `name:` is omitted.
	DefaultUserContainerName = "user-container"

	// DefaultContainerConcurrency is the default container concurrency. It will be set if ContainerConcurrency is not specified.
	DefaultContainerConcurrency int64 = 0

	// DefaultMaxRevisionContainerConcurrency is the maximum configurable
	// container concurrency.
	DefaultMaxRevisionContainerConcurrency int64 = 1000
)

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, c *Config) context.Context

ToContext attaches the provided Config to the provided context, returning the new context with the Config attached.

Types

type Config

type Config struct {
	Defaults *Defaults
}

Config holds the collection of configurations that we attach to contexts. +k8s:deepcopy-gen=false

func FromContext

func FromContext(ctx context.Context) *Config

FromContext extracts a Config from the provided context.

func FromContextOrDefaults

func FromContextOrDefaults(ctx context.Context) *Config

FromContextOrDefaults is like FromContext, but when no Config is attached it returns a Config populated with the defaults for each of the Config fields.

type Defaults

type Defaults struct {
	RevisionTimeoutSeconds int64
	// This is the timeout set for cluster ingress.
	// RevisionTimeoutSeconds must be less than this value.
	MaxRevisionTimeoutSeconds int64

	UserContainerNameTemplate string

	ContainerConcurrency int64

	RevisionCPURequest    *resource.Quantity
	RevisionCPULimit      *resource.Quantity
	RevisionMemoryRequest *resource.Quantity
	RevisionMemoryLimit   *resource.Quantity
}

Defaults includes the default values to be populated by the webhook.

func NewDefaultsConfigFromConfigMap

func NewDefaultsConfigFromConfigMap(config *corev1.ConfigMap) (*Defaults, error)

NewDefaultsConfigFromConfigMap creates a Defaults from the supplied configMap

func NewDefaultsConfigFromMap

func NewDefaultsConfigFromMap(data map[string]string) (*Defaults, error)

NewDefaultsConfigFromMap creates a Defaults from the supplied Map

func (*Defaults) DeepCopy

func (in *Defaults) DeepCopy() *Defaults

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Defaults.

func (*Defaults) DeepCopyInto

func (in *Defaults) DeepCopyInto(out *Defaults)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Defaults) UserContainerName added in v0.7.0

func (d *Defaults) UserContainerName(ctx context.Context) string

UserContainerName returns the name of the user container based on the context.

type Store

type Store struct {
	*configmap.UntypedStore
}

Store is a typed wrapper around configmap.Untyped store to handle our configmaps. +k8s:deepcopy-gen=false

func NewStore

func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store

NewStore creates a new store of Configs and optionally calls functions when ConfigMaps are updated.

func (*Store) Load

func (s *Store) Load() *Config

Load creates a Config from the current config state of the Store.

func (*Store) ToContext

func (s *Store) ToContext(ctx context.Context) context.Context

ToContext attaches the current Config state to the provided context.

Jump to

Keyboard shortcuts

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