platformconfig

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 22 Imported by: 2 modules, 1 package

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

Index

Constants

View Source
const (
	DefaultFunctionReadinessTimeoutSeconds  = 120
	DefaultFunctionInvocationTimeoutSeconds = 60
)
View Source
const (
	DefaultStreamMonitoringWebapiURL = "http://v3io-webapi:8081"
	DefaultV3ioRequestConcurrency    = 64
	DefaultHTTPIngressClassName      = "nginx"
)

Variables

This section is empty.

Functions

func AutoScaleMetricsModeIsValid

func AutoScaleMetricsModeIsValid(autoScaleMode AutoScaleMetricsMode) bool

Types

type AutoScale

type AutoScale struct {
	MetricName  string `json:"metricName,omitempty"`
	TargetValue string `json:"targetValue,omitempty"`
}

type AutoScaleMetricsMode

type AutoScaleMetricsMode string
const (

	// AutoScaleMetricsModeLegacy is the legacy mode, where CPU usage is used for scaling
	AutoScaleMetricsModeLegacy AutoScaleMetricsMode = "legacy"

	// AutoScaleMetricsModeCustom uses custom metrics for scaling
	AutoScaleMetricsModeCustom AutoScaleMetricsMode = "custom"
)

type Config

type Config struct {
	Kind                      string                           `json:"kind,omitempty"`
	WebAdmin                  WebServer                        `json:"webAdmin,omitempty"`
	HealthCheck               WebServer                        `json:"healthCheck,omitempty"`
	Logger                    Logger                           `json:"logger,omitempty"`
	Metrics                   Metrics                          `json:"metrics,omitempty"`
	ScaleToZero               ScaleToZero                      `json:"scaleToZero,omitempty"`
	AutoScale                 AutoScale                        `json:"autoScale,omitempty"`
	SupportedAutoScaleMetrics []functionconfig.AutoScaleMetric `json:"supportedAutoScaleMetrics,omitempty"`
	AutoScaleMetricsMode      AutoScaleMetricsMode             `json:"autoScaleMetricsMode,omitempty"`
	CronTriggerCreationMode   CronTriggerCreationMode          `json:"cronTriggerCreationMode,omitempty"`
	FunctionAugmentedConfigs  []LabelSelectorAndConfig         `json:"functionAugmentedConfigs,omitempty"`
	FunctionReadinessTimeout  *string                          `json:"functionReadinessTimeout,omitempty"`
	FunctionInvocationTimeout *string                          `json:"functionInvocationTimeout,omitempty"`
	IngressConfig             IngressConfig                    `json:"ingressConfig,omitempty"`
	Kube                      PlatformKubeConfig               `json:"kube,omitempty"`
	Local                     PlatformLocalConfig              `json:"local,omitempty"`
	ImageRegistryOverrides    ImageRegistryOverridesConfig     `json:"imageRegistryOverrides,omitempty"`
	Runtime                   *runtimeconfig.Config            `json:"runtime,omitempty"`
	ProjectsLeader            *ProjectsLeader                  `json:"projectsLeader,omitempty"`
	ManagedNamespaces         []string                         `json:"managedNamespaces,omitempty"`
	IguazioSessionCookie      string                           `json:"iguazioSessionCookie,omitempty"`
	Opa                       opa.Config                       `json:"opa,omitempty"`
	StreamMonitoring          StreamMonitoringConfig           `json:"streamMonitoring,omitempty"`
	SensitiveFields           SensitiveFieldsConfig            `json:"sensitiveFields,omitempty"`
	DisableDefaultHTTPTrigger bool                             `json:"disableDefaultHTTPTrigger,omitempty"`

	ContainerBuilderConfiguration *containerimagebuilderpusher.ContainerBuilderConfiguration `json:"containerBuilderConfiguration,omitempty"`
	// contains filtered or unexported fields
}

func NewPlatformConfig

func NewPlatformConfig(configurationPath string) (*Config, error)

func (*Config) DisableSensitiveFieldMasking

func (c *Config) DisableSensitiveFieldMasking()

func (*Config) EnableSensitiveFieldMasking

func (c *Config) EnableSensitiveFieldMasking()

func (*Config) EnrichFunctionContainerResources

func (c *Config) EnrichFunctionContainerResources(ctx context.Context,
	logger logger.Logger,
	resources *v1.ResourceRequirements)

EnrichFunctionContainerResources enriches the function container's requests and limits with the default resources defined in the platform config, only if they are not already configured

