platform

package
v0.0.0-...-815ff22 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: Apache-2.0 Imports: 25 Imported by: 7

Documentation

Index

Constants

View Source
const (
	ProjectGetUponCreationTimeout       = 30 * time.Second
	ProjectGetUponCreationRetryInterval = 1 * time.Second
)
View Source
const DefaultFunctionEventTriggerKind = FunctionEventTriggerKindHTTP
View Source
const DefaultProjectName string = "default"
View Source
const FunctionEventTriggerKindHTTP = "http"
View Source
const FunctionInvocationDefaultTimeout = time.Minute
View Source
const SecretTypeAPIGatewayConfig = "nuclio.io/apigatewayconfig"

Variables

View Source
var ErrFunctionIsUsedByAPIGateways = nuclio.NewErrPreconditionFailed("Function is used by api gateways")
View Source
var ErrIngressHostPathInUse = nuclio.NewErrPreconditionFailed("Ingress host and path are already in use")
View Source
var ErrProjectContainsAPIGateways = nuclio.NewErrPreconditionFailed("Project contains api gateways")
View Source
var ErrProjectContainsFunctions = nuclio.NewErrPreconditionFailed("Project contains functions")

A project containing resources(functions/api gateways), cannot be deleted

View Source
var ErrSuccessfulCreateProjectLeader = nuclio.NewErrAccepted("Successfully requested from the leader to create the project")

projects

View Source
var ErrSuccessfulDeleteProjectLeader = nuclio.NewErrAccepted("Successfully requested from the leader to delete the project")
View Source
var ErrSuccessfulUpdateProjectLeader = nuclio.NewErrAccepted("Successfully requested from the leader to update the project")
View Source
var ErrUnsupportedMethod = nuclio.NewErrNotImplemented("Unsupported method")

Functions

func GetAPIGatewaySensitiveField

func GetAPIGatewaySensitiveField() []*regexp.Regexp

Types

type APIGateway

type APIGateway interface {

	// GetConfig returns the api gateway config
	GetConfig() *APIGatewayConfig
}

type APIGatewayAuthenticationSpec

type APIGatewayAuthenticationSpec struct {
	BasicAuth *BasicAuth       `json:"basicAuth,omitempty"`
	DexAuth   *ingress.DexAuth `json:"dexAuth,omitempty"`
}

type APIGatewayConfig

type APIGatewayConfig struct {
	Meta   APIGatewayMeta   `json:"metadata,omitempty"`
	Spec   APIGatewaySpec   `json:"spec,omitempty"`
	Status APIGatewayStatus `json:"status,omitempty"`
}

func GetAPIGatewayConfigFromInterface

func GetAPIGatewayConfigFromInterface(apiGatewayConfigInterface interface{}) *APIGatewayConfig

func (*APIGatewayConfig) PrepareAPIGatewayForExport

func (agc *APIGatewayConfig) PrepareAPIGatewayForExport(noScrub bool)

type APIGatewayMeta

type APIGatewayMeta struct {
	Name              string            `json:"name,omitempty"`
	Namespace         string            `json:"namespace,omitempty"`
	Labels            map[string]string `json:"labels,omitempty"`
	Annotations       map[string]string `json:"annotations,omitempty"`
	CreationTimestamp *metav1.Time      `json:"creationTimestamp,omitempty"`
}

type APIGatewayScrubber

type APIGatewayScrubber struct {
	*common.AbstractScrubber
}

func NewAPIGatewayScrubber

func NewAPIGatewayScrubber(parentLogger logger.Logger,
	sensitiveFields []*regexp.Regexp,
	kubeClientSet kubernetes.Interface) *APIGatewayScrubber

func (*APIGatewayScrubber) ConvertMapToConfig

func (s *APIGatewayScrubber) ConvertMapToConfig(mapConfig interface{}) (interface{}, error)

func (*APIGatewayScrubber) RestoreAPIGatewayConfig

func (s *APIGatewayScrubber) RestoreAPIGatewayConfig(ctx context.Context,
	config *APIGatewayConfig) (*APIGatewayConfig, error)

