types

package
v0.0.0-...-e63063d Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContainerName name of the service container
	ContainerName = "oscar-container"

	// VolumeName name of the volume for mounting the OSCAR PVC
	VolumeName = "oscar-volume"

	// VolumePath path to mount the OSCAR PVC
	VolumePath = "/oscar/bin"

	// ConfigVolumeName name of the volume for mounting the service configMap
	ConfigVolumeName = "oscar-config"

	// ConfigPath path to mount the service configMap
	ConfigPath = "/oscar/config"

	// FDLFileName name of the FDL file to be stored in the service's configMap
	FDLFileName = "function_config.yaml"

	// ScriptFileName name of the user script file to be stored in the service's configMap
	ScriptFileName = "script.sh"

	// PVCName name of the OSCAR PVC
	PVCName = "oscar-pvc"

	// WatchdogName name of the OpenFaaS watchdog binary
	WatchdogName = "fwatchdog"

	// WatchdogProcess name of the environment variable used by the watchdog to handle requests
	WatchdogProcess = "fprocess"

	// SupervisorName name of the FaaS Supervisor binary
	SupervisorName = "supervisor"

	// ServiceLabel label for deploying services in all backs
	ServiceLabel = "oscar_service"

	// EventVariable name used by the environment variable where events are stored
	EventVariable = "EVENT"

	// OpenfaasZeroScalingLabel label to enable zero scaling in OpenFaaS functions
	OpenfaasZeroScalingLabel = "com.openfaas.scale.zero"
)
View Source
const (
	// DefaultProvider string identifier for the default StorageProvider
	DefaultProvider = "default"

	// MinIOName string representing the MinIO provider name
	MinIOName = "minio"

	// S3Name string representing the S3 provider name
	S3Name = "s3"

	// OnedataName string representing the Onedata provider name
	OnedataName = "onedata"

	// ProviderSeparator separator character used to split provider's name and identifier
	ProviderSeparator = "."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MinIOProvider access info
	MinIOProvider *MinIOProvider `json:"minio_provider"`

	// Basic auth username
	Username string `json:"-"`

	// Basic auth password
	Password string `json:"-"`

	// Kubernetes name for the deployment and service (default: oscar)
	Name string `json:"name"`

	// Kubernetes namespace for the deployment and service (default: oscar)
	Namespace string `json:"namespace"`

	// Kubernetes namespace for services and jobs (default: oscar-svc)
	ServicesNamespace string `json:"services_namespace"`

	// Port used for the ClusterIP k8s service (default: 8080)
	ServicePort int `json:"-"`

	// Serverless framework used to deploy services (Openfaas | Knative)
	// If not defined only async invokations allowed (Using KubeBackend)
	ServerlessBackend string `json:"serverless_backend,omitempty"`

	// OpenfaasNamespace namespace where the OpenFaaS gateway is deployed
	OpenfaasNamespace string `json:"-"`

	// OpenfaasPort service port where the OpenFaaS gateway is exposed
	OpenfaasPort int `json:"-"`

	// HTTP timeout for reading the payload (default: 300)
	ReadTimeout time.Duration `json:"-"`

	// HTTP timeout for writing the response (default: 300)
	WriteTimeout time.Duration `json:"-"`
}

Config stores the configuration for the OSCAR server

func ReadConfig

func ReadConfig() (*Config, error)

ReadConfig reads environment variables to create the OSCAR server configuration

type Info

type Info struct {
	Version               string                 `json:"version"`
	GitCommit             string                 `json:"git_commit"`
	Architecture          string                 `json:"architecture"`
	KubeVersion           string                 `json:"kubernetes_version"`
	ServerlessBackendInfo *ServerlessBackendInfo `json:"serverless_backend,omitempty"`
}

Info represents the system information to be exposed

type JobInfo

type JobInfo struct {
	Status       string       `json:"status"`
	CreationTime *metav1.Time `json:"creation_time,omitempty"`
	StartTime    *metav1.Time `json:"start_time,omitempty"`
	FinishTime   *metav1.Time `json:"finish_time,omitempty"`
}

JobInfo details the current status of a service's job

type MinIOProvider

type MinIOProvider struct {
	Endpoint  string `json:"endpoint"`
	Verify    bool   `json:"verify"`
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Region    string `json:"region"`
}

