v1

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeWorkflowTemplate         string = "workflow_template"
	TypeWorkflowTemplateVersion  string = "workflow_template_version"
	TypeWorkflowExecution        string = "workflow_execution"
	TypeCronWorkflow             string = "cron_workflow"
	TypeWorkspaceTemplate        string = "workspace_template"
	TypeWorkspaceTemplateVersion string = "workspace_template_version"
	TypeWorkspace                string = "workspace"
)
View Source
const WorkspaceDAGTemplateCreateStatefulSet = "create-stateful-set"

WorkspaceDAGTemplateCreateStatefulSet is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateCreateWorkspace = "create-workspace"

WorkspaceDAGTemplateCreateWorkspace is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateDeletePVC = "delete-pvc"

WorkspaceDAGTemplateDeletePVC is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateDeleteStatefulSet = "delete-stateful-set"

WorkspaceDAGTemplateDeleteStatefulSet is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateDeleteWorkspace = "delete-workspace"

WorkspaceDAGTemplateDeleteWorkspace is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateGetStatefulSet = "get-stateful-set"

WorkspaceDAGTemplateGetStatefulSet is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateService = "service"

WorkspaceDAGTemplateService is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateSysSetPhasePaused = "sys-set-phase-paused"

WorkspaceDAGTemplateSysSetPhasePaused is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateSysSetPhaseRunning = "sys-set-phase-running"

WorkspaceDAGTemplateSysSetPhaseRunning is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateSysSetPhaseTerminated = "sys-set-phase-terminated"

WorkspaceDAGTemplateSysSetPhaseTerminated is used inside the DAG creation for the workspace.

View Source
const WorkspaceDAGTemplateVirtualService = "virtual-service"

WorkspaceDAGTemplateVirtualService is used inside the DAG creation for the workspace.

View Source
const WorkspaceDeletePVCResource = "delete-pvc-resource"

WorkspaceDeletePVCResource is resource used in workspace template creation.

View Source
const WorkspaceDeleteStatefulSetResource = "delete-stateful-set-resource"

WorkspaceDeleteStatefulSetResource is resource used in workspace template creation.

View Source
const WorkspaceGetStatefulSetResource = "get-stateful-set-resource"

WorkspaceGetStatefulSetResource is resource used in workspace template creation.

View Source
const WorkspaceResource = "workspace-resource"

WorkspaceResource is resource used in workspace template creation.

View Source
const WorkspaceServiceResource = "service-resource"

WorkspaceServiceResource is resource used in workspace template creation.

View Source
const WorkspaceStatefulSetResource = "stateful-set-resource"

WorkspaceStatefulSetResource is resource used in workspace template creation.

View Source
const WorkspaceVirtualServiceResource = "virtual-service-resource"

WorkspaceVirtualServiceResource is resource used in workspace template creation.

Variables

This section is empty.

Functions

func ApplyLabelSelectQuery added in v0.13.0

func ApplyLabelSelectQuery(labelSelector string, sb sq.SelectBuilder, filter LabelFilter) (sq.SelectBuilder, error)

ApplyLabelSelectQuery returns a query builder that adds where statements to filter by labels in the filter, if there are any labelSelector is the database column that has the labels, such as "we.labels" for workflowExecutions aliased by "we".

func CronWorkflowsToIDs added in v0.11.0

func CronWorkflowsToIDs(resources []*CronWorkflow) (ids []uint64)

CronWorkflowsToIDs returns an array of ids from the input CronWorkflow with no duplicates.

func FilePathToExtension

func FilePathToExtension(path string) string

FilePathToExtension returns the file's extension if it uses a dot "." to denote it. otherwise it returns the text following the last dot in the path.

func FilePathToName

func FilePathToName(path string) string

FilePathToName returns the name of the file, assuming that "/" denote directories and that the file name is after the last "/"

func FilePathToParentPath

func FilePathToParentPath(path string) string

FilePathToParentPath given a path, returns the parent path, assuming a '/' delimiter Result does not have a trailing slash. -> a/b/c/d would return a/b/c -> a/b/c/d/ would return a/b/c If path is empty string, it is returned. If path is '/' (root) it is returned as is. If there is no '/', '/' is returned.

func GenerateWorkspaceUID added in v0.18.0

func GenerateWorkspaceUID(name string) (string, error)

GenerateWorkspaceUID creates a uid from a workspace name. The limit is 30 characters

func IsValidParameter added in v0.12.0

func IsValidParameter(parameter Parameter) error

IsValidParameter returns nil if the parameter is valid or an error otherwise

func IsValidParameters added in v0.12.0

func IsValidParameters(parameters []Parameter) error

IsValidParameters returns nil if all parameters are valid or an error otherwise

func LabelsToJSONString added in v0.12.0

func LabelsToJSONString(labels []*Label) (string, error)

LabelsToJSONString converts an array of labels to a json string representing an object where the keys are the label keys and the values are the label values

func LabelsToMapping

func LabelsToMapping(labels ...*Label) map[string]string

LabelsToMapping converts Label structs to a map of key:value

func MapParametersByName added in v0.12.0

func MapParametersByName(parameters []Parameter) map[string]Parameter

MapParametersByName returns a map where the parameter name is the key and the parameter is the value

func SelectLabels added in v0.15.0

func SelectLabels(query *SelectLabelsQuery) sq.SelectBuilder

SelectLabels returns a SelectBuilder that selects key, value columns from the criteria specified in query

func SkipKeysFromString added in v0.15.0

func SkipKeysFromString(keys string) []string

SkipKeysFromString parses keys encoded in a string and returns an array of keys The separator is ";"

func TypeToTableName

func TypeToTableName(value string) string

func UnmarshalWorkflows

func UnmarshalWorkflows(wfBytes []byte, strict bool) (wfs []wfv1.Workflow, err error)

func WorkflowTemplateVersionsToIDs added in v0.11.0

func WorkflowTemplateVersionsToIDs(resources []*WorkflowTemplateVersion) (ids []uint64)

WorkflowTemplateVersionsToIDs returns an array of ids from the input WorkflowTemplateVersion with no duplicates.

func WorkflowTemplatesToIds

func WorkflowTemplatesToIds(workflowTemplates []*WorkflowTemplate) (ids []uint64)

func WorkflowTemplatesToVersionIDs added in v0.11.0

func WorkflowTemplatesToVersionIDs(workflowTemplates []*WorkflowTemplate) (ids []uint64)

WorkflowTemplatesToVersionIDs picks out the WorkflowTemplateVersionID from each template and returns it as an array. Duplicates are removed.

func WorkspaceTemplatesToVersionIDs added in v0.11.0

func WorkspaceTemplatesToVersionIDs(resources []*WorkspaceTemplate) (ids []uint64)

WorkspaceTemplatesToVersionIDs plucks the WorkspaceTemplateVersionID from each template and returns it in an array No duplicates are included.

func WorkspacesToIDs added in v0.11.0

func WorkspacesToIDs(resources []*Workspace) (ids []uint64)

WorkspacesToIDs returns an array of ids from the input Workspaces with no duplicates.

Types

type Arguments

type Arguments struct {
	Parameters []Parameter `json:"parameters"`
}

Arguments are the arguments in a manifest file.

type ArtifactRepositoryGCSProvider added in v0.12.0

type ArtifactRepositoryGCSProvider struct {
	Source                  string
	KeyFormat               string `yaml:"keyFormat"`
	Bucket                  string
	Endpoint                string
	Insecure                bool
	ServiceAccountKey       string                   `yaml:"serviceAccountKey,omitempty"`
	ServiceAccountKeySecret ArtifactRepositorySecret `yaml:"serviceAccountKeySecret"`
	ServiceAccountJSON      string                   `yaml:"serviceAccountJSON,omitempty"`
}

ArtifactRepositoryGCSProvider is meant to be used by the CLI. CLI will marshal this struct into the correct YAML structure for k8s configmap / secret.

func (*ArtifactRepositoryGCSProvider) FormatKey added in v0.12.0

func (g *ArtifactRepositoryGCSProvider) FormatKey(namespace, workflowName, podName string) string

FormatKey replaces placeholder values with their actual values and returns this string. {{workflow.namespace}} -> namespace {{workflow.name}} -> workflowName {{pod.name}} -> podName

func (*ArtifactRepositoryGCSProvider) MarshalToYaml added in v0.12.0

func (g *ArtifactRepositoryGCSProvider) MarshalToYaml() (string, error)

MarshalToYaml is used by the CLI to generate configmaps during deployment or build operations.

type ArtifactRepositoryProvider added in v0.12.0

type ArtifactRepositoryProvider struct {
	S3  *ArtifactRepositoryS3Provider  `yaml:"s3,omitempty"`
	GCS *ArtifactRepositoryGCSProvider `yaml:"gcs,omitempty"`
}