RestoreAPIGatewayConfig restores an API Gateway config from a secret, in case we're running in a kube platform

func (*APIGatewayScrubber) ScrubAPIGatewayConfig

func (s *APIGatewayScrubber) ScrubAPIGatewayConfig(ctx context.Context,
	apiGatewayConfig *APIGatewayConfig) (*APIGatewayConfig, error)

ScrubAPIGatewayConfig scrubs the API gateway configuration and creates a secret with all scrubbed data

func (*APIGatewayScrubber) ValidateReference

func (s *APIGatewayScrubber) ValidateReference(objectToScrub interface{},
	existingSecretMap map[string]string,
	fieldPath,
	secretKey,
	stringValue string) error

type APIGatewaySpec

type APIGatewaySpec struct {
	Host               string                        `json:"host,omitempty"`
	Name               string                        `json:"name,omitempty"`
	Description        string                        `json:"description,omitempty"`
	Path               string                        `json:"path,omitempty"`
	AuthenticationMode ingress.AuthenticationMode    `json:"authenticationMode,omitempty"`
	Authentication     *APIGatewayAuthenticationSpec `json:"authentication,omitempty"`
	Upstreams          []APIGatewayUpstreamSpec      `json:"upstreams,omitempty"`
}

func (*APIGatewaySpec) DeepCopyInto

func (s *APIGatewaySpec) DeepCopyInto(out *APIGatewaySpec)

to appease k8s

type APIGatewayState

type APIGatewayState string

APIGatewayState is state of api gateway

const (
	APIGatewayStateNone                   APIGatewayState = ""
	APIGatewayStateReady                  APIGatewayState = "ready"
	APIGatewayStateError                  APIGatewayState = "error"
	APIGatewayStateWaitingForProvisioning APIGatewayState = "waitingForProvisioning"
)

Possible api gateway states

type APIGatewayStatus

type APIGatewayStatus struct {
	Name        string          `json:"name,omitempty"`
	LastError   string          `json:"last_error,omitempty"`
	Description string          `json:"description,omitempty"`
	State       APIGatewayState `json:"state,omitempty"`
}

type APIGatewayUpstreamKind

type APIGatewayUpstreamKind string
const (
	APIGatewayUpstreamKindNuclioFunction APIGatewayUpstreamKind = "nucliofunction"
)

type APIGatewayUpstreamSpec

type APIGatewayUpstreamSpec struct {
	Kind             APIGatewayUpstreamKind        `json:"kind,omitempty"`
	NuclioFunction   *NuclioFunctionAPIGatewaySpec `json:"nucliofunction,omitempty"`
	Port             int                           `json:"port,omitempty"`
	Percentage       int                           `json:"percentage,omitempty"`
	RewriteTarget    string                        `json:"rewriteTarget,omitempty"`
	ExtraAnnotations map[string]string             `json:"extraAnnotations,omitempty"`
	ExtraLabels      map[string]string             `json:"extraLabels,omitempty"`
}

type AbstractAPIGateway

type AbstractAPIGateway struct {
	Logger           logger.Logger
	Platform         Platform
	APIGatewayConfig APIGatewayConfig
}

func NewAbstractAPIGateway

func NewAbstractAPIGateway(parentLogger logger.Logger,
	parentPlatform Platform,
	apiGatewayConfig APIGatewayConfig) (*AbstractAPIGateway, error)

func (*AbstractAPIGateway) GetConfig

func (ap *AbstractAPIGateway) GetConfig() *APIGatewayConfig

GetConfig returns the api gateway config

type AbstractFunction

type AbstractFunction struct {
	Logger   logger.Logger
	Config   functionconfig.Config
	Status   functionconfig.Status
	Platform Platform
	// contains filtered or unexported fields
}

func NewAbstractFunction

func NewAbstractFunction(parentLogger logger.Logger,
	parentPlatform Platform,
	config *functionconfig.Config,
	status *functionconfig.Status,
	function Function) (*AbstractFunction, error)