MinIOProvider stores the credentials of the MinIO storage provider

func (MinIOProvider) GetS3Client

func (minIOProvider MinIOProvider) GetS3Client() *s3.S3

GetS3Client creates a new S3 Client from a MinIOProvider

type OnedataProvider

type OnedataProvider struct {
	OneproviderHost string `json:"oneprovider_host"`
	Token           string `json:"token"`
	Space           string `json:"space"`
}

OnedataProvider stores the credentials of the Onedata storage provider

func (OnedataProvider) GetCDMIClient

func (onedataProvider OnedataProvider) GetCDMIClient() *cdmi.Client

GetCDMIClient creates a new CDMI Client from a OnedataProvider

type S3Provider

type S3Provider struct {
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Region    string `json:"region"`
}

S3Provider stores the credentials of the AWS S3 storage provider

func (S3Provider) GetS3Client

func (s3Provider S3Provider) GetS3Client() *s3.S3

GetS3Client creates a new S3 Client from a S3Provider

type ServerlessBackend

type ServerlessBackend interface {
	GetInfo() *ServerlessBackendInfo
	ListServices() ([]*Service, error)
	CreateService(service Service) error
	ReadService(name string) (*Service, error)
	UpdateService(service Service) error
	DeleteService(name string) error
}

ServerlessBackend define an interface for OSCAR's backends

type ServerlessBackendInfo

type ServerlessBackendInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ServerlessBackendInfo shows the name and version of the underlying serverless backend

type Service

type Service struct {
	// The name of the service
	Name string `json:"name" binding:"required,max=39,min=1"`

	// Memory limit for the service following the kubernetes format
	// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory
	// Optional. (default: 256Mi)
	Memory string `json:"memory"`

	// CPU limit for the service following the kubernetes format
	// https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu
	// Optional. (default: 0.2)
	CPU string `json:"cpu"`

	// Log level for the FaaS Supervisor
	// Optional. (default: INFO)
	LogLevel string `json:"log_level"`

	// Docker image for the service
	Image string `json:"image" binding:"required"`

	// StorageIOConfig slices with the input and ouput service configuration
	// Optional
	Input  []StorageIOConfig `json:"input"`
	Output []StorageIOConfig `json:"output"`

	// The user script to execute when the service is invoked
	Script string `json:"script,omitempty" binding:"required"`

	// The user-defined environment variables assigned to the service
	// Optional
	Environment struct {
		Vars map[string]string `json:"Variables"`
	} `json:"environment"`

	// Configuration for the storage providers used by the service
	// Optional. (default: MinIOProvider["default"] with the server's config credentials)
	StorageProviders *StorageProviders `json:"storage_providers,omitempty"`
}

Service represents an OSCAR service following the SCAR Function Definition Language

func (*Service) GetMinIOWebhookARN

func (service *Service) GetMinIOWebhookARN() string

GetMinIOWebhookARN returns the MinIO's notify_webhook ARN for the specified function

func (*Service) ToPodSpec

func (service *Service) ToPodSpec() (*v1.PodSpec, error)

ToPodSpec returns a k8s podSpec from the Service

func (Service) ToYAML

func (service Service) ToYAML() (string, error)

ToYAML returns the service as a Function Definition Language YAML

type StorageIOConfig

type StorageIOConfig struct {
	// Provider reference to the provider's name and identifier specified in StorageProviders
	// The provider's name is separated from the ID by a point (e.g. "minio.myidentifier")
	Provider string   `json:"storage_provider"`
	Path     string   `json:"path"`
	Suffix   []string `json:"suffix,omitempty"`
	Prefix   []string `json:"prefix,omitempty"`
}

StorageIOConfig provides the storage input/output configuration for services

type StorageProviders

type StorageProviders struct {
	S3      map[string]*S3Provider      `json:"s3,omitempty"`
	MinIO   map[string]*MinIOProvider   `json:"minio,omitempty"`
	Onedata map[string]*OnedataProvider `json:"onedata,omitempty"`
}

StorageProviders stores the credentials of all supported storage providers

type SyncBackend

type SyncBackend interface {
	ServerlessBackend
	GetProxyDirector(serviceName string) func(req *http.Request)
}

SyncBackend define an interface for serverless backends that allow sync invocations

Jump to

Keyboard shortcuts

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