ArtifactRepositoryProvider is used to setup access into AWS Cloud Storage or Google Cloud storage. - The relevant sub-struct (S3, GCS) is unmarshalled into from the cluster configmap. Right now, either the S3 or GCS struct will be filled in. Multiple cloud providers are not supported at the same time in params.yaml (manifests deployment).

type ArtifactRepositoryS3Provider added in v0.12.0

type ArtifactRepositoryS3Provider struct {
	Source          string
	KeyFormat       string `yaml:"keyFormat"`
	Bucket          string
	Endpoint        string
	PublicEndpoint  string `yaml:"publicEndpoint"`
	PublicInsecure  bool   `yaml:"publicInsecure"`
	Insecure        bool
	Region          string
	AccessKeySecret ArtifactRepositorySecret `yaml:"accessKeySecret"`
	SecretKeySecret ArtifactRepositorySecret `yaml:"secretKeySecret"`
	AccessKey       string                   `yaml:"accessKey,omitempty"`
	Secretkey       string                   `yaml:"secretKey,omitempty"`
}

ArtifactRepositoryS3Provider is meant to be used by the CLI. CLI will marshal this struct into the correct YAML structure for k8s configmap / secret.

func (*ArtifactRepositoryS3Provider) FormatKey added in v0.12.0

func (a *ArtifactRepositoryS3Provider) FormatKey(namespace, workflowName, podName string) string

FormatKey replaces placeholder values with their actual values and returns this string. {{workflow.namespace}} -> namespace {{workflow.name}} -> workflowName {{pod.name}} -> podName

func (*ArtifactRepositoryS3Provider) MarshalToYaml added in v0.12.0

func (a *ArtifactRepositoryS3Provider) MarshalToYaml() (string, error)

MarshalToYaml is used by the CLI to generate configmaps during deployment or build operations.

type ArtifactRepositorySecret added in v0.12.0

type ArtifactRepositorySecret struct {
	Key  string `yaml:"key"`
	Name string `yaml:"name"`
}

ArtifactRepositorySecret holds information about a kubernetes Secret. - The "key" is the specific key inside the Secret. - The "name" is the name of the Secret. Usually, this is used to figure out what secret to look into for a specific value.

type Client

type Client struct {
	Token string
	kubernetes.Interface

	*DB
	// contains filtered or unexported fields
}

func GetDefaultClient added in v0.14.0

func GetDefaultClient() (*Client, error)

GetDefaultClient loads a default k8s client

func GetDefaultClientWithDB added in v0.14.0

func GetDefaultClientWithDB(db *DB) (*Client, error)

GetDefaultClientWithDB loads a default k8s client with an existing DB

func NewClient

func NewClient(config *Config, db *DB, systemConfig SystemConfig) (client *Client, err error)

NewClient creates a client to interact with the Onepanel system. It includes access to the database, kubernetes, argo, and configuration.

func (*Client) AddLabels

func (c *Client) AddLabels(namespace, resource, uid string, keyValues map[string]string) error

func (*Client) AddSecretKeyValue

func (c *Client) AddSecretKeyValue(namespace string, secret *Secret) (inserted bool, err error)

func (*Client) AddWorkflowExecutionMetrics added in v0.16.0

func (c *Client) AddWorkflowExecutionMetrics(namespace, uid string, metrics Metrics, override bool) (workflowExecution *WorkflowExecution, err error)

AddWorkflowExecutionMetrics merges the metrics provided with the ones present in the workflow execution identified by (namespace, uid)

func (*Client) ArchiveCronWorkflow added in v0.8.0

func (c *Client) ArchiveCronWorkflow(namespace, uid string) (err error)

func (*Client) ArchiveWorkflowExecution added in v0.8.0

func (c *Client) ArchiveWorkflowExecution(namespace, uid string) error

ArchiveWorkflowExecution marks a WorkflowExecution as archived in database and deletes the argo workflow.

If the database record does not exist, we still try to delete the argo workflow record. No errors are returned if the records do not exist.

func (*Client) ArchiveWorkflowTemplate

func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool, err error)

ArchiveWorkflowTemplate will mark the workflow template identified by the (namespace, uid) as archived and will archive or delete resources where appropriate.

func (*Client) ArchiveWorkspace added in v0.10.0

func (c *Client) ArchiveWorkspace(namespace, uid string, parameters ...Parameter) (err error)

ArchiveWorkspace archives by setting the workspace to delete or terminate. Kicks off DB archiving and k8s cleaning.

func (*Client) ArchiveWorkspaceTemplate added in v0.8.0

func (c *Client) ArchiveWorkspaceTemplate(namespace string, uid string) (archived bool, err error)

ArchiveWorkspaceTemplate archives and deletes resources associated with the workspace template.

In particular, this action

* Archives each workspace (k8s cleaned-up, database entry marked archived)

* Marks associated Workflow template as archived

* Marks associated Workflow executions as archived

* Deletes Workflow Executions in k8s

func (*Client) ArgoprojV1alpha1

func (c *Client) ArgoprojV1alpha1() argoprojv1alpha1.ArgoprojV1alpha1Interface

func (*Client) ClearSystemConfigCache added in v0.11.0

func (c *Client) ClearSystemConfigCache()

ClearSystemConfigCache wipes out the cached system configuration so that the next call to GetSystemConfig will pull it from the resources

func (*Client) CloneWorkflowExecution

func (c *Client) CloneWorkflowExecution(namespace, uid string) (*WorkflowExecution, error)

func (*Client) CountCronWorkflows

func (c *Client) CountCronWorkflows(namespace, workflowTemplateUID string) (count int, err error)

func (*Client) CountWorkflowExecutions

func (c *Client) CountWorkflowExecutions(namespace, workflowTemplateUID, workflowTemplateVersion string, includeSystem bool, request *request.Request) (count int, err error)

CountWorkflowExecutions returns the number of workflow executions

func (*Client) CountWorkflowExecutionsForWorkflowTemplate added in v0.20.0

func (c *Client) CountWorkflowExecutionsForWorkflowTemplate(workflowTemplateID uint64) (count int, err error)

CountWorkflowExecutionsForWorkflowTemplate returns the number of workflow executions associated with the workflow template identified by it's id.

func (*Client) CountWorkflowTemplateVersions added in v0.10.0

func (c *Client) CountWorkflowTemplateVersions(namespace, uid string) (count uint64, err error)

CountWorkflowTemplateVersions returns the number of versions a non-archived WorkflowTemplate has.

func (*Client) CountWorkflowTemplates

func (c *Client) CountWorkflowTemplates(namespace string, request *request.Request) (count int, err error)

CountWorkflowTemplates counts the total number of workflow templates for the given namespace archived, and system templates are ignored.

func (*Client) CountWorkflowTemplatesByName added in v0.11.0

func (c *Client) CountWorkflowTemplatesByName(namespace, name string, archived *bool) (count uint64, err error)

CountWorkflowTemplatesByName returns the number of WorkflowTemplates given the arguments. If archived is nil, it is not considered.

func (*Client) CountWorkspaceTemplates

func (c *Client) CountWorkspaceTemplates(namespace string) (count int, err error)

CountWorkspaceTemplates returns the total number of non-archived workspace templates for the input namespace

func (*Client) CountWorkspaces added in v0.8.0

func (c *Client) CountWorkspaces(namespace string, request *request.Request) (count int, err error)

CountWorkspaces returns the total number of workspaces in the given namespace that are not terminated

func (*Client) CreateCronWorkflow

func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow) (*CronWorkflow, error)

func (*Client) CreateInferenceService added in v1.0.0

func (c *Client) CreateInferenceService(deployment *InferenceService) error

CreateInferenceService creates an InferenceService with KFServing

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(sourceNamespace, name string) (namespace *Namespace, err error)

CreateNamespace creates a namespace named {{ name }} assuming the {{ sourceNamespace }} created it

func (*Client) CreateSecret

func (c *Client) CreateSecret(namespace string, secret *Secret) (err error)

func (*Client) CreateVirtualService added in v1.0.2

func (c *Client) CreateVirtualService(namespace string, data interface{}) error

CreateVirtualService creates an istio virtual service

func (*Client) CreateWorkflowExecution

func (c *Client) CreateWorkflowExecution(namespace string, workflow *WorkflowExecution, workflowTemplate *WorkflowTemplate) (*WorkflowExecution, error)

CreateWorkflowExecution creates an argo workflow execution and related resources. If workflow.Name is set, it is used instead of a generated name. If there is a parameter named "workflow-execution-name" in workflow.Parameters, it is set as the name.

func (*Client) CreateWorkflowTemplate

func (c *Client) CreateWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error)

func (*Client) CreateWorkflowTemplateVersion

func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error)

CreateWorkflowTemplateVersion creates a new workflow template version including argo resources. It marks any older workflow template versions as not latest

