spec

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvShardID                 = "SHARD_ID"
	FunctionsInstanceClasspath = "pulsar.functions.instance.classpath"
	DefaultRunnerTag           = "2.10.0.0-rc10"
	DefaultRunnerPrefix        = "streamnative/"
	DefaultRunnerImage         = DefaultRunnerPrefix + "pulsar-all:" + DefaultRunnerTag
	DefaultJavaRunnerImage     = DefaultRunnerPrefix + "pulsar-functions-java-runner:" + DefaultRunnerTag
	DefaultPythonRunnerImage   = DefaultRunnerPrefix + "pulsar-functions-python-runner:" + DefaultRunnerTag
	DefaultGoRunnerImage       = DefaultRunnerPrefix + "pulsar-functions-go-runner:" + DefaultRunnerTag
	PulsarAdminExecutableFile  = "/pulsar/bin/pulsar-admin"

	DefaultForAllowInsecure              = "false"
	DefaultForEnableHostNameVerification = "true"

	AppFunctionMesh   = "function-mesh"
	ComponentSource   = "source"
	ComponentSink     = "sink"
	ComponentFunction = "function"

	PackageNameFunctionPrefix = "function://"
	PackageNameSinkPrefix     = "sink://"
	PackageNameSourcePrefix   = "source://"

	AnnotationPrometheusScrape = "prometheus.io/scrape"
	AnnotationPrometheusPort   = "prometheus.io/port"
	AnnotationManaged          = "compute.functionmesh.io/managed"

	EnvGoFunctionConfigs = "GO_FUNCTION_CONF"

	DefaultRunnerUserID  int64 = 10000
	DefaultRunnerGroupID int64 = 10001

	JavaLogConfigDirectory     = "/pulsar/conf/java-log/"
	JavaLogConfigFile          = "java_instance_log4j.xml"
	DefaultJavaLogConfigPath   = JavaLogConfigDirectory + JavaLogConfigFile
	PythonLogConifgDirectory   = "/pulsar/conf/python-log/"
	PythonLogConfigFile        = "python_instance_logging.ini"
	DefaultPythonLogConfigPath = PythonLogConifgDirectory + PythonLogConfigFile

	EnvGoFunctionLogLevel = "LOGGING_LEVEL"
)

Variables

View Source
var Configs = DefaultConfigs()
View Source
var GRPCPort = corev1.ContainerPort{
	Name:          "tcp-grpc",
	ContainerPort: 9093,
	Protocol:      corev1.ProtocolTCP,
}
View Source
var MetricsPort = corev1.ContainerPort{
	Name:          "tcp-metrics",
	ContainerPort: 9094,
	Protocol:      corev1.ProtocolTCP,
}

Functions

func IsManaged

func IsManaged(object metav1.Object) bool

func MakeFunctionComponent

func MakeFunctionComponent(functionName string, mesh *v1alpha1.FunctionMesh,
	spec *v1alpha1.FunctionSpec) *v1alpha1.Function

func MakeFunctionContainer

func MakeFunctionContainer(function *v1alpha1.Function) *corev1.Container

func MakeFunctionHPA

func MakeFunctionHPA(function *v1alpha1.Function) *autov2beta2.HorizontalPodAutoscaler

func MakeFunctionObjectMeta

func MakeFunctionObjectMeta(function *v1alpha1.Function) *metav1.ObjectMeta

func MakeFunctionService

func MakeFunctionService(function *v1alpha1.Function) *corev1.Service

func MakeFunctionStatefulSet

func MakeFunctionStatefulSet(function *v1alpha1.Function) *appsv1.StatefulSet

func MakeGoFunctionCommand

func MakeGoFunctionCommand(downloadPath, goExecFilePath string, function *v1alpha1.Function) []string

func MakeHeadlessServiceName

func MakeHeadlessServiceName(serviceName string) string

MakeHeadlessServiceName changes the name of service to headless style

func MakeJavaFunctionCommand

func MakeJavaFunctionCommand(downloadPath, packageFile, name, clusterName, generateLogConfigCommand, logLevel, details, memory, extraDependenciesDir, uid string,
	authProvided, tlsProvided bool, secretMaps map[string]v1alpha1.SecretRef, state *v1alpha1.Stateful, tlsConfig TLSConfig) []string