func (*AbstractFunction) GetConfig

func (af *AbstractFunction) GetConfig() *functionconfig.Config

GetConfig will return the configuration of the function

func (*AbstractFunction) GetConfigWithStatus

func (af *AbstractFunction) GetConfigWithStatus() *functionconfig.ConfigWithStatus

GetConfigWithStatus returns both function config and status

func (*AbstractFunction) GetReplicas

func (af *AbstractFunction) GetReplicas() (int, int)

GetReplicas returns the current # of replicas and the configured # of replicas

func (*AbstractFunction) GetStatus

func (af *AbstractFunction) GetStatus() *functionconfig.Status

GetStatus returns the state of the function

func (*AbstractFunction) GetVersion

func (af *AbstractFunction) GetVersion() string

GetVersion returns a string representing the version

func (*AbstractFunction) Initialize

func (af *AbstractFunction) Initialize(context.Context, []string) error

Initialize instructs the function to load the fields specified by "fields". Some function implementations are lazy-load - this ensures that the fields are populated properly. if "fields" is nil, all fields are loaded

type AbstractFunctionEvent

type AbstractFunctionEvent struct {
	Logger              logger.Logger
	Platform            Platform
	FunctionEventConfig FunctionEventConfig
}

func NewAbstractFunctionEvent

func NewAbstractFunctionEvent(parentLogger logger.Logger,
	parentPlatform Platform,
	functionEventConfig FunctionEventConfig) (*AbstractFunctionEvent, error)

func (*AbstractFunctionEvent) GetConfig

func (afe *AbstractFunctionEvent) GetConfig() *FunctionEventConfig

GetConfig returns the function event config

type AbstractProject

type AbstractProject struct {
	Logger        logger.Logger
	Platform      Platform
	ProjectConfig ProjectConfig
}

func NewAbstractProject

func NewAbstractProject(parentLogger logger.Logger,
	parentPlatform Platform,
	projectConfig ProjectConfig) (*AbstractProject, error)

func (*AbstractProject) CreateAndWait

func (ap *AbstractProject) CreateAndWait(ctx context.Context, createProjectOptions *CreateProjectOptions) error

func (*AbstractProject) GetConfig

func (ap *AbstractProject) GetConfig() *ProjectConfig

GetConfig returns the project config

type AuthConfig

type AuthConfig struct {
	Token string
}

type BasicAuth

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password,omitempty"`
}

type CreateAPIGatewayOptions

type CreateAPIGatewayOptions struct {
	APIGatewayConfig           *APIGatewayConfig
	AuthSession                auth.Session
	ValidateFunctionsExistence bool
}

type CreateFunctionBuildOptions

type CreateFunctionBuildOptions struct {
	Logger                     logger.Logger
	FunctionConfig             functionconfig.Config
	PlatformName               string
	OnAfterConfigUpdate        func(*functionconfig.Config) error
	OutputImageFile            string
	DependantImagesRegistryURL string
}

type CreateFunctionBuildResult

type CreateFunctionBuildResult struct {
	Image string

	// the function configuration read by the builder either from function.yaml or inline configuration
	UpdatedFunctionConfig functionconfig.Config
}

CreateFunctionBuildResult holds information detected/generated as a result of a build process

type CreateFunctionEventOptions

type CreateFunctionEventOptions struct {
	FunctionEventConfig FunctionEventConfig
	PermissionOptions   opa.PermissionOptions
	AuthSession         auth.Session
}

type CreateFunctionInvocationOptions

type CreateFunctionInvocationOptions struct {
	Name         string
	Namespace    string
	Path         string
	Method       string
	Body         []byte
	Headers      http.Header
	LogLevelName string
	Timeout      time.Duration
	URL          string

	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session

	// the function instance to invoke
	FunctionInstance Function

	// used from nuctl, to avoid validating the input url, which might be overridden when
	// user provides explicit external ip address
	SkipURLValidation bool

	// skip tls verification when invoking a function
	SkipTLSVerification bool
}