Pre-condition: a Workflow Template version already exists Post-condition: the input workflow template will have it's fields updated so it matches the new version data.

func (*Client) CreateWorkspace

func (c *Client) CreateWorkspace(namespace string, workspace *Workspace) (*Workspace, error)

CreateWorkspace creates a workspace by triggering the corresponding workflow

func (*Client) CreateWorkspaceTemplate

func (c *Client) CreateWorkspaceTemplate(namespace string, workspaceTemplate *WorkspaceTemplate) (*WorkspaceTemplate, error)

CreateWorkspaceTemplate creates a template for Workspaces

func (*Client) CronStartWorkflowExecutionStatisticInsert

func (c *Client) CronStartWorkflowExecutionStatisticInsert(namespace, uid string, workflowTemplateID int64) (err error)

func (*Client) DeleteCronWorkflowLabel

func (c *Client) DeleteCronWorkflowLabel(namespace, name string, keysToDelete ...string) (labels map[string]string, err error)

func (*Client) DeleteLabels

func (c *Client) DeleteLabels(namespace, resource, uid string, keyValues map[string]string) error

func (*Client) DeleteModel added in v1.0.0

func (c *Client) DeleteModel(namespace, name string) error

DeleteModel deletes the model

func (*Client) DeleteResourceLabels added in v0.12.0

func (c *Client) DeleteResourceLabels(runner sq.BaseRunner, resource string) error

DeleteResourceLabels deletes all of the labels for a specific resource, like workflow templates. NOTE: this does NOT delete k8s labels, and is only meant to be used for special cases.

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(namespace string, name string) (deleted bool, err error)

func (*Client) DeleteSecretKey

func (c *Client) DeleteSecretKey(namespace string, secret *Secret) (deleted bool, err error)

func (*Client) DeleteWorkflowExecutionLabel

func (c *Client) DeleteWorkflowExecutionLabel(namespace, uid string, keysToDelete ...string) (labels map[string]string, err error)

func (*Client) DeleteWorkflowTemplateLabel

func (c *Client) DeleteWorkflowTemplateLabel(namespace, uid string, keysToDelete ...string) (labels map[string]string, err error)

func (*Client) DeleteWorkspace

func (c *Client) DeleteWorkspace(namespace, uid string) (err error)

DeleteWorkspace deletes a workspace

func (*Client) FinishWorkflowExecutionStatisticViaExitHandler

func (c *Client) FinishWorkflowExecutionStatisticViaExitHandler(namespace, name string, phase wfv1.NodePhase, startedAt time.Time) (err error)

func (*Client) GenerateWorkflowTemplateManifest added in v0.17.0

func (c *Client) GenerateWorkflowTemplateManifest(manifest string) (string, error)

GenerateWorkflowTemplateManifest replaces any special parameters with runtime values

func (*Client) GenerateWorkspaceTemplateWorkflowTemplate

func (c *Client) GenerateWorkspaceTemplateWorkflowTemplate(workspaceTemplate *WorkspaceTemplate) (workflowTemplate *WorkflowTemplate, err error)

GenerateWorkspaceTemplateWorkflowTemplate generates and returns a workflowTemplate for a given workspaceTemplate manifest

func (*Client) GetArtifactRepositorySource added in v1.0.2

func (c *Client) GetArtifactRepositorySource(namespace string) (string, error)

GetArtifactRepositorySource returns the original source for the artifact repository This can be s3, abs, gcs, etc. Since everything goes through an S3 compatible API, it is sometimes useful to know the source.

func (*Client) GetArtifactRepositoryType added in v0.17.0

func (c *Client) GetArtifactRepositoryType(namespace string) (string, error)

GetArtifactRepositoryType returns the configured artifact repository type for the given namespace. possible return values are: "s3", "gcs"

func (*Client) GetCronWorkflow

func (c *Client) GetCronWorkflow(namespace, uid string) (cronWorkflow *CronWorkflow, err error)

GetCronWorkflow gets information about a cron workflow uniquely identified by a namespace/uid

func (*Client) GetCronWorkflowLabels

func (c *Client) GetCronWorkflowLabels(namespace, name, prefix string) (labels map[string]string, err error)

prefix is the label prefix. e.g. prefix/my-label-key: my-label-value

func (*Client) GetCronWorkflowStatisticsForTemplates

func (c *Client) GetCronWorkflowStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error)

func (*Client) GetDefaultConfig added in v0.11.0

func (c *Client) GetDefaultConfig() (config *ConfigMap, err error)

GetDefaultConfig returns the default configuration of the system

func (*Client) GetGCSClient added in v0.12.0

func (c *Client) GetGCSClient(namespace string, config *ArtifactRepositoryGCSProvider) (gcsClient *gcs.Client, err error)

GetGCSClient initializes a client to Google Cloud Storage.

func (*Client) GetK8sLabelResource

func (c *Client) GetK8sLabelResource(namespace, resource, uid string) (source interface{}, result *v1.ObjectMeta, err error)

func (*Client) GetLatestWorkflowTemplate added in v0.11.0

func (c *Client) GetLatestWorkflowTemplate(namespace, uid string) (workflowTemplate *WorkflowTemplate, err error)

GetLatestWorkflowTemplate returns a workflow template with the latest version data.

func (*Client) GetModelStatus added in v1.0.0

func (c *Client) GetModelStatus(namespace, name string) (*InferenceServiceStatus, error)

GetModelStatus returns the model's status

func (*Client) GetNamespace added in v1.0.0

func (c *Client) GetNamespace(name string) (namespace *Namespace, err error)

GetNamespace gets the namespace from the cluster if it exists

func (*Client) GetNamespaceConfig

func (c *Client) GetNamespaceConfig(namespace string) (config *NamespaceConfig, err error)

GetNamespaceConfig returns the NamespaceConfig given a namespace

func (*Client) GetObjectPresignedURL added in v1.0.0

func (c *Client) GetObjectPresignedURL(namespace, key string) (download *GetPresignedURLDownload, err error)

GetObjectPresignedURL generates a presigned url for the object that is valid for 24 hours.

func (*Client) GetPublicS3Client added in v1.0.0

func (c *Client) GetPublicS3Client(namespace string, config *ArtifactRepositoryS3Provider) (s3Client *s3.Client, err error)

GetPublicS3Client initializes a client to Amazon Cloud Storage with the endpoint being public accessible (if available)

func (*Client) GetS3Client

func (c *Client) GetS3Client(namespace string, config *ArtifactRepositoryS3Provider) (s3Client *s3.Client, err error)

GetS3Client initializes a client to Amazon Cloud Storage.

func (*Client) GetSecret

func (c *Client) GetSecret(namespace, name string) (secret *Secret, err error)

func (*Client) GetService added in v0.12.0

func (c *Client) GetService(namespace, name string) (*Service, error)

GetService gets a specific service identified by namespace, name. If it is not found, nil, nil is returned

func (*Client) GetSystemConfig

func (c *Client) GetSystemConfig() (config SystemConfig, err error)

GetSystemConfig loads various system configurations and bundles them into a map. The configuration is cached once it is loaded, and that cached value is used from here on out.

func (*Client) GetWebRouter added in v0.12.0

func (c *Client) GetWebRouter() (router.Web, error)

GetWebRouter creates a new web router using the system configuration

func (*Client) GetWorkflowExecution

func (c *Client) GetWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)

func (*Client) GetWorkflowExecutionLabels

func (c *Client) GetWorkflowExecutionLabels(namespace, uid, prefix string) (labels map[string]string, err error)

prefix is the label prefix. e.g. prefix/my-label-key: my-label-value

func (*Client) GetWorkflowExecutionLogs

func (c *Client) GetWorkflowExecutionLogs(namespace, uid, podName, containerName string) (<-chan []*LogEntry, error)

func (*Client) GetWorkflowExecutionMetrics

func (c *Client) GetWorkflowExecutionMetrics(namespace, uid, podName string) (metrics []*Metric, err error)

func (*Client) GetWorkflowExecutionStatisticsForNamespace added in v0.13.0

func (c *Client) GetWorkflowExecutionStatisticsForNamespace(namespace string) (report *WorkflowExecutionStatisticReport, err error)

GetWorkflowExecutionStatisticsForNamespace loads statistics on workflow executions for the provided namespace

func (*Client) GetWorkflowExecutionStatisticsForTemplates

func (c *Client) GetWorkflowExecutionStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error)

GetWorkflowExecutionStatisticsForTemplates loads statistics on workflow executions for the provided workflowTemplates and sets it as the WorkflowExecutionStatisticReport property

func (*Client) GetWorkflowTemplate

func (c *Client) GetWorkflowTemplate(namespace, uid string, version int64) (workflowTemplate *WorkflowTemplate, err error)

GetWorkflowTemplate returns a WorkflowTemplate with data loaded from various sources If version is 0, it returns the latest version data.