func MakeMetricsFromBuiltinHPARules

func MakeMetricsFromBuiltinHPARules(builtinRules []v1alpha1.BuiltinHPARule) []autov2beta2.MetricSpec

func MakePodTemplate

func MakePodTemplate(container *corev1.Container, volumes []corev1.Volume,
	labels map[string]string, policy v1alpha1.PodPolicy) *corev1.PodTemplateSpec

func MakePythonFunctionCommand

func MakePythonFunctionCommand(downloadPath, packageFile, name, clusterName, generateLogConfigCommand, details, uid string,
	authProvided, tlsProvided bool, secretMaps map[string]v1alpha1.SecretRef, state *v1alpha1.Stateful, tlsConfig TLSConfig) []string

func MakeService

func MakeService(objectMeta *metav1.ObjectMeta, labels map[string]string) *corev1.Service

func MakeSinkCommand

func MakeSinkCommand(sink *v1alpha1.Sink) []string

func MakeSinkComponent

func MakeSinkComponent(sinkName string, mesh *v1alpha1.FunctionMesh, spec *v1alpha1.SinkSpec) *v1alpha1.Sink

func MakeSinkContainer

func MakeSinkContainer(sink *v1alpha1.Sink) *corev1.Container

func MakeSinkLabels

func MakeSinkLabels(sink *v1alpha1.Sink) map[string]string

func MakeSinkObjectMeta

func MakeSinkObjectMeta(sink *v1alpha1.Sink) *metav1.ObjectMeta

func MakeSinkService

func MakeSinkService(sink *v1alpha1.Sink) *corev1.Service

func MakeSinkServiceName

func MakeSinkServiceName(sink *v1alpha1.Sink) string

func MakeSinkStatefulSet

func MakeSinkStatefulSet(sink *v1alpha1.Sink) *appsv1.StatefulSet

func MakeSourceComponent

func MakeSourceComponent(sourceName string, mesh *v1alpha1.FunctionMesh, spec *v1alpha1.SourceSpec) *v1alpha1.Source

func MakeSourceContainer

func MakeSourceContainer(source *v1alpha1.Source) *corev1.Container

func MakeSourceObjectMeta

func MakeSourceObjectMeta(source *v1alpha1.Source) *metav1.ObjectMeta

func MakeSourceService

func MakeSourceService(source *v1alpha1.Source) *corev1.Service

func MakeSourceStatefulSet

func MakeSourceStatefulSet(source *v1alpha1.Source) *appsv1.StatefulSet

func MakeStatefulSet

func MakeStatefulSet(objectMeta *metav1.ObjectMeta, replicas *int32, container *corev1.Container,
	volumes []corev1.Volume, labels map[string]string, policy v1alpha1.PodPolicy) *appsv1.StatefulSet

func MakeStatefulSetSpec

func MakeStatefulSetSpec(replicas *int32, container *corev1.Container,
	volumes []corev1.Volume, labels map[string]string, policy v1alpha1.PodPolicy,
	serviceName string) *appsv1.StatefulSetSpec

func ParseControllerConfigs

func ParseControllerConfigs(configFilePath string) error

Types

type BuiltinAutoScaler

type BuiltinAutoScaler interface {
	Metrics() []autov2beta2.MetricSpec
}

func GetBuiltinAutoScaler

func GetBuiltinAutoScaler(builtinRule v1alpha1.BuiltinHPARule) BuiltinAutoScaler

func NewHPARuleAverageUtilizationCPUPercent

func NewHPARuleAverageUtilizationCPUPercent(cpuPercentage int32) BuiltinAutoScaler

func NewHPARuleAverageUtilizationMemoryPercent

func NewHPARuleAverageUtilizationMemoryPercent(memoryPercentage int32) BuiltinAutoScaler

type ControllerConfigs

type ControllerConfigs struct {
	RunnerImages        RunnerImages      `yaml:"runnerImages,omitempty"`
	ResourceLabels      map[string]string `yaml:"resourceLabels,omitempty"`
	ResourceAnnotations map[string]string `yaml:"resourceAnnotations,omitempty"`
}