CreateFunctionInvocationOptions is the base for all platform invoke options

func (*CreateFunctionInvocationOptions) EnrichFunction

func (c *CreateFunctionInvocationOptions) EnrichFunction(ctx context.Context, p Platform) error

type CreateFunctionInvocationResult

type CreateFunctionInvocationResult struct {
	Headers    http.Header
	Body       []byte
	StatusCode int
}

CreateFunctionInvocationResult holds the result of a single invocation

type CreateFunctionOptions

type CreateFunctionOptions struct {
	Logger                     logger.Logger
	FunctionConfig             functionconfig.Config
	CreationStateUpdated       chan bool
	InputImageFile             string
	AuthConfig                 *AuthConfig
	DependantImagesRegistryURL string
	PermissionOptions          opa.PermissionOptions
	AuthSession                auth.Session
	AutofixConfiguration       bool
}

type CreateFunctionResult

type CreateFunctionResult struct {
	CreateFunctionBuildResult
	FunctionStatus functionconfig.Status
	Port           int
	ContainerID    string
}

CreateFunctionResult holds the results of a deployment

type CreateProjectOptions

type CreateProjectOptions struct {
	ProjectConfig           *ProjectConfig
	RequestOrigin           platformconfig.ProjectsLeaderKind
	SessionCookie           *http.Cookie
	PermissionOptions       opa.PermissionOptions
	AuthSession             auth.Session
	WaitForCreateCompletion bool
}

type DeleteAPIGatewayOptions

type DeleteAPIGatewayOptions struct {
	Meta        APIGatewayMeta
	AuthSession auth.Session
}

type DeleteFunctionEventOptions

type DeleteFunctionEventOptions struct {
	Meta              FunctionEventMeta
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session
}

type DeleteFunctionOptions

type DeleteFunctionOptions struct {
	FunctionConfig    functionconfig.Config
	AuthConfig        *AuthConfig
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session

	// whether to ignore the validation where functions being provisioned cannot be deleted
	IgnoreFunctionStateValidation bool

	// whether api gateways should be deleted if ones exist
	DeleteApiGateways bool
}

type DeleteProjectOptions

type DeleteProjectOptions struct {
	Meta              ProjectMeta
	Strategy          DeleteProjectStrategy
	RequestOrigin     platformconfig.ProjectsLeaderKind
	SessionCookie     *http.Cookie
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session

	// allowing us to "block" until related resources are removed.
	// used in testings
	WaitForResourcesDeletionCompletion         bool
	WaitForResourcesDeletionCompletionDuration time.Duration
}

type DeleteProjectStrategy

type DeleteProjectStrategy string
const (

	// DeleteProjectStrategyCascading - delete sub resources prior to project deletion, leaving no orphans behind
	DeleteProjectStrategyCascading DeleteProjectStrategy = "cascading"

	// DeleteProjectStrategyRestricted - avoid deleting when project contains related resources (e.g.: functions)
	DeleteProjectStrategyRestricted DeleteProjectStrategy = "restricted"

	// DeleteProjectStrategyCheck - check pre-conditions for project deletion. does not perform deletion.
	DeleteProjectStrategyCheck DeleteProjectStrategy = "check"
)

func ResolveProjectDeletionStrategyOrDefault

func ResolveProjectDeletionStrategyOrDefault(projectDeletionStrategy string) DeleteProjectStrategy

type Function

type Function interface {

	// Initialize instructs the function to load the fields specified by "fields". Some function implementations
	// are lazy-load - this ensures that the fields are populated properly. if "fields" is nil, all fields
	// are loaded
	Initialize(context.Context, []string) error

	// GetConfig will return the configuration of the function
	GetConfig() *functionconfig.Config

	// GetStatus returns the state of the function
	GetStatus() *functionconfig.Status

	// GetReplicas returns the current # of replicas and the configured # of replicas
	GetReplicas() (int, int)

	// GetVersion returns a string representing the version
	GetVersion() string

	// GetConfigWithStatus returns configuration and state of the function
	GetConfigWithStatus() *functionconfig.ConfigWithStatus
}