func (*Config) EnrichSupplementaryContainerResources

func (c *Config) EnrichSupplementaryContainerResources(ctx context.Context,
	logger logger.Logger,
	resources *v1.ResourceRequirements)

EnrichSupplementaryContainerResources enriches the sidecar/init container's requests and limits with the default resources defined in the platform config, only if they are not already configured

func (*Config) GetDefaultFunctionInvocationTimeout

func (c *Config) GetDefaultFunctionInvocationTimeout() time.Duration

func (*Config) GetDefaultFunctionReadinessTimeout

func (c *Config) GetDefaultFunctionReadinessTimeout() time.Duration

func (*Config) GetDefaultSupportedAutoScaleMetrics

func (c *Config) GetDefaultSupportedAutoScaleMetrics() []functionconfig.AutoScaleMetric

func (*Config) GetDefaultWindowSizePresets

func (c *Config) GetDefaultWindowSizePresets() []string

func (*Config) GetFunctionLoggerSinks

func (c *Config) GetFunctionLoggerSinks(functionConfig *functionconfig.Config) (map[string]LoggerSinkWithLevel, error)

func (*Config) GetFunctionMetricSinks

func (c *Config) GetFunctionMetricSinks() (map[string]MetricSink, error)

func (*Config) GetFunctionReadinessTimeoutOrDefault

func (c *Config) GetFunctionReadinessTimeoutOrDefault(functionReadinessTimeoutSeconds int) int

func (*Config) GetSystemLoggerSinks

func (c *Config) GetSystemLoggerSinks() (map[string]LoggerSinkWithLevel, error)

func (*Config) GetSystemMetricSinks

func (c *Config) GetSystemMetricSinks() (map[string]MetricSink, error)

type CronTriggerCreationMode

type CronTriggerCreationMode string
const (
	ProcessorCronTriggerCreationMode CronTriggerCreationMode = "processor"
	KubeCronTriggerCreationMode      CronTriggerCreationMode = "kube"

	DefaultServiceType = corev1.ServiceTypeClusterIP
)

type ImageRegistryOverridesConfig

type ImageRegistryOverridesConfig struct {

	// maps are [runtime -> registry]
	BaseImageRegistries    map[string]string `json:"baseImageRegistries,omitempty"`
	OnbuildImageRegistries map[string]string `json:"onbuildImageRegistries,omitempty"`
}

type IngressConfig

type IngressConfig struct {
	EnableSSLRedirect          bool     `json:"enableSSLRedirect,omitempty"`
	TLSSecret                  string   `json:"tlsSecret,omitempty"`
	IguazioAuthURL             string   `json:"iguazioAuthURL,omitempty"`
	IguazioSignInURL           string   `json:"iguazioSignInURL,omitempty"`
	AllowedAuthenticationModes []string `json:"allowedAuthenticationModes,omitempty"`
	Oauth2ProxyURL             string   `json:"oauth2ProxyURL,omitempty"`
}

IngressConfig holds the default values for created ingresses

type Kubernetes

type Kubernetes struct {
	Deployment *appsv1.Deployment `json:"deployment,omitempty"`
}

type LabelSelectorAndConfig

type LabelSelectorAndConfig struct {
	LabelSelector  machinarymetav1.LabelSelector `json:"labelSelector,omitempty"`
	FunctionConfig functionconfig.Config         `json:"functionConfig,omitempty"`
	Kubernetes     Kubernetes                    `json:"kubernetes,omitempty"`
}

type Logger

type Logger struct {
	Sinks     map[string]LoggerSink `json:"sinks,omitempty"`
	System    []LoggerSinkBinding   `json:"system,omitempty"`
	Functions []LoggerSinkBinding   `json:"functions,omitempty"`
}

type LoggerSink