func DefaultConfigs

func DefaultConfigs() *ControllerConfigs

type GoFunctionConf

type GoFunctionConf struct {
	PulsarServiceURL string        `json:"pulsarServiceURL" yaml:"pulsarServiceURL"`
	InstanceID       int           `json:"instanceID" yaml:"instanceID"`
	FuncID           string        `json:"funcID" yaml:"funcID"`
	FuncVersion      string        `json:"funcVersion" yaml:"funcVersion"`
	MaxBufTuples     int           `json:"maxBufTuples" yaml:"maxBufTuples"`
	Port             int           `json:"port" yaml:"port"`
	ClusterName      string        `json:"clusterName" yaml:"clusterName"`
	KillAfterIdle    time.Duration `json:"killAfterIdleMs" yaml:"killAfterIdleMs"`
	// function details config
	Tenant               string `json:"tenant" yaml:"tenant"`
	NameSpace            string `json:"nameSpace" yaml:"nameSpace"`
	Name                 string `json:"name" yaml:"name"`
	LogTopic             string `json:"logTopic" yaml:"logTopic"`
	ProcessingGuarantees int32  `json:"processingGuarantees" yaml:"processingGuarantees"`
	SecretsMap           string `json:"secretsMap" yaml:"secretsMap"`
	Runtime              int32  `json:"runtime" yaml:"runtime"`
	AutoACK              bool   `json:"autoAck" yaml:"autoAck"`
	Parallelism          int32  `json:"parallelism" yaml:"parallelism"`
	//source config
	SubscriptionType    int32  `json:"subscriptionType" yaml:"subscriptionType"`
	TimeoutMs           uint64 `json:"timeoutMs" yaml:"timeoutMs"`
	SubscriptionName    string `json:"subscriptionName" yaml:"subscriptionName"`
	CleanupSubscription bool   `json:"cleanupSubscription"  yaml:"cleanupSubscription"`
	//source input specs
	SourceSpecTopic            string `json:"sourceSpecsTopic" yaml:"sourceSpecsTopic"`
	SourceSchemaType           string `json:"sourceSchemaType" yaml:"sourceSchemaType"`
	IsRegexPatternSubscription bool   `json:"isRegexPatternSubscription" yaml:"isRegexPatternSubscription"`
	ReceiverQueueSize          int32  `json:"receiverQueueSize" yaml:"receiverQueueSize"`
	//sink spec config
	SinkSpecTopic  string `json:"sinkSpecsTopic" yaml:"sinkSpecsTopic"`
	SinkSchemaType string `json:"sinkSchemaType" yaml:"sinkSchemaType"`
	//resources config
	CPU  float64 `json:"cpu" yaml:"cpu"`
	RAM  int64   `json:"ram" yaml:"ram"`
	Disk int64   `json:"disk" yaml:"disk"`
	//retryDetails config
	MaxMessageRetries           int32  `json:"maxMessageRetries" yaml:"maxMessageRetries"`
	DeadLetterTopic             string `json:"deadLetterTopic" yaml:"deadLetterTopic"`
	ExpectedHealthCheckInterval int32  `json:"expectedHealthCheckInterval" yaml:"expectedHealthCheckInterval"`
	UserConfig                  string `json:"userConfig" yaml:"userConfig"`
	//metrics config
	MetricsPort int `json:"metricsPort" yaml:"metricsPort"`
}

type HPARuleAverageUtilizationCPUPercent

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

func (*HPARuleAverageUtilizationCPUPercent) Metrics

type HPARuleAverageUtilizationResourceMemoryPercent

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

func (*HPARuleAverageUtilizationResourceMemoryPercent) Metrics

type RunnerImages

type RunnerImages struct {
	Java   string `yaml:"java,omitempty"`
	Python string `yaml:"python,omitempty"`
	Go     string `yaml:"go,omitempty"`
}

type TLSConfig added in v0.4.0

type TLSConfig interface {
	IsEnabled() bool
	AllowInsecureConnection() string
	EnableHostnameVerification() string
	SecretName() string
	SecretKey() string
	HasSecretVolume() bool
	GetMountPath() string
}

Jump to

Keyboard shortcuts

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