type FunctionEvent

type FunctionEvent interface {

	// GetConfig returns the function event config
	GetConfig() *FunctionEventConfig
}

type FunctionEventConfig

type FunctionEventConfig struct {
	Meta FunctionEventMeta `json:"meta"`
	Spec FunctionEventSpec `json:"spec"`
}

type FunctionEventMeta

type FunctionEventMeta struct {
	Name        string            `json:"name,omitempty"`
	Namespace   string            `json:"namespace,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

type FunctionEventSpec

type FunctionEventSpec struct {
	DisplayName string                 `json:"displayName,omitempty"`
	TriggerName string                 `json:"triggerName,omitempty"`
	TriggerKind string                 `json:"triggerKind,omitempty"`
	Body        string                 `json:"body,omitempty"`
	Attributes  map[string]interface{} `json:"attributes,omitempty"`
}

func (*FunctionEventSpec) DeepCopyInto

func (s *FunctionEventSpec) DeepCopyInto(out *FunctionEventSpec)

DeepCopyInto to appease k8s

type FunctionEventTriggerKind

type FunctionEventTriggerKind string

type GetAPIGatewaysOptions

type GetAPIGatewaysOptions struct {
	Name         string
	Namespace    string
	Labels       string
	FunctionName string
	AuthSession  auth.Session
}

type GetFunctionEventsOptions

type GetFunctionEventsOptions struct {
	Meta              FunctionEventMeta
	FunctionNames     []string
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session
}

type GetFunctionReplicaLogsStreamOptions

type GetFunctionReplicaLogsStreamOptions struct {

	// The replica (pod / container) name
	Name string

	// The replica (pod / container) namespace
	Namespace string

	// Whether to log stream of the replica
	Follow bool

	// A relative time in seconds before the current time from which to show logs.
	SinceSeconds *int64

	// Number of lines to show from the end of the logs
	TailLines *int64

	// A specific container name to stream logs from (if not specified, the "nuclio" container in the pod is used)
	// Relevant only for pods with multiple containers
	ContainerName string
}

type GetFunctionsOptions

type GetFunctionsOptions struct {
	Name              string
	Namespace         string
	Labels            string
	ResourceVersion   string
	AuthConfig        *AuthConfig
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session

	// Enrich functions with their api gateways
	EnrichWithAPIGateways bool
}

GetFunctionsOptions is the base for all platform get options

type GetProjectsOptions

type GetProjectsOptions struct {
	Meta              ProjectMeta
	PermissionOptions opa.PermissionOptions
	RequestOrigin     platformconfig.ProjectsLeaderKind
	SessionCookie     *http.Cookie
	AuthSession       auth.Session
}

type HealthCheckMode

type HealthCheckMode string
const (
	// HealthCheckModeInternalClient health check is performed by an internal client
	HealthCheckModeInternalClient HealthCheckMode = "internalClient"

	// HealthCheckModeExternal health check is performed by an outside entity
	HealthCheckModeExternal = "external"
)

type NuclioFunctionAPIGatewaySpec

type NuclioFunctionAPIGatewaySpec struct {
	Name string `json:"name,omitempty"`
}

type Platform

type Platform interface {

	// Initialize Initializes the platform
	Initialize(ctx context.Context) error

	// CreateFunctionBuild Build will locally build a processor image and return its name (or the error)
	CreateFunctionBuild(ctx context.Context, createFunctionBuildOptions *CreateFunctionBuildOptions) (*CreateFunctionBuildResult, error)

	// CreateFunction Deploy will deploy a processor image to the platform (optionally building it, if source is provided)
	CreateFunction(ctx context.Context, createFunctionOptions *CreateFunctionOptions) (*CreateFunctionResult, error)

	// EnrichFunctionConfig Enrich function config upon creating function
	EnrichFunctionConfig(ctx context.Context, functionConfig *functionconfig.Config) error

	// ValidateFunctionConfig Validate function config upon creating function
	ValidateFunctionConfig(ctx context.Context, functionConfig *functionconfig.Config) error

	// UpdateFunction will update a previously deployed function
	UpdateFunction(ctx context.Context, updateFunctionOptions *UpdateFunctionOptions) error

	// DeleteFunction will delete a previously deployed function
	DeleteFunction(ctx context.Context, deleteFunctionOptions *DeleteFunctionOptions) error

	// RedeployFunction will redeploy a previously deployed function
	RedeployFunction(ctx context.Context, redeployFunctionOptions *RedeployFunctionOptions) error

	// CreateFunctionInvocation will invoke a previously deployed function
	CreateFunctionInvocation(ctx context.Context, createFunctionInvocationOptions *CreateFunctionInvocationOptions) (*CreateFunctionInvocationResult, error)

	// GetFunctions will list existing functions
	GetFunctions(ctx context.Context, getFunctionsOptions *GetFunctionsOptions) ([]Function, error)

	// FilterFunctionsByPermissions will filter out some functions
	FilterFunctionsByPermissions(context.Context, *opa.PermissionOptions, []Function) ([]Function, error)

	// GetDefaultInvokeIPAddresses will return a list of ip addresses to be used by the platform to invoke a function
	GetDefaultInvokeIPAddresses() ([]string, error)

	// GetFunctionReplicaLogsStream return the function instance (Kubernetes - Pod / Docker - Container) logs stream
	GetFunctionReplicaLogsStream(context.Context, *GetFunctionReplicaLogsStreamOptions) (io.ReadCloser, error)

	// GetFunctionReplicaNames returns function replica names (Pod / Container names)
	GetFunctionReplicaNames(context.Context, *functionconfig.Config) ([]string, error)

	// GetFunctionReplicaContainers returns function replica containers (Pod / Container names)
	GetFunctionReplicaContainers(context.Context, *functionconfig.Config, string) ([]string, error)

	// CreateProject will probably create a new project
	CreateProject(ctx context.Context, createProjectOptions *CreateProjectOptions) error

	// UpdateProject will update a previously existing project
	UpdateProject(ctx context.Context, updateProjectOptions *UpdateProjectOptions) error

	// DeleteProject will delete a previously existing project
	DeleteProject(ctx context.Context, deleteProjectOptions *DeleteProjectOptions) error

	// GetProjects will list existing projects
	GetProjects(ctx context.Context, getProjectsOptions *GetProjectsOptions) ([]Project, error)

	// EnsureDefaultProjectExistence ensure default project exists, creates it otherwise
	EnsureDefaultProjectExistence(ctx context.Context) error

	// WaitForProjectResourcesDeletion waits for all the project's resources to be deleted
	WaitForProjectResourcesDeletion(ctx context.Context, projectMeta *ProjectMeta, duration time.Duration) error

	// GetFunctionProject returns project instance for specific function
	GetFunctionProject(ctx context.Context, functionConfig *functionconfig.Config) (Project, error)

	// CreateFunctionEvent will create a new function event that can later be used as a template from
	// which to invoke functions
	CreateFunctionEvent(ctx context.Context, createFunctionEventOptions *CreateFunctionEventOptions) error

	// UpdateFunctionEvent will update a previously existing function event
	UpdateFunctionEvent(ctx context.Context, updateFunctionEventOptions *UpdateFunctionEventOptions) error

	// DeleteFunctionEvent will delete a previously existing function event
	DeleteFunctionEvent(ctx context.Context, deleteFunctionEventOptions *DeleteFunctionEventOptions) error

	// GetFunctionEvents will list existing function events
	GetFunctionEvents(ctx context.Context, getFunctionEventsOptions *GetFunctionEventsOptions) ([]FunctionEvent, error)

	// FilterFunctionEventsByPermissions will filter out some function events
	FilterFunctionEventsByPermissions(context.Context, *opa.PermissionOptions, []FunctionEvent) ([]FunctionEvent, error)

	// CreateAPIGateway creates and deploy APIGateway
	CreateAPIGateway(ctx context.Context, createAPIGatewayOptions *CreateAPIGatewayOptions) error

	// UpdateAPIGateway will update a previously deployed api gateway
	UpdateAPIGateway(ctx context.Context, updateAPIGatewayOptions *UpdateAPIGatewayOptions) error

	// DeleteAPIGateway will delete a previously deployed api gateway
	DeleteAPIGateway(ctx context.Context, deleteAPIGatewayOptions *DeleteAPIGatewayOptions) error

	// GetAPIGateways will list existing api gateways
	GetAPIGateways(ctx context.Context, getAPIGatewaysOptions *GetAPIGatewaysOptions) ([]APIGateway, error)

	// SetExternalIPAddresses configures the IP addresses invocations will use.
	// If this is not invoked, each platform will try to discover these addresses automatically
	SetExternalIPAddresses(externalIPAddresses []string) error

	// GetExternalIPAddresses returns the external IP addresses invocations will use.
	// These addresses are either set through SetExternalIPAddresses or automatically discovered
	GetExternalIPAddresses() ([]string, error)

	SetImageNamePrefixTemplate(string)

	GetImageNamePrefixTemplate() string

	RenderImageNamePrefixTemplate(projectName string, functionName string) (string, error)

	// GetScaleToZeroConfiguration returns scale to zero configuration
	GetScaleToZeroConfiguration() *platformconfig.ScaleToZero

	// GetDisableDefaultHttpTrigger returns if creation of default http trigger is disabled
	GetDisableDefaultHttpTrigger() bool

	// GetAllowedAuthenticationModes returns allowed authentication modes
	GetAllowedAuthenticationModes() []string

	// GetNamespaces returns all the namespaces in the platform
	GetNamespaces(context.Context) ([]string, error)

	// GetHealthCheckMode returns the healthcheck mode the platform requires
	GetHealthCheckMode() HealthCheckMode

	// GetName returns the platform name
	GetName() string

	// InitializeContainerBuilder initializes the container builder, if not already initialized
	InitializeContainerBuilder() error

	// BuildAndPushContainerImage builds container image and pushes it into container registry
	BuildAndPushContainerImage(ctx context.Context, buildOptions *containerimagebuilderpusher.BuildOptions) error

	// GetOnbuildStages Get Onbuild stage for multistage builds
	GetOnbuildStages(onbuildArtifacts []runtime.Artifact) ([]string, error)

	// TransformOnbuildArtifactPaths Change Onbuild artifact paths depending on the type of the builder used
	TransformOnbuildArtifactPaths(onbuildArtifacts []runtime.Artifact) (map[string]string, error)

	// GetOnbuildImageRegistry returns onbuild base registry
	GetOnbuildImageRegistry(registry string, runtime runtime.Runtime) (string, error)

	// GetBaseImageRegistry returns base image registry
	GetBaseImageRegistry(registry string, runtime runtime.Runtime) (string, error)

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

	// GetRegistryKind returns platform registry kind
	GetRegistryKind() string

	// SaveFunctionDeployLogs Save build logs from platform logger to function store or k8s
	SaveFunctionDeployLogs(ctx context.Context, functionName, namespace string) error

	// GetProcessorLogsAndBriefError Parse and construct a function processor logs and brief error
	GetProcessorLogsAndBriefError(scanner *bufio.Scanner) (string, string)

	// GetContainerBuilderKind returns the container-builder kind
	GetContainerBuilderKind() string

	// GetRuntimeBuildArgs returns the runtime specific build arguments
	GetRuntimeBuildArgs(runtime runtime.Runtime) map[string]string

	// GetConfig returns platform config
	GetConfig() *platformconfig.Config

	// GetFunctionScrubber returns function config scrubber
	GetFunctionScrubber() *functionconfig.Scrubber

	// GetAPIGatewayScrubber returns function config scrubber
	GetAPIGatewayScrubber() *APIGatewayScrubber

	// QueryOPAFunctionPermissions queries opa permissions for a certain function
	QueryOPAFunctionPermissions(projectName, functionName string, action opa.Action, permissionOptions *opa.PermissionOptions) (bool, error)
}

Platform defines the interface that any underlying function platform must provide for nuclio to run over it

type Project

type Project interface {

	// GetConfig returns the project config
	GetConfig() *ProjectConfig
}

type ProjectConfig

type ProjectConfig struct {
	Meta   ProjectMeta   `json:"meta"`
	Spec   ProjectSpec   `json:"spec"`
	Status ProjectStatus `json:"status,omitempty"`
}

func (*ProjectConfig) IsEqual

func (pc *ProjectConfig) IsEqual(other *ProjectConfig, ignoreStatus bool) bool

func (*ProjectConfig) Scrub

func (pc *ProjectConfig) Scrub()

type ProjectMeta

type ProjectMeta struct {
	Name        string            `json:"name,omitempty"`
	Namespace   string            `json:"namespace,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`

	// Can be used to determine whether the object is stale (not used today)
	// more details @ https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions
	ResourceVersion string `json:"resourceVersion,omitempty"`
}