Data loaded includes * Database Information * ArgoWorkflowTemplate * Labels

func (*Client) GetWorkflowTemplateLabels

func (c *Client) GetWorkflowTemplateLabels(namespace, name, prefix string, version int64) (labels map[string]string, err error)

prefix is the label prefix. e.g. prefix/my-label-key: my-label-value if version is 0, latest is used.

func (*Client) GetWorkflowTemplateRaw added in v0.20.0

func (c *Client) GetWorkflowTemplateRaw(namespace, uid string) (workflowTemplate *WorkflowTemplate, err error)

GetWorkflowTemplateRaw returns the WorkflowTemplate without any version information

func (*Client) GetWorkspace

func (c *Client) GetWorkspace(namespace, uid string) (workspace *Workspace, err error)

GetWorkspace loads a workspace for a given namespace, uid. This loads database data injects any runtime data, and loads the labels

func (*Client) GetWorkspaceContainerLogs added in v0.18.0

func (c *Client) GetWorkspaceContainerLogs(namespace, uid, containerName string, sinceTime time.Time) (<-chan []*LogEntry, error)

GetWorkspaceContainerLogs returns logs for a given container name in a Workspace

func (*Client) GetWorkspaceStatisticsForNamespace added in v0.13.0

func (c *Client) GetWorkspaceStatisticsForNamespace(namespace string) (report *WorkspaceStatisticReport, err error)

GetWorkspaceStatisticsForNamespace loads statistics for workspaces for the provided namespace

func (*Client) GetWorkspaceTemplate

func (c *Client) GetWorkspaceTemplate(namespace, uid string, version int64) (workspaceTemplate *WorkspaceTemplate, err error)

GetWorkspaceTemplate return a workspaceTemplate and its corresponding workflowTemplate if version is 0, the latest version is returned.

func (*Client) HasService added in v1.0.0

func (c *Client) HasService(name string) (bool, error)

HasService checks if the cluster has a service available

func (*Client) ListAllWorkflowTemplates added in v0.12.0

func (c *Client) ListAllWorkflowTemplates(namespace string, request *request.Request) (workflowTemplateVersions []*WorkflowTemplate, err error)

ListAllWorkflowTemplates lists all of the workflow templates, including archived and system specific

func (*Client) ListAvailableLabels added in v0.15.0

func (c *Client) ListAvailableLabels(query *SelectLabelsQuery) (result []*Label, err error)

ListAvailableLabels lists the labels available for the resource specified by the query

func (*Client) ListCronWorkflows

func (c *Client) ListCronWorkflows(namespace, workflowTemplateUID string, pagination *pagination.PaginationRequest) (cronWorkflows []*CronWorkflow, err error)

ListCronWorkflows selects all of the cron workflows for the given namespace and workflow template uid

func (*Client) ListFiles

func (c *Client) ListFiles(namespace, key string) (files []*File, err error)

ListFiles returns an array of files for the given namespace/key

func (*Client) ListLabels

func (c *Client) ListLabels(resource string, uid string) (labels []*Label, err error)

func (*Client) ListNamespaces

func (c *Client) ListNamespaces() (namespaces []*Namespace, err error)

ListNamespaces lists all of the onepanel enabled namespaces

func (*Client) ListOnepanelEnabledNamespaces

func (c *Client) ListOnepanelEnabledNamespaces() (namespaces []*Namespace, err error)

func (*Client) ListSecrets

func (c *Client) ListSecrets(namespace string) (secrets []*Secret, err error)

func (*Client) ListServices added in v0.12.0

func (c *Client) ListServices(namespace string) ([]*Service, error)

ListServices finds all of the services in the given namespace

func (*Client) ListWorkflowExecutions

func (c *Client) ListWorkflowExecutions(namespace, workflowTemplateUID, workflowTemplateVersion string, includeSystem bool, request *request.Request) (workflows []*WorkflowExecution, err error)

ListWorkflowExecutions gets a list of WorkflowExecutions ordered by most recently created first.

func (*Client) ListWorkflowExecutionsField added in v0.19.0

func (c *Client) ListWorkflowExecutionsField(namespace, field string) (value []string, err error)

ListWorkflowExecutionsField loads all of the distinct field values for workflow executions

func (*Client) ListWorkflowTemplateVersions

func (c *Client) ListWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*WorkflowTemplate, err error)

ListWorkflowTemplateVersions returns all the WorkflowTemplates for a given namespace and uid.

func (*Client) ListWorkflowTemplateVersionsAll added in v0.12.0

func (c *Client) ListWorkflowTemplateVersionsAll(paginator *pagination.PaginationRequest) (workflowTemplateVersions []*WorkflowTemplateVersion, err error)

ListWorkflowTemplateVersionsAll returns all WorkflowTemplateVersions with no filtering.

func (*Client) ListWorkflowTemplateVersionsModels added in v0.12.0

func (c *Client) ListWorkflowTemplateVersionsModels(namespace, uid string) (workflowTemplateVersions []*WorkflowTemplateVersion, err error)

ListWorkflowTemplateVersionsModels returns all the WorkflowTemplateVersions from the database. This function is a work-around for ListWorkflowTemplateVersions. Once that function is refactored, this function should no longer be necessary and removed. See: https://github.com/onepanelio/core/issues/436

func (*Client) ListWorkflowTemplates

func (c *Client) ListWorkflowTemplates(namespace string, request *request.Request) (workflowTemplateVersions []*WorkflowTemplate, err error)

ListWorkflowTemplates returns all WorkflowTemplates where the results are filtered by is_archived and is_System is false.

func (*Client) ListWorkflowTemplatesField added in v0.19.0

func (c *Client) ListWorkflowTemplatesField(namespace, field string, isSystem bool) (value []string, err error)

ListWorkflowTemplatesField loads all of the distinct field values for workflow templates

func (*Client) ListWorkspaceTemplateVersions

func (c *Client) ListWorkspaceTemplateVersions(namespace, uid string) (workspaceTemplates []*WorkspaceTemplate, err error)

ListWorkspaceTemplateVersions returns an array of WorkspaceTemplates with the version information loaded. Latest id is first.

func (*Client) ListWorkspaceTemplates

func (c *Client) ListWorkspaceTemplates(namespace string, request *request.Request) (workspaceTemplates []*WorkspaceTemplate, err error)

ListWorkspaceTemplates returns a list of workspace templates that are not archived, sorted by most recent created first

func (*Client) ListWorkspaceTemplatesField added in v0.19.0

func (c *Client) ListWorkspaceTemplatesField(namespace, field string) (value []string, err error)

ListWorkspaceTemplatesField loads all of the distinct field values for workspace templates

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces(namespace string, request *request.Request) (workspaces []*Workspace, err error)

ListWorkspaces returns a list of workspaces that satisfy the conditions in the request

func (*Client) ListWorkspacesByTemplateID added in v0.10.0

func (c *Client) ListWorkspacesByTemplateID(namespace string, templateID uint64) (workspaces []*Workspace, err error)

ListWorkspacesByTemplateID will return all the workspaces for a given workspace template id that are not terminated. Sourced from database. Includes labels.

func (*Client) ListWorkspacesField added in v0.19.0

func (c *Client) ListWorkspacesField(namespace, field string) (value []string, err error)

ListWorkspacesField loads all of the distinct field values for workspaces

func (*Client) PauseWorkspace

func (c *Client) PauseWorkspace(namespace, uid string) (err error)

PauseWorkspace pauses a workspace

func (*Client) ReplaceLabels

func (c *Client) ReplaceLabels(namespace, resource, uid string, keyValues map[string]string) error

func (*Client) ReplaceLabelsUsingKnownID added in v0.8.0

func (c *Client) ReplaceLabelsUsingKnownID(namespace, resource string, uid string, keyValues map[string]string) error

ReplaceLabelsUsingKnownID updates the k8s resource labels for the given resource/uid deprecated

func (*Client) ResubmitWorkflowExecution

func (c *Client) ResubmitWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)

func (*Client) ResumeWorkflowExecution

func (c *Client) ResumeWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)

func (*Client) ResumeWorkspace added in v0.8.0

func (c *Client) ResumeWorkspace(namespace, uid string, parameters []Parameter) (err error)

ResumeWorkspace resumes a workspace

func (*Client) RetryWorkflowExecution

func (c *Client) RetryWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)

func (*Client) SecretExists

func (c *Client) SecretExists(namespace string, name string) (exists bool, err error)

func (*Client) SetCronWorkflowLabels

func (c *Client) SetCronWorkflowLabels(namespace, name, prefix string, keyValues map[string]string, deleteOld bool) (workflowLabels map[string]string, err error)

prefix is the label prefix. we delete all labels with that prefix and set the new ones e.g. prefix/my-label-key: my-label-value

func (*Client) SetWorkflowExecutionLabels

