Documentation ¶
Index ¶
- Constants
- func CronWorkflowsToIDs(resources []*CronWorkflow) (ids []uint64)
- func FilePathToExtension(path string) string
- func FilePathToName(path string) string
- func FilePathToParentPath(path string) string
- func LabelsToMapping(labels ...*Label) map[string]string
- func TypeToTableName(value string) string
- func UnmarshalWorkflows(wfBytes []byte, strict bool) (wfs []wfv1.Workflow, err error)
- func WorkflowTemplateVersionsToIDs(resources []*WorkflowTemplateVersion) (ids []uint64)
- func WorkflowTemplatesToIds(workflowTemplates []*WorkflowTemplate) (ids []uint64)
- func WorkflowTemplatesToVersionIDs(workflowTemplates []*WorkflowTemplate) (ids []uint64)
- func WorkspaceTemplatesToVersionIDs(resources []*WorkspaceTemplate) (ids []uint64)
- func WorkspacesToIDs(resources []*Workspace) (ids []uint64)
- type Arguments
- type ArtifactRepositoryConfig
- type ArtifactRepositoryS3Config
- type Client
- func (c *Client) AddLabels(namespace, resource, uid string, keyValues map[string]string) error
- func (c *Client) AddSecretKeyValue(namespace string, secret *Secret) (inserted bool, err error)
- func (c *Client) ArchiveCronWorkflow(namespace, uid string) (err error)
- func (c *Client) ArchiveWorkflowExecution(namespace, uid string) error
- func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool, err error)
- func (c *Client) ArchiveWorkspace(namespace, uid string) (err error)
- func (c *Client) ArchiveWorkspaceTemplate(namespace string, uid string) (archived bool, err error)
- func (c *Client) ArgoprojV1alpha1() argoprojv1alpha1.ArgoprojV1alpha1Interface
- func (c *Client) ClearSystemConfigCache()
- func (c *Client) CloneWorkflowExecution(namespace, uid string) (*WorkflowExecution, error)
- func (c *Client) CountCronWorkflows(namespace, workflowTemplateUID string) (count int, err error)
- func (c *Client) CountWorkflowExecutions(namespace, workflowTemplateUID, workflowTemplateVersion string) (count int, err error)
- func (c *Client) CountWorkflowTemplateVersions(namespace, uid string) (count uint64, err error)
- func (c *Client) CountWorkflowTemplates(namespace string) (count int, err error)
- func (c *Client) CountWorkflowTemplatesByName(namespace, name string, archived *bool) (count uint64, err error)
- func (c *Client) CountWorkspaceTemplates(namespace string) (count int, err error)
- func (c *Client) CountWorkspaces(namespace string) (count int, err error)
- func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow) (*CronWorkflow, error)
- func (c *Client) CreateNamespace(name string) (namespace *Namespace, err error)
- func (c *Client) CreateSecret(namespace string, secret *Secret) (err error)
- func (c *Client) CreateWorkflowExecution(namespace string, workflow *WorkflowExecution, ...) (*WorkflowExecution, error)
- func (c *Client) CreateWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error)
- func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error)
- func (c *Client) CreateWorkspace(namespace string, workspace *Workspace) (*Workspace, error)
- func (c *Client) CreateWorkspaceTemplate(namespace string, workspaceTemplate *WorkspaceTemplate) (*WorkspaceTemplate, error)
- func (c *Client) CronStartWorkflowExecutionStatisticInsert(namespace, uid string, workflowTemplateID int64) (err error)
- func (c *Client) DeleteCronWorkflowLabel(namespace, name string, keysToDelete ...string) (labels map[string]string, err error)
- func (c *Client) DeleteLabels(namespace, resource, uid string, keyValues map[string]string) error
- func (c *Client) DeleteSecret(namespace string, name string) (deleted bool, err error)
- func (c *Client) DeleteSecretKey(namespace string, secret *Secret) (deleted bool, err error)
- func (c *Client) DeleteWorkflowExecutionLabel(namespace, uid string, keysToDelete ...string) (labels map[string]string, err error)
- func (c *Client) DeleteWorkflowTemplateLabel(namespace, uid string, keysToDelete ...string) (labels map[string]string, err error)
- func (c *Client) DeleteWorkspace(namespace, uid string) (err error)
- func (c *Client) FinishWorkflowExecutionStatisticViaExitHandler(namespace, name string, workflowTemplateID int64, phase wfv1.NodePhase, ...) (err error)
- func (c *Client) GenerateWorkspaceTemplateWorkflowTemplate(workspaceTemplate *WorkspaceTemplate) (workflowTemplate *WorkflowTemplate, err error)
- func (c *Client) GetArtifact(namespace, uid, key string) (data []byte, err error)
- func (c *Client) GetCronWorkflow(namespace, uid string) (cronWorkflow *CronWorkflow, err error)
- func (c *Client) GetCronWorkflowLabels(namespace, name, prefix string) (labels map[string]string, err error)
- func (c *Client) GetCronWorkflowStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error)
- func (c *Client) GetDBLabelsMapped(resource string, ids ...uint64) (result map[uint64]map[string]string, err error)
- func (c *Client) GetDbLabels(resource string, ids ...uint64) (labels []*Label, err error)
- func (c *Client) GetDefaultConfig() (config *ConfigMap, err error)
- func (c *Client) GetK8sLabelResource(namespace, resource, uid string) (source interface{}, result *v1.ObjectMeta, err error)
- func (c *Client) GetLatestWorkflowTemplate(namespace, uid string) (workflowTemplate *WorkflowTemplate, err error)
- func (c *Client) GetLatestWorkflowTemplateVersionDB(namespace, name string) (workflowTemplateVersion *WorkflowTemplateVersion, err error)
- func (c *Client) GetNamespaceConfig(namespace string) (config *NamespaceConfig, err error)
- func (c *Client) GetS3Client(namespace string, config *ArtifactRepositoryS3Config) (s3Client *s3.Client, err error)
- func (c *Client) GetSecret(namespace, name string) (secret *Secret, err error)
- func (c *Client) GetSystemConfig() (config SystemConfig, err error)
- func (c *Client) GetWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)
- func (c *Client) GetWorkflowExecutionLabels(namespace, uid, prefix string) (labels map[string]string, err error)
- func (c *Client) GetWorkflowExecutionLogs(namespace, uid, podName, containerName string) (<-chan *LogEntry, error)
- func (c *Client) GetWorkflowExecutionMetrics(namespace, uid, podName string) (metrics []*Metric, err error)
- func (c *Client) GetWorkflowExecutionStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error)
- func (c *Client) GetWorkflowTemplate(namespace, uid string, version int64) (workflowTemplate *WorkflowTemplate, err error)
- func (c *Client) GetWorkflowTemplateDB(namespace, name string) (workflowTemplate *WorkflowTemplate, err error)
- func (c *Client) GetWorkflowTemplateLabels(namespace, name, prefix string, version int64) (labels map[string]string, err error)
- func (c *Client) GetWorkflowTemplateVersionDB(namespace, name, version string) (workflowTemplateVersion *WorkflowTemplateVersion, err error)
- func (c *Client) GetWorkspace(namespace, uid string) (workspace *Workspace, err error)
- func (c *Client) GetWorkspaceTemplate(namespace, uid string, version int64) (workspaceTemplate *WorkspaceTemplate, err error)
- func (c *Client) InsertLabels(resource string, resourceID uint64, keyValues map[string]string) (sql.Result, error)
- func (c *Client) InsertLabelsBuilder(resource string, resourceID uint64, keyValues map[string]string) sq.InsertBuilder
- func (c *Client) InsertLabelsRunner(runner sq.BaseRunner, resource string, resourceID uint64, ...) (sql.Result, error)
- func (c *Client) ListCronWorkflows(namespace, workflowTemplateUID string, ...) (cronWorkflows []*CronWorkflow, err error)
- func (c *Client) ListFiles(namespace, key string) (files []*File, err error)
- func (c *Client) ListLabels(resource string, uid string) (labels []*Label, err error)
- func (c *Client) ListNamespaces() (namespaces []*Namespace, err error)
- func (c *Client) ListOnepanelEnabledNamespaces() (namespaces []*Namespace, err error)
- func (c *Client) ListSecrets(namespace string) (secrets []*Secret, err error)
- func (c *Client) ListWorkflowExecutions(namespace, workflowTemplateUID, workflowTemplateVersion string, ...) (workflows []*WorkflowExecution, err error)
- func (c *Client) ListWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*WorkflowTemplate, err error)
- func (c *Client) ListWorkflowTemplates(namespace string, paginator *pagination.PaginationRequest) (workflowTemplateVersions []*WorkflowTemplate, err error)
- func (c *Client) ListWorkspaceTemplateVersions(namespace, uid string) (workspaceTemplates []*WorkspaceTemplate, err error)
- func (c *Client) ListWorkspaceTemplates(namespace string, paginator *pagination.PaginationRequest) (workspaceTemplates []*WorkspaceTemplate, err error)
- func (c *Client) ListWorkspaces(namespace string, paginator *pagination.PaginationRequest) (workspaces []*Workspace, err error)
- func (c *Client) ListWorkspacesByTemplateID(namespace string, templateID uint64) (workspaces []*Workspace, err error)
- func (c *Client) PauseWorkspace(namespace, uid string) (err error)
- func (c *Client) ReplaceLabels(namespace, resource, uid string, keyValues map[string]string) error
- func (c *Client) ReplaceLabelsUsingKnownID(namespace, resource string, resourceID uint64, uid string, ...) error
- func (c *Client) ResubmitWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)
- func (c *Client) ResumeWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)
- func (c *Client) ResumeWorkspace(namespace, uid string) (err error)
- func (c *Client) RetryWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)
- func (c *Client) SecretExists(namespace string, name string) (exists bool, err error)
- func (c *Client) SetCronWorkflowLabels(namespace, name, prefix string, keyValues map[string]string, deleteOld bool) (workflowLabels map[string]string, err error)
- func (c *Client) SetWorkflowExecutionLabels(namespace, uid, prefix string, keyValues map[string]string, deleteOld bool) (workflowLabels map[string]string, err error)
- func (c *Client) SetWorkflowTemplateLabels(namespace, uid, prefix string, keyValues map[string]string, deleteOld bool) (workflowLabels map[string]string, err error)
- func (c *Client) SuspendWorkflowExecution(namespace, uid string) (err error)
- func (c *Client) TerminateCronWorkflow(namespace, uid string) (err error)
- func (c *Client) TerminateWorkflowExecution(namespace, uid string) (err error)
- func (c *Client) UpdateCronWorkflow(namespace string, uid string, cronWorkflow *CronWorkflow) (*CronWorkflow, error)
- func (c *Client) UpdateK8sLabelResource(namespace, resource string, obj interface{}) error
- func (c *Client) UpdateSecretKeyValue(namespace string, secret *Secret) (updated bool, err error)
- func (c *Client) UpdateWorkflowExecutionStatus(namespace, uid string, status *WorkflowExecutionStatus) (err error)
- func (c *Client) UpdateWorkspace(namespace, uid string, parameters []Parameter) (err error)
- func (c *Client) UpdateWorkspaceStatus(namespace, uid string, status *WorkspaceStatus) (err error)
- func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *WorkspaceTemplate) (*WorkspaceTemplate, error)
- func (c *Client) ValidateWorkflowExecution(namespace string, manifest []byte) (err error)
- func (c *Client) WatchWorkflowExecution(namespace, uid string) (<-chan *WorkflowExecution, error)
- func (c *Client) WorkspaceTemplateHasRunningWorkspaces(namespace string, uid string) (bool, error)
- type Config
- type ConfigMap
- type CronWorkflow
- type CronWorkflowStatisticReport
- type DB
- type File
- type Label
- type ListOptions
- type LogEntry
- type Metric
- type Namespace
- type NamespaceConfig
- type NodePoolOption
- type Parameter
- type ParameterOption
- type PodGCStrategy
- type Secret
- type SystemConfig
- func (s SystemConfig) APIProtocol() *string
- func (s SystemConfig) APIURL() *string
- func (s SystemConfig) DatabaseDriverName() *string
- func (s SystemConfig) Domain() *string
- func (s SystemConfig) FQDN() *string
- func (s SystemConfig) GetValue(name string) *string
- func (s SystemConfig) NodePoolLabel() (label *string)
- func (s SystemConfig) NodePoolOptionByValue(value string) (option *NodePoolOption, err error)
- func (s SystemConfig) NodePoolOptions() (options []*NodePoolOption, err error)
- type WorkflowExecution
- type WorkflowExecutionOptions
- type WorkflowExecutionStatistic
- type WorkflowExecutionStatisticReport
- type WorkflowExecutionStatus
- type WorkflowTemplate
- func (wt *WorkflowTemplate) AddWorkflowTemplateParametersFromAnnotations(spec mapping.Mapping)
- func (wt *WorkflowTemplate) FormatManifest() (string, error)
- func (wt *WorkflowTemplate) GetManifestBytes() []byte
- func (wt *WorkflowTemplate) GetParametersKeyString() (map[string]string, error)
- func (wt *WorkflowTemplate) GetWorkflowManifestBytes() ([]byte, error)
- func (wt *WorkflowTemplate) ReplaceManifestParameters(params []Parameter) error
- func (wt *WorkflowTemplate) WrapSpec() ([]byte, error)
- type WorkflowTemplateVersion
- type Workspace
- type WorkspacePhase
- type WorkspaceSpec
- type WorkspaceStatus
- type WorkspaceTemplate
Constants ¶
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" )
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
FilePathToName returns the name of the file, assuming that "/" denote directories and that the file name is after the last "/"
func FilePathToParentPath ¶
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 LabelsToMapping ¶
LabelsToMapping converts Label structs to a map of key:value
func TypeToTableName ¶
func UnmarshalWorkflows ¶
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
WorkspacesToIDs returns an array of ids from the input Workspaces with no duplicates.
Types ¶
type Arguments ¶
type Arguments struct {
Parameters []Parameter `json:"parameters" protobuf:"bytes,1,opt,name=parameters"`
}
type ArtifactRepositoryConfig ¶ added in v0.8.0
type ArtifactRepositoryConfig struct {
S3 *ArtifactRepositoryS3Config
}
type ArtifactRepositoryS3Config ¶
type ArtifactRepositoryS3Config struct { KeyFormat string Bucket string Endpoint string Insecure bool Region string AccessKeySecret corev1.SecretKeySelector SecretKeySecret corev1.SecretKeySelector AccessKey string Secretkey string }
func (*ArtifactRepositoryS3Config) FormatKey ¶ added in v0.10.0
func (a *ArtifactRepositoryS3Config) 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
type Client ¶
type Client struct { kubernetes.Interface *DB // contains filtered or unexported fields }
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) AddSecretKeyValue ¶
func (*Client) ArchiveCronWorkflow ¶ added in v0.8.0
func (*Client) ArchiveWorkflowExecution ¶ added in v0.8.0
func (*Client) ArchiveWorkflowTemplate ¶
func (*Client) ArchiveWorkspace ¶ added in v0.10.0
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
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 (*Client) CountWorkflowExecutions ¶
func (*Client) CountWorkflowTemplateVersions ¶ added in v0.10.0
CountWorkflowTemplateVersions returns the number of versions a non-archived WorkflowTemplate has.
func (*Client) CountWorkflowTemplates ¶
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 (*Client) CountWorkspaces ¶ added in v0.8.0
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) CreateNamespace ¶
func (*Client) CreateSecret ¶
func (*Client) CreateWorkflowExecution ¶
func (c *Client) CreateWorkflowExecution(namespace string, workflow *WorkflowExecution, workflowTemplate *WorkflowTemplate) (*WorkflowExecution, error)
CreateWorkflowExecution creates an argo workflow execution and related resources. Note that the workflow template is loaded from the database/k8s, so workflow.WorkflowTemplate.Manifest is not used. Required:
- workflow.Parameters
- workflow.Labels (optional)
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)
func (*Client) CreateWorkspace ¶
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 (*Client) DeleteCronWorkflowLabel ¶
func (*Client) DeleteLabels ¶
func (*Client) DeleteSecret ¶
func (*Client) DeleteSecretKey ¶
func (*Client) DeleteWorkflowExecutionLabel ¶
func (*Client) DeleteWorkflowTemplateLabel ¶
func (*Client) DeleteWorkspace ¶
func (*Client) FinishWorkflowExecutionStatisticViaExitHandler ¶
func (*Client) GenerateWorkspaceTemplateWorkflowTemplate ¶
func (c *Client) GenerateWorkspaceTemplateWorkflowTemplate(workspaceTemplate *WorkspaceTemplate) (workflowTemplate *WorkflowTemplate, err error)
CreateWorkspaceTemplateWorkflowTemplate generates and returns a workflowTemplate for a given workspaceTemplate manifest
func (*Client) GetArtifact ¶
func (*Client) GetCronWorkflow ¶
func (c *Client) GetCronWorkflow(namespace, uid string) (cronWorkflow *CronWorkflow, err error)
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) GetDBLabelsMapped ¶ added in v0.11.0
func (c *Client) GetDBLabelsMapped(resource string, ids ...uint64) (result map[uint64]map[string]string, err error)
GetDBLabelsMapped returns a map where the key is the id of the resource and the value is the labels as a map[string]string
func (*Client) GetDbLabels ¶
func (*Client) GetDefaultConfig ¶ added in v0.11.0
GetDefaultConfig returns the default configuration of the system
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) GetLatestWorkflowTemplateVersionDB ¶ added in v0.11.0
func (c *Client) GetLatestWorkflowTemplateVersionDB(namespace, name string) (workflowTemplateVersion *WorkflowTemplateVersion, err error)
GetLatestWorkflowTemplateVersionDB returns the latest WorkflowTemplateVersion
func (*Client) GetNamespaceConfig ¶
func (c *Client) GetNamespaceConfig(namespace string) (config *NamespaceConfig, err error)
func (*Client) GetS3Client ¶
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) 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 (*Client) GetWorkflowExecutionMetrics ¶
func (*Client) GetWorkflowExecutionStatisticsForTemplates ¶
func (c *Client) GetWorkflowExecutionStatisticsForTemplates(workflowTemplates ...*WorkflowTemplate) (err error)
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) GetWorkflowTemplateDB ¶ added in v0.11.0
func (c *Client) GetWorkflowTemplateDB(namespace, name string) (workflowTemplate *WorkflowTemplate, err error)
GetWorkflowTemplateDB returns a WorkflowTemplate from the database
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) GetWorkflowTemplateVersionDB ¶ added in v0.11.0
func (c *Client) GetWorkflowTemplateVersionDB(namespace, name, version string) (workflowTemplateVersion *WorkflowTemplateVersion, err error)
GetWorkflowTemplateVersionDB will return a WorkflowTemplateVersion given the arguments. version can be a number as a string, or the string "latest" to get the latest.
func (*Client) GetWorkspace ¶
GetWorkspace loads a workspace for a given namespace, uid. This loads database data injects any runtime data, and loads the labels
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) InsertLabels ¶ added in v0.8.0
func (c *Client) InsertLabels(resource string, resourceID uint64, keyValues map[string]string) (sql.Result, error)
InsertLabels inserts the labels for the resource into the db using the client's DB. If no labels are provided, does nothing and returns nil, nil.
func (*Client) InsertLabelsBuilder ¶
func (*Client) InsertLabelsRunner ¶ added in v0.11.0
func (c *Client) InsertLabelsRunner(runner sq.BaseRunner, resource string, resourceID uint64, keyValues map[string]string) (sql.Result, error)
InsertLabelsRunner inserts the labels for the resource into the db using the provided runner. If no labels are provided, does nothing and returns nil, nil.
func (*Client) ListCronWorkflows ¶
func (c *Client) ListCronWorkflows(namespace, workflowTemplateUID string, pagination *pagination.PaginationRequest) (cronWorkflows []*CronWorkflow, err error)
func (*Client) ListLabels ¶
func (*Client) ListNamespaces ¶
func (*Client) ListOnepanelEnabledNamespaces ¶
func (*Client) ListSecrets ¶
func (*Client) ListWorkflowExecutions ¶
func (c *Client) ListWorkflowExecutions(namespace, workflowTemplateUID, workflowTemplateVersion string, paginator *pagination.PaginationRequest) (workflows []*WorkflowExecution, err error)
func (*Client) ListWorkflowTemplateVersions ¶
func (c *Client) ListWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*WorkflowTemplate, err error)
func (*Client) ListWorkflowTemplates ¶
func (c *Client) ListWorkflowTemplates(namespace string, paginator *pagination.PaginationRequest) (workflowTemplateVersions []*WorkflowTemplate, err error)
func (*Client) ListWorkspaceTemplateVersions ¶
func (c *Client) ListWorkspaceTemplateVersions(namespace, uid string) (workspaceTemplates []*WorkspaceTemplate, err error)
func (*Client) ListWorkspaceTemplates ¶
func (c *Client) ListWorkspaceTemplates(namespace string, paginator *pagination.PaginationRequest) (workspaceTemplates []*WorkspaceTemplate, err error)
func (*Client) ListWorkspaces ¶
func (c *Client) ListWorkspaces(namespace string, paginator *pagination.PaginationRequest) (workspaces []*Workspace, err error)
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. Sourced from database.
func (*Client) PauseWorkspace ¶
func (*Client) ReplaceLabels ¶
func (*Client) ReplaceLabelsUsingKnownID ¶ added in v0.8.0
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 (*Client) RetryWorkflowExecution ¶
func (c *Client) RetryWorkflowExecution(namespace, uid string) (workflow *WorkflowExecution, err error)
func (*Client) SecretExists ¶
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) SuspendWorkflowExecution ¶
func (*Client) TerminateCronWorkflow ¶
func (*Client) TerminateWorkflowExecution ¶
func (*Client) UpdateCronWorkflow ¶
func (c *Client) UpdateCronWorkflow(namespace string, uid string, cronWorkflow *CronWorkflow) (*CronWorkflow, error)
func (*Client) UpdateK8sLabelResource ¶
func (*Client) UpdateSecretKeyValue ¶
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) UpdateWorkspace ¶ added in v0.8.0
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) ValidateWorkflowExecution ¶
func (*Client) WatchWorkflowExecution ¶
func (c *Client) WatchWorkflowExecution(namespace, uid string) (<-chan *WorkflowExecution, error)
func (*Client) WorkspaceTemplateHasRunningWorkspaces ¶ added in v0.8.0
WorkspaceTemplateHasRunningWorkspaces returns true if there are non-terminated (or terminating) workspaces that are based of this template. False otherwise.
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 map[string]string 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 DB ¶
DB represents a database connection. It wraps a sqlx.DB to provide convenience methods.
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 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.
type ListOptions ¶
type ListOptions = metav1.ListOptions
type NamespaceConfig ¶ added in v0.8.0
type NamespaceConfig struct {
ArtifactRepository ArtifactRepositoryConfig
}
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"` Type string `json:"type,omitempty" protobuf:"bytes,3,opt,name=type"` DisplayName *string `json:"displayName,omitempty" protobuf:"bytes,4,opt,name=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 ParameterFromMap ¶
func ParameterFromMap(paramMap map[interface{}]interface{}) *Parameter
func ParseParametersFromManifest ¶ added in v0.8.0
type ParameterOption ¶
type PodGCStrategy ¶
type PodGCStrategy = wfv1.PodGCStrategy
type SystemConfig ¶ added in v0.11.0
SystemConfig is configuration loaded from kubernetes config and secrets that includes information about the database, server, etc.
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) 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) 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.
type WorkflowExecution ¶
type WorkflowExecution struct { ID uint64 CreatedAt time.Time `db:"created_at"` UID string Name 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 map[string]string }
WorkflowExecution represents a workflow that is either in execution, or finished/failed.
func (*WorkflowExecution) LoadParametersFromBytes ¶
func (we *WorkflowExecution) LoadParametersFromBytes() ([]Parameter, error)
LoadParametersFromBytes loads Parameters from the WorkflowExecution's ParameterBytes field.
type WorkflowExecutionOptions ¶
type WorkflowExecutionOptions struct { Name string GenerateName string Entrypoint string Parameters []Parameter ServiceAccount string Labels map[string]string ListOptions *ListOptions PodGCStrategy *PodGCStrategy }
WorkflowExecutionOptions are options you have for an executing workflow
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 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 map[string]string 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 }
WorkflowTemplate represents a Workflow Template backed by a database row it stores information required to run an execution
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) 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 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 map[string]string }
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
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 map[string]string 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 }
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" )
Workspace phases
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"` 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 WorkspaceStatus ¶
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 map[string]string WorkflowTemplateID uint64 `db:"workflow_template_id"` }
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.
Source Files ¶
- client.go
- common_types.go
- config.go
- config_types.go
- cron_workflow.go
- cron_workflow_types.go
- database.go
- file_types.go
- label_types.go
- labels.go
- namespace.go
- secret.go
- types.go
- workflow_execution.go
- workflow_execution_types.go
- workflow_template.go
- workflow_template_types.go
- workflow_template_version_types.go
- workspace.go
- workspace_template.go
- workspace_template_types.go
- workspace_types.go