type LoggerSink struct {
	Kind       LoggerSinkKind         `json:"kind,omitempty"`
	URL        string                 `json:"url,omitempty"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

type LoggerSinkBinding

type LoggerSinkBinding struct {
	Level string `json:"level,omitempty"`
	Sink  string `json:"sink,omitempty"`
}

type LoggerSinkKind

type LoggerSinkKind string
const (
	LoggerSinkKindStdout      LoggerSinkKind = "stdout"
	LoggerSinkKindAppInsights LoggerSinkKind = "appinsights"

	// LoggerSinkKindElasticsearch is not supported
	LoggerSinkKindElasticsearch LoggerSinkKind = "elasticsearch"
)

type LoggerSinkWithLevel

type LoggerSinkWithLevel struct {
	Level string
	Sink  LoggerSink
	// contains filtered or unexported fields
}

func (*LoggerSinkWithLevel) GetRedactingLogger

func (l *LoggerSinkWithLevel) GetRedactingLogger() *nucliozap.Redactor

type MetricSink

type MetricSink struct {
	Enabled    *bool                  `json:"enabled,omitempty"`
	Kind       string                 `json:"kind,omitempty"`
	URL        string                 `json:"url,omitempty"`
	Attributes map[string]interface{} `json:"attributes,omitempty"`
}

type Metrics

type Metrics struct {
	Sinks     map[string]MetricSink `json:"sinks,omitempty"`
	System    []string              `json:"system,omitempty"`
	Functions []string              `json:"functions,omitempty"`
}

type PlatformKubeConfig

type PlatformKubeConfig struct {
	KubeConfigPath string `json:"kubeConfigPath,omitempty"`

	// TODO: Move IngressConfig here
	DefaultServiceType               corev1.ServiceType      `json:"defaultServiceType,omitempty"`
	DefaultFunctionNodeSelector      map[string]string       `json:"defaultFunctionNodeSelector,omitempty"`
	DefaultHTTPIngressHostTemplate   string                  `json:"defaultHTTPIngressHostTemplate,omitempty"`
	DefaultHTTPIngressAnnotations    map[string]string       `json:"defaultHTTPIngressAnnotations,omitempty"`
	DefaultHTTPIngressClassName      string                  `json:"defaultHTTPIngressClassName,omitempty"`
	DefaultFunctionPriorityClassName string                  `json:"defaultFunctionPriorityClassName,omitempty"`
	DefaultFunctionServiceAccount    string                  `json:"defaultFunctionServiceAccount,omitempty"`
	ValidFunctionPriorityClassNames  []string                `json:"validFunctionPriorityClassNames,omitempty"`
	DefaultFunctionPodResources      PodResourceRequirements `json:"defaultFunctionPodResources,omitempty"`
	DefaultSidecarResources          PodResourceRequirements `json:"defaultSidecarResources,omitempty"`
	DefaultFunctionTolerations       []corev1.Toleration     `json:"defaultFunctionTolerations,omitempty"`
	PreemptibleNodes                 *PreemptibleNodes       `json:"preemptibleNodes,omitempty"`
}

type PlatformLocalConfig

type PlatformLocalConfig struct {
	FunctionContainersHealthinessEnabled  bool                        `json:"functionContainersHealthinessEnabled"`
	FunctionContainersHealthinessTimeout  time.Duration               `json:"functionContainersHealthinessTimeout,omitempty"`
	FunctionContainersHealthinessInterval time.Duration               `json:"functionContainersHealthinessInterval,omitempty"`
	DefaultFunctionContainerNetworkName   string                      `json:"defaultFunctionContainerNetworkName,omitempty"`
	DefaultFunctionRestartPolicy          *dockerclient.RestartPolicy `json:"defaultFunctionRestartPolicy,omitempty"`
	DefaultFunctionVolumes                []functionconfig.Volume     `json:"defaultFunctionVolumes,omitempty"`
}

type PodResourceRequirements

type PodResourceRequirements struct {
	Requests ResourceRequirements `json:"requests,omitempty"`
	Limits   ResourceRequirements `json:"limits,omitempty"`
}

type PreemptibleNodes

type PreemptibleNodes struct {
	DefaultMode    functionconfig.RunOnPreemptibleNodeMode `json:"defaultMode,omitempty"`
	Tolerations    []corev1.Toleration                     `json:"tolerations,omitempty"`
	GPUTolerations []corev1.Toleration                     `json:"gpuTolerations,omitempty"`
	NodeSelector   map[string]string                       `json:"nodeSelector,omitempty"`
}

PreemptibleNodes Holds data needed when user decided to run his function pods on a preemptible node (aka Spot node)

func (*PreemptibleNodes) CompileAffinityByLabelSelector

func (p *PreemptibleNodes) CompileAffinityByLabelSelector(
	operation corev1.NodeSelectorOperator) []corev1.NodeSelectorRequirement

CompileAffinityByLabelSelector compiles affinity spec based on pre-configured node selector

func (*PreemptibleNodes) CompileAffinityByLabelSelectorScheduleOnOneOfMatchingNodes

func (p *PreemptibleNodes) CompileAffinityByLabelSelectorScheduleOnOneOfMatchingNodes() []corev1.NodeSelectorTerm

CompileAffinityByLabelSelectorScheduleOnOneOfMatchingNodes schedule on a node having at least one of the node selectors (ORed)

func (*PreemptibleNodes) CompileAntiAffinityByLabelSelectorNoScheduleOnMatchingNodes

func (p *PreemptibleNodes) CompileAntiAffinityByLabelSelectorNoScheduleOnMatchingNodes() []corev1.NodeSelectorTerm

type ProjectsLeader

type ProjectsLeader struct {
	Kind                    ProjectsLeaderKind `json:"kind,omitempty"`
	APIAddress              string             `json:"apiAddress,omitempty"`
	SynchronizationInterval string             `json:"synchronizationInterval,omitempty"`
}

type ProjectsLeaderKind

type ProjectsLeaderKind string
const (
	ProjectsLeaderKindIguazio ProjectsLeaderKind = "iguazio"
	ProjectsLeaderKindMlrun   ProjectsLeaderKind = "mlrun"
	ProjectsLeaderKindMock    ProjectsLeaderKind = "mock"
)

type Reader

type Reader struct{}

func NewReader

func NewReader() (*Reader, error)

func (*Reader) GetDefaultConfiguration

func (r *Reader) GetDefaultConfiguration() *Config

func (*Reader) Read

func (r *Reader) Read(reader io.Reader, configType string, config *Config) error

func (*Reader) ReadFileOrDefault

func (r *Reader) ReadFileOrDefault(configurationPath string) (*Config, error)

type ResourceRequirements

type ResourceRequirements struct {
	CPU    string `json:"cpu,omitempty"`
	Memory string `json:"memory,omitempty"`
}

type ScaleToZero

type ScaleToZero struct {
	Mode                     ScaleToZeroMode                `json:"mode,omitempty"`
	ScalerInterval           string                         `json:"scalerInterval,omitempty"`
	ResourceReadinessTimeout string                         `json:"resourceReadinessTimeout,omitempty"`
	ScaleResources           []functionconfig.ScaleResource `json:"scaleResources,omitempty"`
	InactivityWindowPresets  []string                       `json:"inactivityWindowPresets,omitempty"`

	// Used to enrich special scale-to-zero ingress annotations
	HTTPTriggerIngressAnnotations map[string]string `json:"httpTriggerIngressAnnotations,omitempty"`

	// Used for DLX options, selects in which way to send invocation when multiple targets are given:
	// random, primary or canary.
	MultiTargetStrategy scalertypes.MultiTargetStrategy `json:"multiTargetStrategy,omitempty"`
}

type ScaleToZeroMode

type ScaleToZeroMode string
const (
	EnabledScaleToZeroMode  ScaleToZeroMode = "enabled"
	DisabledScaleToZeroMode ScaleToZeroMode = "disabled"
)

type SensitiveFieldPath

type SensitiveFieldPath string

type SensitiveFieldsConfig

type SensitiveFieldsConfig struct {

	// CustomSensitiveFields is a list of fields that should be masked in logs and function config
	MaskSensitiveFields   bool             `json:"maskSensitiveFields,omitempty"`
	CustomSensitiveFields []string         `json:"customSensitiveFields,omitempty"`
	SensitiveFieldsRegex  []*regexp.Regexp `json:"sensitiveFieldsRegex,omitempty"`
}

func (*SensitiveFieldsConfig) CompileSensitiveFieldsRegex

func (sfc *SensitiveFieldsConfig) CompileSensitiveFieldsRegex() []*regexp.Regexp

func (*SensitiveFieldsConfig) GetDefaultSensitiveFields

func (sfc *SensitiveFieldsConfig) GetDefaultSensitiveFields() []string

func (*SensitiveFieldsConfig) GetSensitiveFields

func (sfc *SensitiveFieldsConfig) GetSensitiveFields() []string

type StreamMonitoringConfig

type StreamMonitoringConfig struct {
	WebapiURL              string `json:"webapiURL,omitempty"`
	V3ioRequestConcurrency uint   `json:"v3ioRequestConcurrency,omitempty"`
}

type WebServer

type WebServer struct {
	Enabled       *bool  `json:"enabled,omitempty"`
	ListenAddress string `json:"listenAddress,omitempty"`
}

Jump to

Keyboard shortcuts

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