Documentation
¶
Index ¶
- Constants
- func EnsemblerTable(ensembler EnsemblerLike) func(tx *gorm.DB) *gorm.DB
- type Alert
- type AutoscalingMetric
- type AutoscalingPolicy
- type BigQueryConfig
- type DefaultTrafficRule
- type Enricher
- type Ensembler
- type EnsemblerDockerConfig
- type EnsemblerLike
- type EnsemblerPyfuncConfig
- type EnsemblerRunnerType
- type EnsemblerStandardConfig
- type EnsemblerType
- type EnsemblingJob
- type EnvVar
- type EnvVars
- type Event
- type EventStage
- type EventType
- type ExperimentEngine
- type ExperimentMapping
- type GenericEnsembler
- func (e *GenericEnsembler) GetName() string
- func (e *GenericEnsembler) GetProjectID() ID
- func (e *GenericEnsembler) GetType() EnsemblerType
- func (e *GenericEnsembler) Instance() EnsemblerLike
- func (e *GenericEnsembler) Patch(other EnsemblerLike) error
- func (e *GenericEnsembler) SetProjectID(id ID)
- func (*GenericEnsembler) TableName() string
- type ID
- type InfraConfig
- type JobConfig
- type KafkaConfig
- type LogConfig
- type Metric
- type Model
- type PyFuncEnsembler
- type ResourceRequest
- type ResultLogger
- type Route
- type Router
- type RouterResponse
- type RouterStatus
- type RouterVersion
- type RouterVersionStatus
- type Routes
- type Secret
- type Secrets
- type SerializationFormat
- type Status
- type TrafficRule
- type TrafficRules
Constants ¶
const (
ExperimentEngineTypeNop string = "nop"
)
Variables ¶
This section is empty.
Functions ¶
func EnsemblerTable ¶
func EnsemblerTable(ensembler EnsemblerLike) func(tx *gorm.DB) *gorm.DB
Types ¶
type Alert ¶
type Alert struct {
Model
Environment string `json:"environment" validate:"required"`
Team string `json:"team" validate:"required"`
Service string `json:"service"`
Metric Metric `json:"metric" validate:"oneof=throughput latency95p error_rate cpu_util memory_util"`
WarningThreshold float64 `json:"warning_threshold"`
CriticalThreshold float64 `json:"critical_threshold"`
// Duration to wait after the threshold is violated before firing the alert.
// The duration format is a sequence of decimal numbers followed by a time unit suffix.
// For instance: 5m
Duration string `json:"duration" validate:"required"`
}
Alert contains policy that determines the "type of notification" and the "metric condition" that will trigger notifications for a particular service.
There are 5 provided metrics that can be used as conditions for triggering the alert:
- throughput: when current request per second is lower than the threshold - latency95p: when the 95-th percentile millisecond latency is higher than the threshold - error_rate: when the error percentage of all requests is higher than the threshold - cpu_util: when the percentage of cpu utilization is higher than the threshold - memory_util: when the percentage of memory utilization is higher than the threshold
There are "warning" and "critical" thresholds that can be specified. A value of 0 or less will deactivate that particular type of alert. "warning" and "critical" will usually send alerts to different notifications channels.
Environment, Team, Service, Metric and Duration are required in order to generate the correct query for the metric values and to direct the alert to the correct recipients.
func (Alert) Group ¶
func (alert Alert) Group(playbookURL string, dashboardURL string) schema.AlertGroup
Group creates an AlertGroup from the Alert specification. An alert group follows the alerting rule format in prometheus: https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
type AutoscalingMetric ¶
type AutoscalingMetric string
const ( AutoscalingMetricConcurrency AutoscalingMetric = "concurrency" AutoscalingMetricRPS AutoscalingMetric = "rps" AutoscalingMetricCPU AutoscalingMetric = "cpu" AutoscalingMetricMemory AutoscalingMetric = "memory" )
type AutoscalingPolicy ¶
type AutoscalingPolicy struct {
Metric AutoscalingMetric `json:"metric" validate:"required,oneof=concurrency rps cpu memory"`
// Target is the target value of the metric that should be reached to add a new replica.
// It is expected that the autoscaling target is an absolute value for concurrency / rps
// while it is a % value (of the requested value) for cpu / memory.
// The 'numeric' type is used to allow decimals in strings to be set as the target value,
// e.g. "8.88". See https://github.com/go-playground/validator/issues/940 for more details.
Target string `json:"target" validate:"required,numeric"`
}
func (*AutoscalingPolicy) Scan ¶
func (a *AutoscalingPolicy) Scan(value interface{}) error
type BigQueryConfig ¶
type BigQueryConfig struct {
// BigQuery table to write to, as a fully qualified BQ Table string.
// e.g. project.dataset.table
Table string `json:"table"`
// Service account secret name (correct to merlin) for writing to BQ.
ServiceAccountSecret string `json:"service_account_secret"`
// Whether to perform batch or streaming writes.
BatchLoad bool `json:"batch_load"`
}
BigQueryConfig contains the configuration to log results to BigQuery.
type DefaultTrafficRule ¶
type DefaultTrafficRule struct {
Routes []string `json:"routes" validate:"required,notBlank"`
}
func (*DefaultTrafficRule) Scan ¶
func (r *DefaultTrafficRule) Scan(value interface{}) error
type Enricher ¶
type Enricher struct {
Model
// Fully qualified docker image string used by the enricher, in the
// format registry/repository:version.
Image string `json:"image"`
// Resource requests for the deployment of the enricher.
ResourceRequest *ResourceRequest `json:"resource_request"`
// Autoscaling policy for the enricher
AutoscalingPolicy *AutoscalingPolicy `json:"autoscaling_policy" validate:"omitempty,dive"`
// Endpoint to query.
Endpoint string `json:"endpoint"`
// Request timeout as a valid quantity string.
Timeout string `json:"timeout"`
// Port to query.
Port int `json:"port"`
// MLP secrets to inject into the pod.
Secrets Secrets `json:"secrets"`
// Environment variables to inject into the pod.
Env EnvVars `json:"env"`
// (optional) ServiceAccount specifies the name of the secret registered in the MLP project containing the service
// account. The service account will be mounted into the container and the env variable
// GOOGLE_APPLICATION_CREDENTIALS will point to the service account file.
ServiceAccount string `json:"service_account"`
}
Enricher contains the configuration for a preprocessor for a Turing Router.
type Ensembler ¶
type Ensembler struct {
Model
Type EnsemblerType `json:"type" validate:"required"`
StandardConfig *EnsemblerStandardConfig `json:"standard_config"` // Ensembler config when Type is "standard"
DockerConfig *EnsemblerDockerConfig `json:"docker_config"` // Ensembler config when Type is "docker"
PyfuncConfig *EnsemblerPyfuncConfig `json:"pyfunc_config"` // Ensembler config when Type is "pyfunc"
}
Ensembler contains the configuration for a post-processor for a Turing Router.
func (*Ensembler) TableName ¶
TableName returns the name of a table, where GORM should store/retrieve entities of this type. By default GORM uses the table name, that is a plural form of the type's name (i.e `Ensembler` -> `ensemblers`), and by implementing `TableName` method it is possible to override it.
type EnsemblerDockerConfig ¶
type EnsemblerDockerConfig struct {
Image string `json:"image" validate:"required"`
// Resource requests for ensembler container deployed
ResourceRequest *ResourceRequest `json:"resource_request" validate:"required"`
// Autoscaling policy for the ensembler
AutoscalingPolicy *AutoscalingPolicy `json:"autoscaling_policy" validate:"omitempty,dive"`
// URL path for the endpoint, e.g "/"
Endpoint string `json:"endpoint" validate:"required"`
// Request timeout in duration format e.g. 60s
Timeout string `json:"timeout" validate:"required"`
// Port number the container listens to for requests
Port int `json:"port" validate:"required"`
// MLP secrets to inject into the container
Secrets Secrets `json:"secrets" validate:"required"`
// Environment variables to set in the container
Env EnvVars `json:"env" validate:"required"`
// secret name in MLP containing service account key
ServiceAccount string `json:"service_account"`
}
func (*EnsemblerDockerConfig) Scan ¶
func (c *EnsemblerDockerConfig) Scan(value interface{}) error
Scan implements sql.Scanner interface so database tools like go-orm knows how to de-serialize the struct object from the database
type EnsemblerLike ¶
type EnsemblerPyfuncConfig ¶
type EnsemblerPyfuncConfig struct {
ProjectID *ID `json:"project_id" validate:"required"`
EnsemblerID *ID `json:"ensembler_id" validate:"required"`
// Resource requests for ensembler container deployed
ResourceRequest *ResourceRequest `json:"resource_request" validate:"required"`
// Autoscaling policy for the ensembler
AutoscalingPolicy *AutoscalingPolicy `json:"autoscaling_policy" validate:"omitempty,dive"`
// Request timeout in duration format e.g. 60s
Timeout string `json:"timeout" validate:"required"`
// MLP secrets to inject into the container
Secrets Secrets `json:"secrets" validate:"required"`
// Environment variables to set in the container
Env EnvVars `json:"env" validate:"required"`
}
func (*EnsemblerPyfuncConfig) Scan ¶
func (c *EnsemblerPyfuncConfig) Scan(value interface{}) error
Scan implements sql.Scanner interface so database tools like go-orm knows how to de-serialize the struct object from the database
type EnsemblerRunnerType ¶
type EnsemblerRunnerType string
const ( EnsemblerRunnerTypeJob EnsemblerRunnerType = "job" EnsemblerRunnerTypeService EnsemblerRunnerType = "service" )
type EnsemblerStandardConfig ¶
type EnsemblerStandardConfig struct {
// LazyRouting dictates whether the routes should be called lazily, based on the results
// of the experiment engine. If true, the experiment engine will be called first and only
// the selected route will be invoked - this is more cost efficient. If false, the routing
// will be executed in parallel with the call to the experiment engine and therefore, faster
// e2e execution time.
LazyRouting bool `json:"lazy_routing"`
ExperimentMappings []ExperimentMapping `json:"experiment_mappings" validate:"dive"`
RouteNamePath string `json:"route_name_path"`
}
func (*EnsemblerStandardConfig) Scan ¶
func (c *EnsemblerStandardConfig) Scan(value interface{}) error
Scan implements sql.Scanner interface so database tools like go-orm knows how to de-serialize the struct object from the database
type EnsemblerType ¶
type EnsemblerType string
const ( EnsemblerStandardType EnsemblerType = "standard" EnsemblerDockerType EnsemblerType = "docker" EnsemblerPyFuncType EnsemblerType = "pyfunc" )
type EnsemblingJob ¶
type EnsemblingJob struct {
Model
Name string `json:"name"`
EnsemblerID ID `json:"ensembler_id" validate:"required"`
ProjectID ID `json:"project_id"`
EnvironmentName string `json:"environment_name"`
InfraConfig *InfraConfig `json:"infra_config" validate:"required"`
JobConfig *JobConfig `json:"job_config" validate:"required"`
RetryCount int `json:"-" gorm:"default:0"`
Status Status `json:"status" gorm:"default:pending"`
Error string `json:"error"`
MonitoringURL string `json:"monitoring_url" gorm:"-"`
RunID int `json:"-"`
}
EnsemblingJob holds the information required for an ensembling job to be done asynchronously
func (*EnsemblingJob) BeforeCreate ¶
func (job *EnsemblingJob) BeforeCreate(tx *gorm.DB) error
BeforeCreate sets the ensembling job name and run_id before creating
type EnvVar ¶
type EnvVar struct {
// Name of the environment variable.
Name string `json:"name"`
// Value of the environment variable.
// Defaults to "".
Value string `json:"value"`
}
EnvVar represents an environment variable present in a container.
type EnvVars ¶
type EnvVars []*EnvVar
EnvVars is a list of environment variables to set in the container.
func (EnvVars) ToKubernetesEnvVars ¶
ToKubernetesEnvVars returns the representation of Kubernetes' v1.EnvVars.
type Event ¶
type Event struct {
Model
// Router id this event is for
RouterID ID `json:"-"`
Router *Router `json:"-"`
// Version of router that triggered this deployment event.
// May not necessarily pertain to the resource described by the event,
// e.g. for removal of old versions, version will point to the new version
// that triggered the event.
Version uint `json:"version"`
// EventType type of event
EventType EventType `json:"event_type"`
// Stage of deployment/undeployment
Stage EventStage `json:"stage"`
// Message describing the event
Message string `json:"message"`
}
Event is a log of an event taking place during deployment or undeployment of a router.
func NewErrorEvent ¶
func NewErrorEvent(stage EventStage, message string, args ...interface{}) *Event
NewErrorEvent creates a new error event
func NewInfoEvent ¶
func NewInfoEvent(stage EventStage, message string, args ...interface{}) *Event
NewInfoEvent creates a new info event
func (*Event) SetVersion ¶
type EventStage ¶
type EventStage string
const ( EventStageDeployingDependencies EventStage = "deploying dependencies" EventStageDeployingServices EventStage = "deploying services" EventStageDeploymentSuccess EventStage = "deployment success" EventStageDeploymentFailed EventStage = "deployment failed" EventStageRollback EventStage = "rollback deployment" EventStageUpdatingEndpoint EventStage = "updating endpoint" EventStageUndeployingPreviousVersion EventStage = "undeploying previous version" EventStageDeletingDependencies EventStage = "deleting dependencies" EventStageUndeployingServices EventStage = "undeploying services" EventStageDeletingEndpoint EventStage = "deleting endpoint" EventStageUndeploymentFailed EventStage = "undeployment failed" EventStageUndeploymentSuccess EventStage = "undeployment success" )
type ExperimentEngine ¶
type ExperimentEngine struct {
// Type of Experiment Engine
Type string `json:"type"`
// PluginConfig (Optional) contains necessary configuration, if experiment engine
// is implemented as RPC plugin
PluginConfig *config.ExperimentEnginePluginConfig `json:"plugin_config,omitempty"`
// ServiceAccount contains the service account file path that points to the service account
// key that the experiment engine may require
ServiceAccountKeyFilePath *string `json:"service_account_key_file_path,omitempty"`
// Config contains the configs for the selected experiment engine (other than "nop").
// For standard experiment engine managers, the config can be unmarshalled into
// manager.TuringExperimentConfig type.
Config json.RawMessage `json:"config,omitempty"`
}
ExperimentEngine contains the type and configuration for the Experiment engine powering the router.
func (*ExperimentEngine) Scan ¶
func (eec *ExperimentEngine) Scan(value interface{}) error
type ExperimentMapping ¶
type ExperimentMapping struct {
Experiment string `json:"experiment" validate:"required"` // Experiment name from the experiment engine
Treatment string `json:"treatment" validate:"required"` // Treatment name for the experiment
Route string `json:"route" validate:"required"` // Route ID to select for the experiment treatment
}
type GenericEnsembler ¶
type GenericEnsembler struct {
Model
// ProjectID id of the project this ensembler belongs to,
// as retrieved from the MLP API.
ProjectID ID `json:"project_id" gorm:"column:project_id"`
Type EnsemblerType `json:"type" gorm:"column:type" validate:"required,oneof=pyfunc"`
Name string `json:"name" gorm:"column:name" validate:"required,hostname_rfc1123,lte=20,gte=3"`
}
func (*GenericEnsembler) GetName ¶
func (e *GenericEnsembler) GetName() string
func (*GenericEnsembler) GetProjectID ¶
func (e *GenericEnsembler) GetProjectID() ID
func (*GenericEnsembler) GetType ¶
func (e *GenericEnsembler) GetType() EnsemblerType
func (*GenericEnsembler) Instance ¶
func (e *GenericEnsembler) Instance() EnsemblerLike
func (*GenericEnsembler) Patch ¶
func (e *GenericEnsembler) Patch(other EnsemblerLike) error
func (*GenericEnsembler) SetProjectID ¶
func (e *GenericEnsembler) SetProjectID(id ID)
func (*GenericEnsembler) TableName ¶
func (*GenericEnsembler) TableName() string
type InfraConfig ¶
type InfraConfig struct {
openapi.EnsemblerInfraConfig
}
InfraConfig stores the infrastructure related configurations required.
func (*InfraConfig) Scan ¶
func (r *InfraConfig) Scan(value interface{}) error
Scan scans value into Jsonb, implements sql.Scanner interface
type JobConfig ¶
type JobConfig openapi.EnsemblerConfig
JobConfig stores the infra and ensembler config
type KafkaConfig ¶
type KafkaConfig struct {
// List of brokers for the kafka to write logs to
Brokers string `json:"brokers"`
// Topic to write logs to
Topic string `json:"topic"`
// Serialization Format used for the messages
SerializationFormat SerializationFormat `json:"serialization_format"`
}
KafkaConfig contains the configuration to log results to Kafka.
type LogConfig ¶
type LogConfig struct {
// LogLevel of the router.
LogLevel routerConfig.LogLevel `json:"log_level"`
// Enable custom metrics for the router. Defaults to false.
CustomMetricsEnabled bool `json:"custom_metrics_enabled"`
// Enable debug logs for Fiber. Defaults to false.
FiberDebugLogEnabled bool `json:"fiber_debug_log_enabled"`
// Enable Jaeger tracing.
JaegerEnabled bool `json:"jaeger_enabled"`
// Result Logger type. The associated config must not be null.
ResultLoggerType ResultLogger `json:"result_logger_type"`
// Configuration necessary to log results to BigQuery. Cannot be empty if
// ResultLoggerType is set to "bigquery".
BigQueryConfig *BigQueryConfig `json:"bigquery_config,omitempty"`
// Configuration necessary to log results to kafka. Cannot be empty if
// ResultLoggerType is set to "kafka"
KafkaConfig *KafkaConfig `json:"kafka_config,omitempty"`
}
LogConfig contains all log configuration necessary for a deployment of the Turing Router.
type Model ¶
type Model struct {
// Id of the entity
ID ID `json:"id"`
// Created timestamp. Populated when the object is saved to the db.
CreatedAt time.Time `json:"created_at"`
// Last updated timestamp. Updated when the object is updated in the db.
UpdatedAt time.Time `json:"updated_at"`
}
Model is a struct containing the basic fields for a persisted entity defined in the API.
func (Model) GetCreatedAt ¶
func (Model) GetUpdatedAt ¶
func (Model) IsNew ¶
IsNew tells us if the record is new. This is determined by comparing the value of ID, which is the primary key. If 0, the record does not already exist in the DB. See: https://github.com/go-gorm/gorm/issues/3400
type PyFuncEnsembler ¶
type PyFuncEnsembler struct {
*GenericEnsembler
MlflowURL string `json:"mlflow_url" gorm:"-"`
ExperimentID ID `json:"mlflow_experiment_id" gorm:"column:mlflow_experiment_id"`
RunID string `json:"mlflow_run_id" gorm:"column:mlflow_run_id"`
ArtifactURI string `json:"artifact_uri" gorm:"column:artifact_uri"`
PythonVersion string `json:"python_version" gorm:"column:python_version"`
}
func (*PyFuncEnsembler) BeforeCreate ¶
func (e *PyFuncEnsembler) BeforeCreate(*gorm.DB) error
func (*PyFuncEnsembler) GetType ¶
func (*PyFuncEnsembler) GetType() EnsemblerType
func (*PyFuncEnsembler) Patch ¶
func (e *PyFuncEnsembler) Patch(other EnsemblerLike) error
type ResourceRequest ¶
type ResourceRequest struct {
// Minimum number of replica of inference service
MinReplica int `json:"min_replica"`
// Maximum number of replica of inference service
MaxReplica int `json:"max_replica"`
// CPU request of inference service
CPURequest resource.Quantity `json:"cpu_request"`
// CPU limit of inference service
CPULimit *resource.Quantity `json:"cpu_limit,omitempty"`
// Memory request of inference service
MemoryRequest resource.Quantity `json:"memory_request"`
}
func (*ResourceRequest) Scan ¶
func (r *ResourceRequest) Scan(value interface{}) error
type ResultLogger ¶
type ResultLogger string
ResultLogger is the type used to capture the supported response logging destinations
const ( // BigQueryLogger logs the responses to BigQuery BigQueryLogger ResultLogger = "bigquery" // UPILogger logs the responses to predefined kafka broker with upi router_log schema UPILogger ResultLogger = "upi" // KafkaLogger logs the responses to kafka KafkaLogger ResultLogger = "kafka" // NopLogger disables response logging NopLogger ResultLogger = "nop" )
type Route ¶
type Route struct {
// ID of the route
ID string `json:"id"`
// Type of the route
Type string `json:"type"`
// Endpoint to query
Endpoint string `json:"endpoint"`
// Annotations (optional) holds extra information about the route
Annotations map[string]string `json:"annotations"`
// Request timeout as a valid quantity string.
Timeout string `json:"timeout"`
// Grpc ServiceMethod name
ServiceMethod string `json:"service_method,omitempty"`
}
Route maps onto the fiber.Component.
type Router ¶
type Router struct {
Model
// Project id of the project this router belongs to, as retrieved from
// the MLP API.
ProjectID ID `json:"project_id"`
// Environment name of the environment this router belongs to, as retrieved
// from the MLP API.
EnvironmentName string `json:"environment_name"`
// Name of the router. Must be unique within the given project and environment.
Name string `json:"name"`
// Status of the Router. Indicates the deployment status of the router.
Status RouterStatus `json:"status"`
// Endpoint URL where the currently deployed router version is accessible at
Endpoint string `json:"endpoint,omitempty"`
// The current version (may be deployed or undeployed)
CurrRouterVersionID sql.NullInt32 `json:"-"`
CurrRouterVersion *RouterVersion `json:"config,omitempty" gorm:"foreignkey:CurrRouterVersionID"`
// MonitoringURL is for all router versions
MonitoringURL string `json:"monitoring_url" gorm:"-"`
}
Router holds the information as to which versions of Router have been deployed, and acts as the top level object for an instance of the Turing Router.
func (*Router) ClearCurrRouterVersion ¶
func (r *Router) ClearCurrRouterVersion()
ClearCurrRouterVersion clears the current version for this router.
func (*Router) ClearCurrRouterVersionID ¶
func (r *Router) ClearCurrRouterVersionID()
func (*Router) MarshalJSON ¶
MarshalJSON is a custom marshaling function for the Router, to manipulate the endpoint.
func (*Router) SetCurrRouterVersion ¶
func (r *Router) SetCurrRouterVersion(routerVersion *RouterVersion)
SetCurrRouterVersion sets the currently version for this router to the provided routerVersion.
func (*Router) SetCurrRouterVersionID ¶
type RouterResponse ¶
type RouterResponse Router
RouterResponse is an alias for the Router, to enable custom marshaling
type RouterStatus ¶
type RouterStatus string
const ( RouterStatusPending RouterStatus = "pending" RouterStatusFailed RouterStatus = "failed" RouterStatusDeployed RouterStatus = "deployed" RouterStatusUndeployed RouterStatus = "undeployed" )
type RouterVersion ¶
type RouterVersion struct {
Model
// Router this RouterVersion is associated with.
RouterID ID `json:"-"`
Router *Router `json:"router" gorm:"association_autoupdate:false"`
// Version of Router configuration.
Version uint `json:"version"`
// Status of the RouterVersion. Indicates the deployment status of the configuration.
Status RouterVersionStatus `json:"status"`
// Last known error if the status is error
Error string `json:"error,omitempty"`
// Image of the router deployed
Image string `json:"image"`
// Downstream endpoints for the router
Routes Routes `json:"routes"`
// Default route
DefaultRouteID string `json:"default_route_id"`
// Default fallback rule for activating some routes with no request conditions.
DefaultTrafficRule *DefaultTrafficRule `json:"default_traffic_rule,omitempty"`
// Rules for activating some routes based on request conditions.
TrafficRules TrafficRules `json:"rules,omitempty"`
// Configuration for the experiment engine queried by the router.
ExperimentEngine *ExperimentEngine `json:"experiment_engine"`
// Resource requests for deployment
ResourceRequest *ResourceRequest `json:"resource_request"`
// Autoscaling policy for the deployment
AutoscalingPolicy *AutoscalingPolicy `json:"autoscaling_policy"`
// Request timeout as a valid quantity string
Timeout string `json:"timeout"`
// Router transport protocol
Protocol routerConfig.Protocol `json:"protocol"`
// Logging configuration for the router
LogConfig *LogConfig `json:"log_config"`
// The enricher used by the router
EnricherID sql.NullInt32 `json:"-"`
Enricher *Enricher `json:"enricher,omitempty"`
// The ensembler used by the router
EnsemblerID sql.NullInt32 `json:"-"`
Ensembler *Ensembler `json:"ensembler,omitempty"`
// Monitoring URL used in the monitoring tab
MonitoringURL string `json:"monitoring_url" gorm:"-"`
}
RouterVersion contains the configuration of a version of a router. Every change in configuration should always result in a new instance of RouterVersion.
func (*RouterVersion) BeforeCreate ¶
func (r *RouterVersion) BeforeCreate(tx *gorm.DB) error
BeforeCreate Sets version before creating
func (*RouterVersion) HasDockerConfig ¶
func (r *RouterVersion) HasDockerConfig() bool
func (*RouterVersion) SetEnricherID ¶
func (r *RouterVersion) SetEnricherID(enricherID ID)
SetEnricherID Sets the id of the associated Enricher
func (*RouterVersion) SetEnsemblerID ¶
func (r *RouterVersion) SetEnsemblerID(ensemblerID ID)
SetEnsemblerID Sets the id of the associated Ensembler
type RouterVersionStatus ¶
type RouterVersionStatus string
const ( RouterVersionStatusPending RouterVersionStatus = "pending" RouterVersionStatusFailed RouterVersionStatus = "failed" RouterVersionStatusDeployed RouterVersionStatus = "deployed" RouterVersionStatusUndeployed RouterVersionStatus = "undeployed" )
type Routes ¶
type Routes []*Route
func (*Routes) ToFiberRoutes ¶
func (r *Routes) ToFiberRoutes(protocol fiberProtocol.Protocol) (*fiberConfig.Routes, error)
ToFiberRoutes converts routes to a type compatible with Fiber's config
type Secret ¶
type Secret struct {
// Name of the secret as stored in MLP
MLPSecretName string `json:"mlp_secret_name"`
// Name of the environment variable when the secret is mounted
EnvVarName string `json:"env_var_name"`
}
Secret represents an MLP secret present in a container that is mounted as an environment variable
type Secrets ¶
type Secrets []Secret
Secret is a list of MLP secrets to set in the container.
func (Secrets) ToKubernetesEnvVars ¶
ToKubernetesEnvVars returns the representation of Kubernetes' v1.EnvVars.
type SerializationFormat ¶
type SerializationFormat string
SerializationFormat is the type used to capture the supported message serialization formats
const ( // JSONSerializationFormat formats the message as json, for logging JSONSerializationFormat SerializationFormat = "json" // ProtobufSerializationFormat formats the message using protobuf, for logging ProtobufSerializationFormat SerializationFormat = "protobuf" )
type Status ¶
type Status string
Status is the state of the finite machine ensembling job. Possible statuses: JobPending --▶ JobFailedSubmission
| | | |
JobBuildingImage --▶ JobFailedBuildImage
| | | | ▼
JobRunning --▶ JobFailed
| | |--▶ JobTerminating --▶ JobTerminated | | ▼
JobCompleted
const ( // JobPending is when the job has just been introduced. JobPending Status = "pending" // JobBuildingImage is when the job is builing a OCI image. JobBuildingImage Status = "building" // JobRunning is when the job has been picked up and running. JobRunning Status = "running" // JobTerminating is when the job has been requested to terminate. JobTerminating Status = "terminating" // JobTerminated is when the job has stopped. This is a terminal state. JobTerminated Status = "terminated" // JobCompleted is when the job has successfully completed. This is a terminal state. JobCompleted Status = "completed" // JobFailed is when the job has failed. This is a terminal state. JobFailed Status = "failed" // JobFailedSubmission is when the job has failed to submit. This is a terminal state. JobFailedSubmission Status = "failed_submission" // JobFailedBuildImage is when the job has failed to build an ensembling image. JobFailedBuildImage Status = "failed_building" )
func (Status) IsSuccessful ¶
IsSuccessful checks if the ensembling job has completed.
func (Status) IsTerminal ¶
IsTerminal checks if the job has reached a final state.
type TrafficRule ¶
type TrafficRule struct {
Name string `json:"name" validate:"required,notBlank"`
Conditions []*router.TrafficRuleCondition `json:"conditions" validate:"required,notBlank,dive"`
Routes []string `json:"routes" validate:"required,notBlank"`
}
type TrafficRules ¶
type TrafficRules []*TrafficRule
func (*TrafficRules) ConditionalRouteIDs ¶
func (r *TrafficRules) ConditionalRouteIDs() map[string]bool
func (*TrafficRules) Scan ¶
func (r *TrafficRules) Scan(value interface{}) error