func (c *Client) SetWorkflowExecutionLabels(namespace, uid, prefix string, keyValues map[string]string, deleteOld bool) (workflowLabels map[string]string, err error)

prefix is the label prefix. we delete all labels with that prefix and set the new ones e.g. prefix/my-label-key: my-label-value

func (*Client) SetWorkflowTemplateLabels

func (c *Client) SetWorkflowTemplateLabels(namespace, uid, prefix string, keyValues map[string]string, deleteOld bool) (workflowLabels map[string]string, err error)

prefix is the label prefix. we delete all labels with that prefix and set the new ones e.g. prefix/my-label-key: my-label-value

func (*Client) StartWorkspace added in v0.13.0

func (c *Client) StartWorkspace(namespace string, workspace *Workspace) (*Workspace, error)

StartWorkspace starts a workspace

func (*Client) SuspendWorkflowExecution

func (c *Client) SuspendWorkflowExecution(namespace, uid string) (err error)

func (*Client) TerminateCronWorkflow

func (c *Client) TerminateCronWorkflow(namespace, uid string) (err error)

func (*Client) TerminateWorkflowExecution

func (c *Client) TerminateWorkflowExecution(namespace, uid string) (err error)

TerminateWorkflowExecution marks a workflows execution as terminated in DB and terminates the argo resource.

func (*Client) UpdateCronWorkflow

func (c *Client) UpdateCronWorkflow(namespace string, uid string, cronWorkflow *CronWorkflow) (*CronWorkflow, error)

func (*Client) UpdateK8sLabelResource

func (c *Client) UpdateK8sLabelResource(namespace, resource string, obj interface{}) error

func (*Client) UpdateSecretKeyValue

func (c *Client) UpdateSecretKeyValue(namespace string, secret *Secret) (updated bool, err error)

func (*Client) UpdateWorkflowExecutionMetrics added in v0.16.0

func (c *Client) UpdateWorkflowExecutionMetrics(namespace, uid string, metrics Metrics) (workflowExecution *WorkflowExecution, err error)

UpdateWorkflowExecutionMetrics replaces the metrics of a workflow execution identified by (namespace, uid) with the input metrics.

func (*Client) UpdateWorkflowExecutionStatus added in v0.8.0

func (c *Client) UpdateWorkflowExecutionStatus(namespace, uid string, status *WorkflowExecutionStatus) (err error)

UpdateWorkflowExecutionPhase updates workflow execution phases and times. `modified_at` time is always updated when this method is called.

func (*Client) UpdateWorkflowTemplateVersion added in v0.12.0

func (c *Client) UpdateWorkflowTemplateVersion(wtv *WorkflowTemplateVersion) error

UpdateWorkflowTemplateVersion will update a given WorkflowTemplateVersion in the database. The intent is to change specific database values for a WorkflowTemplateVersion. - wtv.ID has to be set and greater than 0

func (*Client) UpdateWorkspace added in v0.8.0

func (c *Client) UpdateWorkspace(namespace, uid string, parameters []Parameter) (err error)

UpdateWorkspace marks a workspace as "updating"

func (*Client) UpdateWorkspaceStatus

func (c *Client) UpdateWorkspaceStatus(namespace, uid string, status *WorkspaceStatus) (err error)

UpdateWorkspaceStatus updates workspace status and times based on phase

func (*Client) UpdateWorkspaceTemplate

func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *WorkspaceTemplate) (*WorkspaceTemplate, error)

UpdateWorkspaceTemplate adds a new workspace template version

func (*Client) UpdateWorkspaceTemplateManifest added in v0.13.0

func (c *Client) UpdateWorkspaceTemplateManifest(namespace, uid string, manifest string) (*WorkspaceTemplate, error)

UpdateWorkspaceTemplateManifest updates a workspace template by creating a new version where the only difference is the manifest

func (*Client) ValidateWorkflowExecution

func (c *Client) ValidateWorkflowExecution(namespace string, manifest []byte) (err error)

func (*Client) WatchWorkflowExecution

func (c *Client) WatchWorkflowExecution(namespace, uid string) (<-chan *WorkflowExecution, error)

func (*Client) WorkspaceTemplateHasRunningWorkspaces added in v0.8.0

func (c *Client) WorkspaceTemplateHasRunningWorkspaces(namespace string, uid string) (bool, error)

WorkspaceTemplateHasRunningWorkspaces returns true if there are non-terminated (or terminating) workspaces that are based of this template. False otherwise.

type Config

type Config = rest.Config

func NewConfig

func NewConfig() (config *Config)

type ConfigMap

type ConfigMap struct {
	Name string
	Data map[string]string
}

type CronWorkflow

type CronWorkflow struct {
	ID                        uint64
	CreatedAt                 time.Time  `db:"created_at"`
	ModifiedAt                *time.Time `db:"modified_at"`
	UID                       string
	Name                      string
	GenerateName              string
	WorkflowExecution         *WorkflowExecution
	Labels                    types.JSONLabels
	Version                   int64
	WorkflowTemplateVersionID uint64 `db:"workflow_template_version_id"`
	Manifest                  string
	Namespace                 string `db:"namespace"`
}

CronWorkflow represents a workflow that runs on a cron.

func (*CronWorkflow) AddToManifestSpec

func (cw *CronWorkflow) AddToManifestSpec(key, manifest string) error

AddToManifestSpec updates the CronWorkflow's manifest by setting the input manifest under the specified key

func (*CronWorkflow) GetParametersFromWorkflowSpec

func (cw *CronWorkflow) GetParametersFromWorkflowSpec() ([]Parameter, error)

GetParametersFromWorkflowSpec parses the parameters from the CronWorkflow's manifest

func (*CronWorkflow) GetParametersFromWorkflowSpecJSON added in v0.11.0

func (cw *CronWorkflow) GetParametersFromWorkflowSpecJSON() ([]byte, error)

GetParametersFromWorkflowSpecJSON parses the parameters from the CronWorkflow's manifest and returns them as a JSON string

type CronWorkflowManifest added in v0.12.0

type CronWorkflowManifest struct {
	WorkflowExecutionSpec WorkflowExecutionSpec `json:"workflowSpec" yaml:"workflowSpec"`
}

CronWorkflowManifest is a client representation of a CronWorkflowManifest It is usually provided as YAML by a client and this struct helps to marshal/unmarshal it

type CronWorkflowStatisticReport

type CronWorkflowStatisticReport struct {
	WorkflowTemplateId uint64 `db:"workflow_template_id"`
	Total              int32
}

type DB

type DB struct {
	sqlx.DB
}

DB represents a database connection. It wraps a sqlx.DB to provide convenience methods.

func NewDB added in v0.11.0

func NewDB(db *sqlx.DB) *DB

NewDB creates a new DB using an existing sqlx.DB connection.

func (*DB) Getx added in v0.11.0

func (db *DB) Getx(dest interface{}, builder sq.SelectBuilder) error

Getx performs a get query using a squirrel SelectBuilder as an argument.

This is a convenience wrapper. Any errors from squirrel or sqlx are returned as is.

func (*DB) Selectx added in v0.11.0

func (db *DB) Selectx(dest interface{}, builder sq.SelectBuilder) error

Selectx performs a select query using a squirrel SelectBuilder as an argument.

This is a convenience wrapper. Any errors from squirrel or sqlx are returned as is.

type Env added in v1.0.0

type Env struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Env is a name/value environment variable

type File

type File struct {
	Path         string
	Name         string
	Size         int64
	Extension    string
	ContentType  string
	LastModified time.Time
	Directory    bool
}

File represents a system file.

type GetPresignedURLDownload added in v1.0.0

type GetPresignedURLDownload struct {
	URL  string
	Size int64
}

GetPresignedURLDownload represents the information available when downloading an object

type InferenceService added in v1.0.0

type InferenceService struct {
	Name      string
	Namespace string

	Transformer *Transformer
	Predictor   *Predictor
}

InferenceService represents the information necessary to deploy an inference service

func (*InferenceService) ToResource added in v1.0.0

func (m *InferenceService) ToResource() interface{}

ToResource converts the InferenceService into a KFServing spec

type InferenceServiceStatus added in v1.0.0

type InferenceServiceStatus struct {
	Ready      bool
	Conditions []inferenceServiceCondition
	PredictURL string
}

InferenceServiceStatus represents information about an InferenceService

type Label

type Label struct {
	ID         uint64
	CreatedAt  time.Time `db:"created_at"`
	Key        string
	Value      string
	Resource   string
	ResourceID uint64 `db:"resource_id"`
}

Label represents a database-backed label row.

func LabelFromString added in v0.12.0

func LabelFromString(value string) (label *Label, err error)

LabelFromString converts a parses into a label Format: key=<key>,value=<value>

func LabelsFromString added in v0.12.0

func LabelsFromString(value string) (labels []*Label, err error)