func (ProjectMeta) IsEqual

func (pm ProjectMeta) IsEqual(other ProjectMeta) bool

type ProjectSpec

type ProjectSpec struct {
	Description                 string            `json:"description,omitempty"`
	Owner                       string            `json:"owner,omitempty"`
	DefaultFunctionNodeSelector map[string]string `json:"defaultFunctionNodeSelector,omitempty"`
}

func (*ProjectSpec) DeepCopyInto

func (ps *ProjectSpec) DeepCopyInto(out *ProjectSpec)

DeepCopyInto to appease k8s

func (ProjectSpec) IsEqual

func (ps ProjectSpec) IsEqual(other ProjectSpec) bool

type ProjectStatus

type ProjectStatus struct {
	AdminStatus       string     `json:"adminStatus,omitempty"`
	OperationalStatus string     `json:"operationalStatus,omitempty"`
	UpdatedAt         *time.Time `json:"updatedAt,omitempty"`
}

func (*ProjectStatus) DeepCopyInto

func (pst *ProjectStatus) DeepCopyInto(out *ProjectStatus)

func (ProjectStatus) IsEqual

func (pst ProjectStatus) IsEqual(other ProjectStatus) bool

type RedeployFunctionOptions

type RedeployFunctionOptions struct {
	FunctionMeta                *functionconfig.Meta
	FunctionSpec                *functionconfig.Spec
	AuthConfig                  *AuthConfig
	DependantImagesRegistryURL  string
	AuthSession                 auth.Session
	PermissionOptions           opa.PermissionOptions
	CreationStateUpdatedTimeout time.Duration
	DesiredState                functionconfig.FunctionState
}

type UpdateAPIGatewayOptions

type UpdateAPIGatewayOptions struct {
	APIGatewayConfig           *APIGatewayConfig
	AuthSession                auth.Session
	ValidateFunctionsExistence bool
}

type UpdateFunctionEventOptions

type UpdateFunctionEventOptions struct {
	FunctionEventConfig FunctionEventConfig
	PermissionOptions   opa.PermissionOptions
	AuthSession         auth.Session
}

type UpdateFunctionOptions

type UpdateFunctionOptions struct {
	FunctionMeta      *functionconfig.Meta
	FunctionSpec      *functionconfig.Spec
	FunctionStatus    *functionconfig.Status
	AuthConfig        *AuthConfig
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session
}

type UpdateProjectOptions

type UpdateProjectOptions struct {
	ProjectConfig     ProjectConfig
	RequestOrigin     platformconfig.ProjectsLeaderKind
	SessionCookie     *http.Cookie
	PermissionOptions opa.PermissionOptions
	AuthSession       auth.Session
}

Directories

Path Synopsis
apis/nuclio.io/v1beta1
Package v1beta1 is the v1beta1 version of the API.
Package v1beta1 is the v1beta1 version of the API.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/nuclio.io/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/nuclio.io/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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