abstract

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: 39 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 (
	FunctionContainerHTTPPort            = 8080
	FunctionContainerWebAdminHTTPPort    = 8081
	FunctionContainerHealthCheckHTTPPort = 8082
	FunctionContainerMetricPort          = 8090
	FunctionContainerHTTPPortName        = "http"
	FunctionContainerMetricPortName      = "metrics"
	DefaultTargetCPU                     = 75
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogStream

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

func NewLogStream

func NewLogStream(name string, level nucliozap.Level, loggers ...logger.Logger) (*LogStream, error)

NewLogStream returns a new log stream

func (*LogStream) GetLogger

func (ls *LogStream) GetLogger() logger.Logger

GetLogger returns the underlying logger

func (*LogStream) GetRedactor

func (ls *LogStream) GetRedactor() *nucliozap.Redactor

func (*LogStream) ReadLogs

func (ls *LogStream) ReadLogs(timeout *time.Duration, logs *[]map[string]interface{})

type Platform

type Platform struct {
	Logger logger.Logger

	Config                  *platformconfig.Config
	ExternalIPAddresses     []string
	DeployLogStreams        *sync.Map
	ContainerBuilder        containerimagebuilderpusher.BuilderPusher
	ImageNamePrefixTemplate string
	DefaultNamespace        string
	OpaClient               opa.Client
	FunctionScrubber        *functionconfig.Scrubber
	// contains filtered or unexported fields
}

func NewPlatform

func NewPlatform(parentLogger logger.Logger,
	platformInstance platform.Platform,
	platformConfiguration *platformconfig.Config,
	defaultNamespace string) (*Platform, error)

func (*Platform) AutoFixConfiguration

func (ap *Platform) AutoFixConfiguration(ctx context.Context, err error, functionConfig *functionconfig.Config) bool

func (*Platform) BuildAndPushContainerImage

func (ap *Platform) BuildAndPushContainerImage(ctx context.Context, buildOptions *containerimagebuilderpusher.BuildOptions) error

BuildAndPushContainerImage builds container image and pushes it into docker registry

func (*Platform) CreateAPIGateway

func (ap *Platform) CreateAPIGateway(ctx context.Context, createAPIGatewayOptions *platform.CreateAPIGatewayOptions) error

CreateAPIGateway creates and deploys a new api gateway

func (*Platform) CreateFunctionBuild

func (ap *Platform) CreateFunctionBuild(ctx context.Context,
	createFunctionBuildOptions *platform.CreateFunctionBuildOptions) (
	*platform.CreateFunctionBuildResult, error)

func (*Platform) CreateFunctionEvent

func (ap *Platform) CreateFunctionEvent(ctx context.Context, createFunctionEventOptions *platform.CreateFunctionEventOptions) error

CreateFunctionEvent will create a new function event that can later be used as a template from which to invoke functions

func (*Platform) CreateFunctionInvocation

func (ap *Platform) CreateFunctionInvocation(ctx context.Context,
	createFunctionInvocationOptions *platform.CreateFunctionInvocationOptions) (
	*platform.CreateFunctionInvocationResult, error)

CreateFunctionInvocation will invoke a previously deployed function

func (*Platform) CreateProject

func (ap *Platform) CreateProject(ctx context.Context, createProjectOptions *platform.CreateProjectOptions) error

CreateProject will probably create a new project

func (*Platform) DeleteAPIGateway

func (ap *Platform) DeleteAPIGateway(ctx context.Context, deleteAPIGatewayOptions *platform.DeleteAPIGatewayOptions) error

DeleteAPIGateway will delete a previously existing api gateway

func (*Platform) DeleteFunctionEvent

func (ap *Platform) DeleteFunctionEvent(ctx context.Context, deleteFunctionEventOptions *platform.DeleteFunctionEventOptions) error

DeleteFunctionEvent will delete a previously existing function event

func (*Platform) DeleteProject

func (ap *Platform) DeleteProject(ctx context.Context, deleteProjectOptions *platform.DeleteProjectOptions) error

DeleteProject will delete a previously existing project

func (*Platform) EnrichCreateProjectConfig

func (ap *Platform) EnrichCreateProjectConfig(createProjectOptions *platform.CreateProjectOptions) error

EnrichCreateProjectConfig enrich project configuration with defaults

func (*Platform) EnrichFunctionConfig

func (ap *Platform) EnrichFunctionConfig(ctx context.Context, functionConfig *functionconfig.Config) error

EnrichFunctionConfig enriches function config

func (*Platform) EnrichFunctionEvent

func (ap *Platform) EnrichFunctionEvent(ctx context.Context, functionEventConfig *platform.FunctionEventConfig) error

func (*Platform) EnrichFunctionsWithDeployLogStream

func (ap *Platform) EnrichFunctionsWithDeployLogStream(functions []platform.Function)

EnrichFunctionsWithDeployLogStream enriches functions status with logs

func (*Platform) EnrichLabels

func (ap *Platform) EnrichLabels(ctx context.Context, labels map[string]string)

EnrichLabels enriches labels with default project name

func (*Platform) EnsureDefaultProjectExistence

func (ap *Platform) EnsureDefaultProjectExistence(ctx context.Context) error

func (*Platform) EnsureProjectRead

func (ap *Platform) EnsureProjectRead(projectName string,
	permissionOptions *opa.PermissionOptions) error

func (*Platform) FilterFunctionEventsByPermissions

func (ap *Platform) FilterFunctionEventsByPermissions(ctx context.Context,
	permissionOptions *opa.PermissionOptions,
	functionEvents []platform.FunctionEvent) ([]platform.FunctionEvent, error)

FilterFunctionEventsByPermissions will filter out some function events

func (*Platform) FilterFunctionsByPermissions

func (ap *Platform) FilterFunctionsByPermissions(ctx context.Context,
	permissionOptions *opa.PermissionOptions,
	functions []platform.Function) ([]platform.Function, error)

FilterFunctionsByPermissions will filter out some functions

func (*Platform) FilterProjectsByPermissions

func (ap *Platform) FilterProjectsByPermissions(ctx context.Context,
	permissionOptions *opa.PermissionOptions,
	projects []platform.Project) ([]platform.Project, error)

FilterProjectsByPermissions will filter out some projects

func (*Platform) GetAPIGateways

func (ap *Platform) GetAPIGateways(ctx context.Context, getAPIGatewaysOptions *platform.GetAPIGatewaysOptions) ([]platform.APIGateway, error)

GetAPIGateways will list existing api gateways

func (*Platform) GetAllowedAuthenticationModes

func (ap *Platform) GetAllowedAuthenticationModes() []string

GetAllowedAuthenticationModes returns allowed authentication modes

func (*Platform) GetBaseImageRegistry

func (ap *Platform) GetBaseImageRegistry(registry string, runtime runtime.Runtime) (string, error)

GetBaseImageRegistry returns base image registry

func (*Platform) GetConfig

func (ap *Platform) GetConfig() *platformconfig.Config

func (*Platform) GetContainerBuilderKind

func (ap *Platform) GetContainerBuilderKind() string

GetContainerBuilderKind returns the container-builder kind

func (*Platform) GetDefaultRegistryCredentialsSecretName

func (ap *Platform) GetDefaultRegistryCredentialsSecretName() string

GetDefaultRegistryCredentialsSecretName returns secret with credentials to push/pull from docker registry

func (*Platform) GetDisableDefaultHttpTrigger

func (ap *Platform) GetDisableDefaultHttpTrigger() bool

func (*Platform) GetExternalIPAddresses

func (ap *Platform) GetExternalIPAddresses() ([]string, error)

GetExternalIPAddresses returns the external IP addresses invocations will use. These addresses are either set through SetExternalIPAddresses or automatically discovered

func (*Platform) GetFunctionEvents

func (ap *Platform) GetFunctionEvents(ctx context.Context, getFunctionEventsOptions *platform.GetFunctionEventsOptions) ([]platform.FunctionEvent, error)

GetFunctionEvents will list existing function events

func (*Platform) GetFunctionProject

func (ap *Platform) GetFunctionProject(ctx context.Context, functionConfig *functionconfig.Config) (platform.Project, error)

func (*Platform) GetHealthCheckMode

func (ap *Platform) GetHealthCheckMode() platform.HealthCheckMode

GetHealthCheckMode returns the healthcheck mode the platform requires

func (*Platform) GetImageNamePrefixTemplate

func (ap *Platform) GetImageNamePrefixTemplate() string

func (*Platform) GetOnbuildImageRegistry

func (ap *Platform) GetOnbuildImageRegistry(registry string, runtime runtime.Runtime) (string, error)

GetOnbuildImageRegistry returns onbuild image registry

func (*Platform) GetOnbuildStages

func (ap *Platform) GetOnbuildStages(onbuildArtifacts []runtime.Artifact) ([]string, error)

GetOnbuildStages get onbuild multistage builds

func (*Platform) GetProcessorLogsAndBriefError

func (ap *Platform) GetProcessorLogsAndBriefError(scanner *bufio.Scanner) (string, string)

func (*Platform) GetProjectResources

func (ap *Platform) GetProjectResources(ctx context.Context,
	projectMeta *platform.ProjectMeta) ([]platform.Function, []platform.APIGateway, error)

func (*Platform) GetProjects

func (ap *Platform) GetProjects(ctx context.Context, getProjectsOptions *platform.GetProjectsOptions) ([]platform.Project, error)

GetProjects will list existing projects

func (*Platform) GetRegistryKind

func (ap *Platform) GetRegistryKind() string

func (*Platform) GetRuntimeBuildArgs

func (ap *Platform) GetRuntimeBuildArgs(runtime runtime.Runtime) map[string]string

GetRuntimeBuildArgs returns the runtime specific build arguments

func (*Platform) GetScaleToZeroConfiguration

func (ap *Platform) GetScaleToZeroConfiguration() *platformconfig.ScaleToZero

GetScaleToZeroConfiguration returns scale to zero configuration

func (*Platform) HandleDeployFunction

func (ap *Platform) HandleDeployFunction(ctx context.Context,
	existingFunctionConfig *functionconfig.ConfigWithStatus,
	createFunctionOptions *platform.CreateFunctionOptions,
	onAfterConfigUpdated func() error,
	onAfterBuild func(*platform.CreateFunctionBuildResult, error) (*platform.CreateFunctionResult, error)) (
	*platform.CreateFunctionResult, error)

HandleDeployFunction calls a deployer that does the platform specific deploy, but adds a lot of common code

func (*Platform) QueryOPAFunctionEventPermissions

func (ap *Platform) QueryOPAFunctionEventPermissions(projectName,
	functionName,
	functionEventName string,
	action opa.Action,
	permissionOptions *opa.PermissionOptions) (bool, error)

func (*Platform) QueryOPAFunctionPermissions

func (ap *Platform) QueryOPAFunctionPermissions(projectName,
	functionName string,
	action opa.Action,
	permissionOptions *opa.PermissionOptions) (bool, error)

func (*Platform) QueryOPAFunctionRedeployPermissions

func (ap *Platform) QueryOPAFunctionRedeployPermissions(projectName,
	functionName string,
	permissionOptions *opa.PermissionOptions) (bool, error)

func (*Platform) QueryOPAMultipleResources

func (ap *Platform) QueryOPAMultipleResources(ctx context.Context,
	resources []string,
	action opa.Action,
	permissionOptions *opa.PermissionOptions) ([]bool, error)

func (*Platform) QueryOPAProjectPermissions

func (ap *Platform) QueryOPAProjectPermissions(projectName string,
	action opa.Action,
	permissionOptions *opa.PermissionOptions) (bool, error)

func (*Platform) RenderImageNamePrefixTemplate

func (ap *Platform) RenderImageNamePrefixTemplate(projectName string, functionName string) (string, error)

func (*Platform) ResolveProjectNameFromLabelsStr

func (ap *Platform) ResolveProjectNameFromLabelsStr(encodedLabels string) (string, error)

ResolveProjectNameFromLabelsStr resolves first project name from label string

func (*Platform) ResolveReservedResourceNames

func (ap *Platform) ResolveReservedResourceNames() []string

ResolveReservedResourceNames returns a list of reserved resource names

func (*Platform) SetExternalIPAddresses

func (ap *Platform) SetExternalIPAddresses(externalIPAddresses []string) error

SetExternalIPAddresses configures the IP addresses invocations will use. If this is not invoked, each platform will try to discover these addresses automatically

func (*Platform) SetImageNamePrefixTemplate

func (ap *Platform) SetImageNamePrefixTemplate(imageNamePrefixTemplate string)

func (*Platform) TransformOnbuildArtifactPaths

func (ap *Platform) TransformOnbuildArtifactPaths(onbuildArtifacts []runtime.Artifact) (map[string]string, error)

TransformOnbuildArtifactPaths changes Onbuild artifact paths depending on the type of the builder used

func (*Platform) UpdateAPIGateway

func (ap *Platform) UpdateAPIGateway(ctx context.Context, updateAPIGatewayOptions *platform.UpdateAPIGatewayOptions) error

UpdateAPIGateway will update a previously existing api gateway

func (*Platform) UpdateFunctionEvent

func (ap *Platform) UpdateFunctionEvent(ctx context.Context, updateFunctionEventOptions *platform.UpdateFunctionEventOptions) error

UpdateFunctionEvent will update a previously existing function event

func (*Platform) UpdateProject

func (ap *Platform) UpdateProject(ctx context.Context, updateProjectOptions *platform.UpdateProjectOptions) error

UpdateProject will update a previously existing project

func (*Platform) ValidateCreateFunctionOptionsAgainstExistingFunctionConfig

func (ap *Platform) ValidateCreateFunctionOptionsAgainstExistingFunctionConfig(ctx context.Context,
	existingFunctionConfig *functionconfig.ConfigWithStatus,
	createFunctionOptions *platform.CreateFunctionOptions) error

ValidateCreateFunctionOptionsAgainstExistingFunctionConfig validates a function against its existing instance

func (*Platform) ValidateDeleteFunctionOptions

func (ap *Platform) ValidateDeleteFunctionOptions(ctx context.Context, deleteFunctionOptions *platform.DeleteFunctionOptions) (
	platform.Function, error)

ValidateDeleteFunctionOptions validates and enforces of required function deletion logic

func (*Platform) ValidateDeleteProjectOptions

func (ap *Platform) ValidateDeleteProjectOptions(ctx context.Context,
	deleteProjectOptions *platform.DeleteProjectOptions) error

ValidateDeleteProjectOptions validates and enforces of required project deletion logic

func (*Platform) ValidateFunctionConfig

func (ap *Platform) ValidateFunctionConfig(ctx context.Context, functionConfig *functionconfig.Config) error

ValidateFunctionConfig validates and enforces of required function creation logic

func (*Platform) ValidateFunctionConfigWithRetry

func (ap *Platform) ValidateFunctionConfigWithRetry(ctx context.Context, functionConfig *functionconfig.Config, autofix bool) error

func (*Platform) ValidateProjectConfig

func (ap *Platform) ValidateProjectConfig(projectConfig *platform.ProjectConfig) error

ValidateProjectConfig perform validation on a given project config

func (*Platform) ValidateResourceVersion

func (ap *Platform) ValidateResourceVersion(ctx context.Context,
	functionConfigWithStatus *functionconfig.ConfigWithStatus,
	requestFunctionConfig *functionconfig.Config) error

ValidateResourceVersion validates existing and new create function options resource version

func (*Platform) WaitForProjectResourcesDeletion

func (ap *Platform) WaitForProjectResourcesDeletion(ctx context.Context, projectMeta *platform.ProjectMeta, duration time.Duration) error

Jump to

Keyboard shortcuts

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