LabelsFromString parses a string into labels Format: key=<key>,value=<value>&key2=<key2>,value2=<value2>

type LabelFilter added in v0.13.0

type LabelFilter interface {
	// GetLabels returns the labels to filter by. These are assumed to be ANDed together.
	GetLabels() []*Label
}

LabelFilter represents a filter that has labels

type ListOptions

type ListOptions = metav1.ListOptions

type LogEntry

type LogEntry struct {
	Timestamp time.Time
	Content   string
}

func LogEntryFromLine added in v0.17.0

func LogEntryFromLine(line *string) *LogEntry

LogEntryFromLine creates a LogEntry given a line of text it tries to parse out a timestamp and content

func (*LogEntry) IsEmpty added in v0.17.0

func (l *LogEntry) IsEmpty() bool

IsEmpty returns true if the content for the log entry is just an empty string

type MachineResources added in v1.0.0

type MachineResources struct {
	CPU    string `json:"cpu,omitempty"`
	Memory string `json:"memory,omitempty"`
}

MachineResources are the cpu/memory limits

type Metric

type Metric struct {
	Name   string
	Value  float64
	Format string `json:"omitempty"`
}

type Metrics added in v0.16.0

type Metrics []*Metric

Metrics is a convenience type to work with multiple Metric(s)

func (*Metrics) Add added in v0.16.0

func (m *Metrics) Add(input *Metric, override bool)

Add adds the new metric to the metrics. If there is already metrics with the same name, and override is true the existing metrics will all be updated to the input value. Otherwise, they will be left unchanged.

func (*Metrics) Merge added in v0.16.0

func (m *Metrics) Merge(input Metrics, override bool)

Merge merges the metrics with other metrics If there is already metrics with the same name and override is true the existing metrics will all be updated to the input value. Otherwise they will be left unchanged.

func (*Metrics) Scan added in v0.16.0

func (m *Metrics) Scan(src interface{}) error

Scan stores the src in m. No validation is done. This is to support Metrics working with JSONB column types in sql

func (*Metrics) Unmarshal added in v0.16.0

func (m *Metrics) Unmarshal(v interface{}) error

Unmarshal unmarshal's the json in m to v, as in json.Unmarshal. This is to support Metrics working with JSONB column types in sql

func (Metrics) Value added in v0.16.0

func (m Metrics) Value() (driver.Value, error)

Value returns j as a value. This does a validating unmarshal into another RawMessage. If j is invalid json, it returns an error. Note that nil values will return "[]" - empty JSON. This is to support Metrics working with JSONB column types in sql

type Namespace

type Namespace struct {
	Name   string
	Labels map[string]string
}

type NamespaceConfig added in v0.8.0

type NamespaceConfig struct {
	ArtifactRepository ArtifactRepositoryProvider
}

NamespaceConfig represents configuration for the namespace

type NodePoolOption added in v0.12.0

type NodePoolOption struct {
	ParameterOption
	Resources corev1.ResourceRequirements
}

NodePoolOption extends ParameterOption to support resourceRequirements

type Parameter

type Parameter struct {
	Name        string             `json:"name" protobuf:"bytes,1,opt,name=name"`
	Value       *string            `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
	Visibility  *string            `json:"visibility,omitempty"`
	Type        string             `json:"type,omitempty" protobuf:"bytes,3,opt,name=type"`
	DisplayName *string            `json:"displayName,omitempty" yaml:"displayName"`
	Hint        *string            `json:"hint,omitempty" protobuf:"bytes,5,opt,name=hint"`
	Options     []*ParameterOption `json:"options,omitempty" protobuf:"bytes,6,opt,name=options"`
	Required    bool               `json:"required,omitempty" protobuf:"bytes,7,opt,name=required"`
}

func ParseParametersFromManifest added in v0.8.0

func ParseParametersFromManifest(manifest []byte) ([]Parameter, error)

ParseParametersFromManifest takes a manifest and picks out the parameters and returns them as structs

type ParameterOption

type ParameterOption struct {
	Name  string `json:"name" protobuf:"bytes,1,opt,name=name"`
	Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
}

type PodGCStrategy

type PodGCStrategy = wfv1.PodGCStrategy

type Predictor added in v1.0.0

type Predictor struct {
	Name           string            `json:"-"`
	RuntimeVersion string            `json:"runtimeVersion,omitempty"`
	StorageURI     string            `json:"storageUri"`
	Resources      *Resources        `json:"resources,omitempty"`
	NodeSelector   map[string]string `json:"nodeSelector,omitempty"`
}

Predictor contains information on what type of predictor we are using, and what resources it has available

func (*Predictor) SetNodeSelector added in v1.0.0

func (p *Predictor) SetNodeSelector(label, selector string)

SetNodeSelector will set the node selector to the input label: selector value

func (*Predictor) SetResources added in v1.0.0

func (p *Predictor) SetResources(minCPU, maxCPU, minMemory, maxMemory string)

SetResources will set the cpu/memory requests/limits for the predictor. Empty strings are ignored

type Resources added in v1.0.0

type Resources struct {
	Limits   *MachineResources `json:"limits,omitempty"`
	Requests *MachineResources `json:"requests,omitempty"`
}

Resources represent the machine resource requests/limits

type Secret

type Secret struct {
	Name string
	Data map[string]string
}

type SelectLabelsQuery added in v0.15.0

type SelectLabelsQuery struct {
	Table     string
	Alias     string
	Namespace string
	KeyLike   string
	Skip      []string
}

SelectLabelsQuery represents the options available to filter a select labels query

type Service added in v0.12.0

type Service struct {
	Name string
	URL  string
}

Service represents an installable "service" added to the system. This can be something like modeldb, or some other service that complements the main system.

type SystemConfig added in v0.11.0

type SystemConfig map[string]string

SystemConfig is configuration loaded from kubernetes config and secrets that includes information about the database, server, etc.

func NewSystemConfig added in v0.12.0

func NewSystemConfig(configMap *ConfigMap, secret *Secret) (config SystemConfig, err error)

NewSystemConfig creates a System config by getting the required data from a ConfigMap and Secret

func (SystemConfig) APIProtocol added in v0.11.0

func (s SystemConfig) APIProtocol() *string

APIProtocol returns either http:// or https:// or nil. It is based on the ONEPANEL_API_URL config value and checks if it has https or http

func (SystemConfig) APIURL added in v0.11.0

func (s SystemConfig) APIURL() *string

APIURL gets the ONEPANEL_API_URL, or nil.

func (SystemConfig) DatabaseConnection added in v0.12.0

func (s SystemConfig) DatabaseConnection() (driverName, dataSourceName string)

DatabaseConnection returns system config information to connect to a database

func (SystemConfig) DatabaseDriverName added in v0.11.0

func (s SystemConfig) DatabaseDriverName() *string

DatabaseDriverName gets the databaseDriverName value, or nil.

func (SystemConfig) Domain added in v0.11.0

func (s SystemConfig) Domain() *string

Domain gets the ONEPANEL_DOMAIN value, or nil.

func (SystemConfig) FQDN added in v0.11.0

func (s SystemConfig) FQDN() *string

FQDN gets the ONEPANEL_FQDN value or nil.

func (SystemConfig) GetValue added in v0.11.0

func (s SystemConfig) GetValue(name string) *string

GetValue returns the value in the underlying map if it exists, otherwise nil is returned If the value does not exist, it is also logged.

func (SystemConfig) HMACKey added in v0.14.0

func (s SystemConfig) HMACKey() []byte

HMACKey gets the HMAC value, or nil.

func (SystemConfig) NodePoolLabel added in v0.11.0

func (s SystemConfig) NodePoolLabel() (label *string)

NodePoolLabel gets the applicationNodePoolLabel from the config or returns nil.

func (SystemConfig) NodePoolOptionByValue added in v0.12.0

func (s SystemConfig) NodePoolOptionByValue(value string) (option *NodePoolOption, err error)

NodePoolOptionByValue returns the nodePoolOption based on a given value

func (SystemConfig) NodePoolOptions added in v0.11.0

func (s SystemConfig) NodePoolOptions() (options []*NodePoolOption, err error)

NodePoolOptions loads and parses the applicationNodePoolOptions from the config. If there is no data, an error is returned.

func (SystemConfig) NodePoolOptionsAsParameters added in v0.17.0

func (s SystemConfig) NodePoolOptionsAsParameters() (result []*ParameterOption, err error)

NodePoolOptionsAsParameters returns the NodePool options as []*ParameterOption

func (SystemConfig) NodePoolOptionsMap added in v0.19.0

func (s SystemConfig) NodePoolOptionsMap() (result map[string]*NodePoolOption, err error)

NodePoolOptionsMap returns a map where each key is a node pool value and the value is a NodePoolOption

func (SystemConfig) Provider added in v1.0.2

func (s SystemConfig) Provider() *string

Provider gets the ONEPANEL_PROVIDER value, or nil.

func (SystemConfig) UpdateNodePoolOptions added in v0.12.0

func (s SystemConfig) UpdateNodePoolOptions(parameters []Parameter) ([]Parameter, error)

UpdateNodePoolOptions will update the sys-node-pool parameter's options with runtime values The original slice is unmodified, the returned slice has the updated values If sys-node-pool is not present, nothing happens.

type Transformer added in v1.0.0

type Transformer struct {
	Containers []TransformerContainer `json:"containers"`
}

Transformer is a unit that can convert model input and output to different formats in json

type TransformerContainer added in v1.0.0

type TransformerContainer struct {
	Image     string     `json:"image"`
	Name      string     `json:"name"`
	Env       []Env      `json:"env"`
	Resources *Resources `json:"resources,omitempty"`
}

TransformerContainer is a container specific to a Transformer

type WorkflowExecution

type WorkflowExecution struct {
	ID               uint64
	CreatedAt        time.Time `db:"created_at"`
	UID              string
	Name             string
	Namespace        string
	GenerateName     string
	Parameters       []Parameter
	ParametersBytes  []byte `db:"parameters"` // to load from database
	Manifest         string
	Phase            wfv1.NodePhase
	StartedAt        *time.Time        `db:"started_at"`
	FinishedAt       *time.Time        `db:"finished_at"`
	WorkflowTemplate *WorkflowTemplate `db:"workflow_template"`
	Labels           types.JSONLabels
	Metrics          Metrics
	ArgoWorkflow     *wfv1.Workflow
}

WorkflowExecution represents a workflow that is either in execution, or finished/failed.

func (*WorkflowExecution) GenerateUID added in v0.12.0

func (we *WorkflowExecution) GenerateUID(name string) error

GenerateUID generates a uid from the input name and sets it on the workflow execution

func (*WorkflowExecution) GetParameterValue added in v0.12.0

func (we *WorkflowExecution) GetParameterValue(name string) *string

GetParameterValue returns the value of the parameter with the given name, or nil if there is no such parameter

func (*WorkflowExecution) LoadParametersFromBytes

func (we *WorkflowExecution) LoadParametersFromBytes() ([]Parameter, error)

LoadParametersFromBytes loads Parameters from the WorkflowExecution's ParameterBytes field.

type WorkflowExecutionFilter added in v0.13.0

type WorkflowExecutionFilter struct {
	Labels []*Label
	Phase  string // empty string means none
}

WorkflowExecutionFilter represents the available ways we can filter WorkflowExecutions

func (*WorkflowExecutionFilter) GetLabels added in v0.13.0

func (wf *WorkflowExecutionFilter) GetLabels() []*Label

GetLabels returns the labels in the filter

type WorkflowExecutionOptions

type WorkflowExecutionOptions struct {
	Name                string
	GenerateName        string
	Entrypoint          string
	Parameters          []Parameter
	ServiceAccount      string
	Labels              map[string]string
	ListOptions         *ListOptions
	PodGCStrategy       *PodGCStrategy
	WorkflowTemplateUID string
}

WorkflowExecutionOptions are options you have for an executing workflow

type WorkflowExecutionSpec added in v0.12.0

type WorkflowExecutionSpec struct {
	Arguments Arguments
}

WorkflowExecutionSpec is a client representation of a WorkflowExecution. It is usually provided as YAML by a client and this struct helps to marshal/unmarshal it This may be redundant with WorkflowTemplateManifest and should be looked at. # TODO

type WorkflowExecutionStatistic

type WorkflowExecutionStatistic struct {
	ID                 uint64
	WorkflowTemplateID uint64
	Name               string
	Namespace          string
	//Interface to support null values for timestamps, when scanning from db into structs
	CreatedAt  *time.Time `db:"created_at"`
	FinishedAt *time.Time `db:"finished_at"`
	FailedAt   *time.Time `db:"failed_at"`
}

WorkflowExecutionStatistic is a record keeping track of what happened to a workflow execution

type WorkflowExecutionStatisticReport

type WorkflowExecutionStatisticReport struct {
	WorkflowTemplateId uint64 `db:"workflow_template_id"`
	Total              int32
	LastExecuted       *time.Time `db:"last_executed"`
	Running            int32
	Completed          int32
	Failed             int32
	Terminated         int32
}

type WorkflowExecutionStatus added in v0.8.0

type WorkflowExecutionStatus struct {
	Phase      wfv1.NodePhase `json:"phase"`
	StartedAt  *time.Time     `db:"started_at" json:"startedAt"`
	FinishedAt *time.Time     `db:"finished_at" json:"finishedAt"`
}

WorkflowExecutionStatus represents the status of a workflow execution. It's a convenience struct.

type WorkflowTemplate

type WorkflowTemplate struct {
	ID                               uint64
	CreatedAt                        time.Time  `db:"created_at"`
	ModifiedAt                       *time.Time `db:"modified_at"`
	UID                              string
	Namespace                        string
	Name                             string
	Manifest                         string
	Version                          int64 // The latest version, unix timestamp
	Versions                         int64 `db:"versions"` // How many versions there are of this template total.
	IsLatest                         bool
	IsArchived                       bool `db:"is_archived"`
	IsSystem                         bool `db:"is_system"`
	ArgoWorkflowTemplate             *wfv1.WorkflowTemplate
	Labels                           types.JSONLabels
	WorkflowExecutionStatisticReport *WorkflowExecutionStatisticReport
	CronWorkflowsStatisticsReport    *CronWorkflowStatisticReport
	WorkflowTemplateVersionID        uint64  `db:"workflow_template_version_id"` // Reference to the associated workflow template version.
	Resource                         *string // utility in case we are specifying a workflow template for a specific resource
	ResourceUID                      *string // see Resource field
	Parameters                       []Parameter
	Description                      string `db:"description"`
}

WorkflowTemplate represents a Workflow Template backed by a database row it stores information required to run an execution A Workflow template is uniquely identified by (namespace, uid, is_archived) (namespace, name, is_archived) -- because we create a uid from the name.

func CreateWorkflowTemplate added in v1.0.2

func CreateWorkflowTemplate(name string) (*WorkflowTemplate, error)

CreateWorkflowTemplate creates a new workflow template with the given name. All fields that can be generated in memory without external requests are filled out, such as the UID.

func (*WorkflowTemplate) AddWorkflowTemplateParametersFromAnnotations

func (wt *WorkflowTemplate) AddWorkflowTemplateParametersFromAnnotations(spec mapping.Mapping)

AddWorkflowTemplateParametersFromAnnotations sets the parameters in the input spec to the parameters from the WorkflowTemplate's ArgoWorkflowTemplate annotations

func (*WorkflowTemplate) FormatManifest

func (wt *WorkflowTemplate) FormatManifest() (string, error)

FormatManifest removes empty data from the "spec", adds workflow template parameters from annotations and returns the resulting manifest.

func (*WorkflowTemplate) GenerateUID

func (wt *WorkflowTemplate) GenerateUID(name string) error

GenerateUID generates a uid from the input name and sets it on the workflow template

func (*WorkflowTemplate) GetManifestBytes

func (wt *WorkflowTemplate) GetManifestBytes() []byte

GetManifestBytes returns the manifest as []byte

func (*WorkflowTemplate) GetParametersKeyString

func (wt *WorkflowTemplate) GetParametersKeyString() (map[string]string, error)

GetParametersKeyString loads Parameters from the manifest and returns it as a map, where the key is the name, and the value is the parameters as yaml.

func (*WorkflowTemplate) GetWorkflowManifestBytes

func (wt *WorkflowTemplate) GetWorkflowManifestBytes() ([]byte, error)

GetWorkflowManifestBytes returns the ArgoWorkflowTemplate but with Kind set to workflow ObjectMeta remove all fields but GenerateName and Labels

func (*WorkflowTemplate) ReplaceManifestParameters added in v0.11.0

func (wt *WorkflowTemplate) ReplaceManifestParameters(params []Parameter) error

ReplaceManifestParameters updates the parameters in the manifest to the ones in the argument

func (*WorkflowTemplate) WrapSpec

func (wt *WorkflowTemplate) WrapSpec() ([]byte, error)

WrapSpec takes the manifest from the workflow template, which is just the "spec" contents and wrap it so we have

{
   metadata: {},
   spec: spec_data
}

the above wrapping is what is returned.

type WorkflowTemplateFilter added in v0.12.0

type WorkflowTemplateFilter struct {
	Labels []*Label
}

WorkflowTemplateFilter represents the available ways we can filter WorkflowTemplates

func (*WorkflowTemplateFilter) GetLabels added in v0.16.0

func (wt *WorkflowTemplateFilter) GetLabels() []*Label

GetLabels returns the labels in the filter

type WorkflowTemplateManifest added in v0.12.0

type WorkflowTemplateManifest struct {
	Arguments Arguments
}

WorkflowTemplateManifest is a client representation of a WorkflowTemplate It is usually provided as YAML by a client and this struct helps to marshal/unmarshal it

type WorkflowTemplateVersion

type WorkflowTemplateVersion struct {
	ID               uint64
	UID              string
	Version          int64
	IsLatest         bool `db:"is_latest"`
	Manifest         string
	CreatedAt        time.Time         `db:"created_at"`
	WorkflowTemplate *WorkflowTemplate `db:"workflow_template"`
	Labels           types.JSONLabels
	Parameters       []Parameter
	ParametersBytes  []byte `db:"parameters"` // to load from database
	Description      string `db:"description"`
}

WorkflowTemplateVersion represents a different version of a WorkflowTemplate each version can have a different manifest and labels. This is used to version control the template

func (*WorkflowTemplateVersion) LoadParametersFromBytes added in v0.17.0

func (wtv *WorkflowTemplateVersion) LoadParametersFromBytes() ([]Parameter, error)

LoadParametersFromBytes loads Parameters from the WorkflowTemplateVersion's ParameterBytes field.

type Workspace

type Workspace struct {
	ID                       uint64
	Namespace                string
	UID                      string `valid:"stringlength(3|30)~UID should be between 3 to 30 characters,dns,required"`
	Name                     string `` /* 214-byte string literal not displayed */
	Labels                   types.JSONLabels
	Parameters               []Parameter
	ParametersBytes          []byte                   `db:"parameters"` // to load from database
	Status                   WorkspaceStatus          `db:"status"`
	CreatedAt                time.Time                `db:"created_at"`
	ModifiedAt               *time.Time               `db:"modified_at"`
	WorkspaceTemplate        *WorkspaceTemplate       `db:"workspace_template" valid:"-"`
	WorkspaceTemplateID      uint64                   `db:"workspace_template_id"`
	WorkspaceTemplateVersion uint64                   `db:"workspace_template_version"`
	WorkflowTemplateVersion  *WorkflowTemplateVersion `db:"workflow_template_version"` // helper to store data from workflow template version
	CaptureNode              bool                     `db:"capture_node"`
}

func (*Workspace) GenerateUID added in v0.12.0

func (w *Workspace) GenerateUID(name string) error

GenerateUID generates a uid from the input name and sets it on the workspace

func (*Workspace) GetParameterValue added in v0.12.0

func (w *Workspace) GetParameterValue(name string) *string

GetParameterValue returns the value of the parameter with the given name, or nil if there is no such parameter

func (*Workspace) GetURL added in v0.11.0

func (w *Workspace) GetURL(protocol, domain string) string

GetURL returns a url that can be used to access the workspace in a browser. protocol is either http:// or https:// domain is the domain, e.g. test.onepanel.io

type WorkspaceFilter added in v0.13.0

type WorkspaceFilter struct {
	Labels []*Label
	Phase  string // empty string means none
}

WorkspaceFilter represents the available ways we can filter Workspaces

func (*WorkspaceFilter) GetLabels added in v0.13.0

func (wf *WorkspaceFilter) GetLabels() []*Label

GetLabels gets the labels of the filter

type WorkspacePhase

type WorkspacePhase string
const (
	WorkspaceLaunching         WorkspacePhase = "Launching"
	WorkspaceRunning           WorkspacePhase = "Running"
	WorkspaceUpdating          WorkspacePhase = "Updating"
	WorkspacePausing           WorkspacePhase = "Pausing"
	WorkspacePaused            WorkspacePhase = "Paused"
	WorkspaceTerminating       WorkspacePhase = "Terminating"
	WorkspaceTerminated        WorkspacePhase = "Terminated"
	WorkspaceFailedToPause     WorkspacePhase = "Failed to pause"
	WorkspaceFailedToResume    WorkspacePhase = "Failed to resume"
	WorkspaceFailedToTerminate WorkspacePhase = "Failed to terminate"
	WorkspaceFailedToLaunch    WorkspacePhase = "Failed to launch"
	WorkspaceFailedToUpdate    WorkspacePhase = "Failed to upgrade"
)

Workspace phases

type WorkspaceService added in v0.18.0

type WorkspaceService struct {
	Name string
	Path string
}

WorkspaceService represents services available to external access in a Workspace

type WorkspaceSpec

type WorkspaceSpec struct {
	Arguments             *Arguments                     `json:"arguments" protobuf:"bytes,1,opt,name=arguments"`
	Containers            []corev1.Container             `json:"containers" protobuf:"bytes,3,opt,name=containers"`
	ImagePullSecrets      []corev1.LocalObjectReference  `json:"imagePullSecrets"`
	Ports                 []corev1.ServicePort           `json:"ports" protobuf:"bytes,4,opt,name=ports"`
	Routes                []*networking.HTTPRoute        `json:"routes" protobuf:"bytes,5,opt,name=routes"`
	VolumeClaimTemplates  []corev1.PersistentVolumeClaim `json:"volumeClaimTemplates" protobuf:"bytes,6,opt,name=volumeClaimTemplates"`
	PostExecutionWorkflow *wfv1.WorkflowTemplateSpec     `json:"postExecutionWorkflow" protobuf:"bytes,7,opt,name=postExecutionWorkflow"`
}

type WorkspaceStatisticReport added in v0.13.0

type WorkspaceStatisticReport struct {
	LastCreated       *time.Time `db:"last_created"`
	Launching         int32
	Running           int32
	Updating          int32
	Pausing           int32
	Paused            int32
	Terminating       int32
	Terminated        int32
	FailedToPause     int32 `db:"failed_to_pause" json:"failedToPause"`
	FailedToResume    int32 `db:"failed_to_resume" json:"failedToResume"`
	FailedToTerminate int32 `db:"failed_to_terminate" json:"failedToTerminate"`
	FailedToLaunch    int32 `db:"failed_to_launch" json:"failedToLaunch"`
	FailedToUpdate    int32 `db:"failed_to_update" json:"failedToUpdate"`
	Failed            int32
	Total             int32
}

WorkspaceStatisticReport contains stats on the phases the workspaces in the system are in

type WorkspaceStatus

type WorkspaceStatus struct {
	Phase        WorkspacePhase `db:"phase"`
	StartedAt    *time.Time     `db:"started_at"`
	PausedAt     *time.Time     `db:"paused_at"`
	TerminatedAt *time.Time     `db:"terminated_at"`
	UpdatedAt    *time.Time     `db:"updated_at"`
}

type WorkspaceTemplate

type WorkspaceTemplate struct {
	ID                         uint64
	WorkspaceTemplateVersionID uint64 `db:"workspace_template_version_id"`
	UID                        string
	CreatedAt                  time.Time  `db:"created_at"`
	ModifiedAt                 *time.Time `db:"modified_at"`
	IsArchived                 bool       `db:"is_archived"`
	Name                       string     `valid:"stringlength(3|30)~Name should be between 3 to 30 characters,required"`
	Namespace                  string
	Version                    int64
	Manifest                   string
	IsLatest                   bool
	WorkflowTemplate           *WorkflowTemplate `db:"workflow_template"`
	Labels                     types.JSONLabels
	WorkflowTemplateID         uint64 `db:"workflow_template_id"`
	Description                string
}

WorkspaceTemplate represents the data associated with a WorkspaceTemplate this is a mix of DB and "in-memory" fields

func CreateWorkspaceTemplate added in v1.0.2

func CreateWorkspaceTemplate(name string) (*WorkspaceTemplate, error)

CreateWorkspaceTemplate creates a new workspace template with the given name. All fields that can be generated in memory without external requests are filled out, such as the UID.

func (*WorkspaceTemplate) GenerateUID

func (wt *WorkspaceTemplate) GenerateUID(name string) error

GenerateUID generates a uid from the input name and sets it on the workflow template

func (*WorkspaceTemplate) GetServices added in v0.18.0

func (wt *WorkspaceTemplate) GetServices() ([]*WorkspaceService, error)

GetServices returns an array of WorkspaceServices

func (*WorkspaceTemplate) InjectRuntimeParameters added in v0.11.0

func (wt *WorkspaceTemplate) InjectRuntimeParameters(config SystemConfig) error

InjectRuntimeParameters will inject all runtime variables into the WorkflowTemplate's manifest.

type WorkspaceTemplateFilter added in v0.13.0

type WorkspaceTemplateFilter struct {
	Labels []*Label
	UID    string // empty string means none
}

WorkspaceTemplateFilter represents the available ways we can filter WorkspaceTemplates

func (*WorkspaceTemplateFilter) GetLabels added in v0.13.0

func (wt *WorkspaceTemplateFilter) GetLabels() []*Label

GetLabels gets the labels of the filter

Jump to

Keyboard shortcuts

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