Compare commits

..

331 Commits

Author SHA1 Message Date
Rush Tehrani
b68de30418 Merge pull request #321 from onepanelio/dev
chore: dev > master  (v0.10.0)
2020-06-05 13:06:29 -07:00
Rush Tehrani
facbed59bc Merge pull request #335 from onepanelio/feat/core.288-add.pytorch.tensorflow.workspace.template.migrations
feat: Adding Pytorch and Tensorflow to workflow templates, as runnable workflow executions.
2020-06-05 12:56:08 -07:00
rushtehrani
71781426e0 template name changes + comments on metrics 2020-06-05 12:55:36 -07:00
Aleksandr Melnikov
f48e749721 Adding comments. 2020-06-05 12:34:04 -07:00
Aleksandr Melnikov
56f87f39d6 Using the right archive function for workflow templates. 2020-06-05 12:07:42 -07:00
Aleksandr Melnikov
334642c091 Commenting out more slack related code. 2020-06-05 12:07:42 -07:00
Aleksandr Melnikov
4cd5e619a5 Initial code of adding templates, up and down code. 2020-06-05 12:07:42 -07:00
Aleksandr Melnikov
b3a0365447 Adding placeholder migration files. 2020-06-05 12:07:42 -07:00
Rush Tehrani
dedc295441 Update LICENSE 2020-06-04 19:50:39 -07:00
rushtehrani
07d6c1cc4b update gen-release-md command 2020-06-04 19:17:30 -07:00
Rush Tehrani
38becdd251 Merge pull request #330 from onepanelio/fix/docker.build.breaking
fix: fix docker build
2020-06-04 18:33:05 -07:00
Rush Tehrani
2108691f68 Update PULL_REQUEST_TEMPLATE.md 2020-06-04 18:26:20 -07:00
Aleksandr Melnikov
3c2786ed6d Updating paths in README under cmd dir. 2020-06-04 18:05:31 -07:00
Aleksandr Melnikov
3378899c5c Adding explanation to contributing. 2020-06-04 18:05:13 -07:00
Aleksandr Melnikov
1efd66d010 Updating path in Dockerfile. 2020-06-04 18:04:31 -07:00
Aleksandr Melnikov
4895d48e11 Moving commands into their own folders. 2020-06-04 18:04:14 -07:00
Rush Tehrani
df7ce2f752 Merge pull request #328 from onepanelio/chore/update-commands
chore: update gen-release-md command and README
2020-06-04 16:36:52 -07:00
Rush Tehrani
0262a9ec90 Update PULL_REQUEST_TEMPLATE.md 2020-06-04 16:01:17 -07:00
Rush Tehrani
c6c8e80516 Delete badge.yaml 2020-06-04 15:54:12 -07:00
rushtehrani
f20a7a2b14 fix README headings 2020-06-04 15:52:39 -07:00
rushtehrani
327c73f22a chore: update gen-release-md command and README 2020-06-04 15:47:00 -07:00
Rush Tehrani
b3e7ed5941 Merge pull request #326 from onepanelio/fix/slack-yaml
fix: Slack notify YAML indentation
2020-06-04 15:24:42 -07:00
Rush Tehrani
9381dd0a85 Update badge.yaml 2020-06-04 14:52:37 -07:00
Rush Tehrani
b6f7118a43 Create badge.yaml 2020-06-04 12:56:27 -07:00
Rush Tehrani
f7b941f8a0 Update PULL_REQUEST_TEMPLATE.md 2020-06-04 12:52:45 -07:00
rushtehrani
9996bfbbc3 fix: Slack notify YAML indentation 2020-06-04 11:41:46 -07:00
Aleksandr Melnikov
574301df07 Merge pull request #323 from onepanelio/fix/code.refactor
fix: Fixing function name.
2020-06-04 10:22:28 -07:00
rushtehrani
6834f660d7 fix: use correct method name 2020-06-04 10:00:56 -07:00
Aleksandr Melnikov
e8e37cd8ea Fixing function name. 2020-06-04 09:59:28 -07:00
Rush Tehrani
a47bbe949b Merge pull request #286 from onepanelio/feat/add.cvat.migration.template
feat: add cvat migration template
2020-06-04 09:51:02 -07:00
Aleksandr Melnikov
7c72a36e8b Fixing parameter to fix convention. 2020-06-04 09:12:16 -07:00
Aleksandr Melnikov
8d4989d2db Commenting more functions per codacy. 2020-06-04 09:08:37 -07:00
Aleksandr Melnikov
2de59c22cf Fixing "Id" in function name. 2020-06-04 09:05:13 -07:00
Aleksandr Melnikov
d23ce9b6a9 Documenting package migration. 2020-06-04 09:04:42 -07:00
Aleksandr Melnikov
02f3904d6a Documenting cvat migrations. 2020-06-04 08:52:21 -07:00
rushtehrani
883b7bee30 clean up migrations 2020-06-03 18:27:17 -07:00
Aleksandr Melnikov
ff7aa917f7 Removing column that does not exist. 2020-06-03 16:57:22 -07:00
Rush Tehrani
e00a54c24e Create semantic.yml 2020-06-03 16:04:19 -07:00
Aleksandr Melnikov
183296ff63 Merge pull request #312 from onepanelio/chore/gen-release-md-script
chore: generate release MD script
2020-06-03 13:31:58 -07:00
Aleksandr Melnikov
9d23b111b6 Marking goose up/down errors as fatal.
- Migrations should not go on if there is an error
2020-06-03 12:47:34 -07:00
Aleksandr Melnikov
8b26a84162 Updated ArchiveWorkspaceTemplate.
- Fixed various error message responses
- Added code to grab the WorkspaceTemplate versions
Then, code will run through these versions and grab workspaces that use
that version.
Then, code will try to Archive those workspaces (delete k8s resources,
archive database entries).
Finally, code cleans up the related WorkflowTemplate.
- Updated method docs
2020-06-03 12:46:33 -07:00
Andrey Melnikov
9d3150ccd3 Merge pull request #309 from onepanelio/fix/sys-param-priority
fix: sys param priority
2020-06-03 10:56:43 -07:00
rushtehrani
6460fefbd8 append user defined parameters after sys params 2020-06-02 22:31:52 -07:00
Rush Tehrani
7a9aa28210 Merge pull request #310 from onepanelio/feat/onepanelio.core.147-workflow.executions.template.version
feat: workflow template created at is selected when listing workflow executions
2020-06-02 19:10:36 -07:00
rushtehrani
1c085d8794 chore: Generate release MD script 2020-06-02 19:01:51 -07:00
Aleksandr Melnikov
1055b228a1 Re-arranged the code that archives the workspace template.
- This code was re-arranged to focus on archiving the k8s components
first, then the database.
- Also, workspace components are archived first,
because they rely on the workflow templates being present.
If workflow template is archived first, then the clean-up
can't resume to run again if some error is thrown.
This arrangement will ensure that if an error occurs during clean-up,
it can be re-run without throwing an error of missing prerequisite data.
- Removed an early return statement, which prevented the rest
of the clean-up
- Added extra code to not return an error if no workflow templates
are found in the database. This is to ensure k8s cleanup can continue.
2020-06-02 17:09:54 -07:00
Aleksandr Melnikov
05ad9ca2cc Added code to handle a case where there are no workspaces returned.
- This is if there are no workspaces in the database.
2020-06-02 17:06:15 -07:00
Aleksandr Melnikov
0f5d27a60d Fixing an issue with Down migrations.
- The passed in name was not converted to the UID format, so the code
could never find the relevant data.
2020-06-02 17:05:36 -07:00
Aleksandr Melnikov
1390d4d235 Updating error reporting to always return the source error.
- If extra errors, add them as text.
2020-06-02 16:18:55 -07:00
Aleksandr Melnikov
bf37713371 Migration fails silently because the insert statement lacked "uid" value. 2020-06-02 16:18:37 -07:00
Andrey Melnikov
88b20d878d update: workflow template created at is selected when listing workflow executions 2020-06-02 15:23:47 -07:00
rushtehrani
8d29cd0c5c remove extra space 2020-06-02 14:32:34 -07:00
rushtehrani
dafaadd80a fix kind 2020-06-02 14:26:10 -07:00
rushtehrani
4f036468b0 add PR template 2020-06-02 14:14:45 -07:00
Rush Tehrani
8df966fcee Create PULL_REQUEST_TEMPLATE.md 2020-06-02 14:10:45 -07:00
Andrey Melnikov
6d8ac266a3 chore: created new dev branch to phase out develop. Updated the workflow to push develop branch 2020-06-02 10:33:53 -07:00
Aleksandr Melnikov
6e9ffed843 Adding custom goose binary to dockerfile.
- This will add the goose command with the ".go" migration files.
This is needed to run goose down commands.
goose.go is needed to generate an executable.
2020-06-01 21:30:41 -07:00
Rush Tehrani
20777ed3ce Merge pull request #306 from onepanelio/feat/onepanelio.core.294-last.modified.at
update: Workflow Template now gets a modifiedAt date, and total versi…
2020-06-01 16:40:16 -07:00
Andrey Melnikov
fa68d2bef4 update: Workflow Template now gets a modifiedAt date, and total version count, from the the Get endpoint. 2020-06-01 16:09:35 -07:00
Andrey Melnikov
2726ec8d82 Merge pull request #298 from onepanelio/fix/workspace-update
fix: workspace update waits for correct success condition
2020-06-01 15:28:28 -07:00
Aleksandr Melnikov
a9df73e63a Merge pull request #281 from onepanelio/chore/fix-version
fix: version and names
2020-06-01 12:55:30 -07:00
Rush Tehrani
b8ca62efda Merge pull request #305 from onepanelio/fix/onepanelio.core.304-labels.listing.order
Fix/onepanelio.core.304 labels.listing.order
2020-06-01 12:43:57 -07:00
Andrey Melnikov
afd1b65dc5 fix: issue where labels were not sorted in any order when returned in API 2020-06-01 12:36:34 -07:00
Rush Tehrani
b7f298035d Merge pull request #303 from onepanelio/fix/onepanelio.core.296-workflow.template.count.wrong
fix: issue where workflow template count included system workflow tem…
2020-06-01 11:49:32 -07:00
Andrey Melnikov
90733b5daa fix: issue where workflow template count included system workflow templates. 2020-06-01 11:35:16 -07:00
Aleksandr Melnikov
35aef3819f Changing migrations to use ArchiveWorkspaceTemplate.
Ref: https://github.com/onepanelio/core/pull/286#discussion_r432901056
2020-06-01 10:59:47 -07:00
rushtehrani
bbe5593b52 add version flag to make api 2020-06-01 10:22:48 -07:00
rushtehrani
7911ff02cc check successCondition of statefulset at creation time as well 2020-05-31 23:27:40 -07:00
rushtehrani
f1ecb595b4 fixes workspace update success condition 2020-05-31 22:47:17 -07:00
rushtehrani
010052de3a update cvat images 2020-05-30 18:12:16 -07:00
rushtehrani
56856caa8a update name and rebase 2020-05-30 18:10:47 -07:00
Aleksandr Melnikov
3d3c9d6a66 Removing sleep command.
- Per testing, a migration error does not happen with an Azure deployment.
2020-05-30 18:05:49 -07:00
Aleksandr Melnikov
159d1819b0 Adding migration for CVAT Workspace Template. 2020-05-30 18:05:49 -07:00
Rush Tehrani
5597e14985 Merge pull request #260 from onepanelio/feature/add.jupyter.lab.to.workspace.templates
feature: added migration with jupyterlab
2020-05-30 18:03:54 -07:00
rushtehrani
7b570f861e fix db connection 2020-05-30 17:59:02 -07:00
Rush Tehrani
c6c2079226 Merge pull request #295 from onepanelio/fix/onepanelio.core.292-workspace.labels.fail
fix: issue where workspace labels did not take into account archived …
2020-05-30 15:53:31 -07:00
Andrey Melnikov
b9d5f24f37 fix: issue where workspace labels did not take into account archived ones. 2020-05-29 21:21:38 -07:00
Rush Tehrani
738d3a0050 Merge pull request #290 from onepanelio/feat/onepanelio.core.282-key.format
update: hard-coded artifacts key format with the new config.
2020-05-29 13:22:33 -07:00
Andrey Melnikov
64f6afc730 fix: replace KeyFormat placeholders with the actual value. 2020-05-29 11:43:13 -07:00
Andrey Melnikov
04bc8f2e12 update: hard-coded artifacts key format with the new config. 2020-05-29 11:27:08 -07:00
Rush Tehrani
67f4634ae0 Merge pull request #284 from onepanelio/fix/onepanelio.core.264-post.execution.workflow.optional
fix: added a default post execution workflow if there wasn't one alre…
2020-05-29 10:05:38 -07:00
Andrey Melnikov
271b1ed563 update: removed default PostExecution and only add the post execution if it exists in the setup 2020-05-28 16:53:16 -07:00
Rush Tehrani
b7c6d33c9e Merge pull request #283 from onepanelio/fix/onepanelio.core.277-sys.send.exit.status
fix: set workspaces dags to be FailFast: false so that even if anothe…
2020-05-28 16:23:55 -07:00
Andrey Melnikov
a138413c5f update: exit handler no longer depends on other exit handlers. This fixes an issue where the user's custom exit handler could crash, leaving ours not executed. 2020-05-28 16:14:16 -07:00
Andrey Melnikov
ca1c672f0d fix: added a default post execution workflow if there wasn't one already. 2020-05-28 13:26:15 -07:00
Andrey Melnikov
b41ddcdc2c fix: set workspaces dags to be FailFast: false so that even if another part of the dag fails, the sys-exit will not. 2020-05-28 12:28:51 -07:00
Andrey Melnikov
48f543b9f6 Merge pull request #280 from onepanelio/fix/onepanelio.278-list.workspace.labels
fix: added labels to list workspace method
2020-05-28 10:23:37 -07:00
Rush Tehrani
e41eb4a087 Merge pull request #269 from onepanelio/feat/core.254-workflow.counts
fix: update archive code to list all the template versions.
2020-05-28 10:17:41 -07:00
rushtehrani
73535da7fa make API 2020-05-28 10:09:08 -07:00
rushtehrani
84ddd0d0da correct API version and name 2020-05-28 10:08:25 -07:00
rushtehrani
7600f79776 update README 2020-05-28 10:08:25 -07:00
Andrey Melnikov
2164b644e6 update: removed snapshot from develop branch for GithubActions 2020-05-28 10:08:25 -07:00
Andrey Melnikov
29e1550446 fix: added labels to list workspace method 2020-05-27 22:44:39 -07:00
Aleksandr Melnikov
f2d8165016 Updating archive code to list all the template versions.
- Iterate through each version and grab the related WorkflowExecutions,
then archive them.
2020-05-26 22:09:25 -07:00
Andrey Melnikov
e8c17a04ee feature: added migration with jupyter lab 2020-05-26 10:45:56 -07:00
Rush Tehrani
cfd9bc6f43 Add badge 2020-05-25 13:38:05 -07:00
Rush Tehrani
3ee8497cac Merge pull request #258 from onepanelio/develop
dev > master
2020-05-25 13:37:08 -07:00
Rush Tehrani
58a7019b24 Merge pull request #257 from onepanelio/chore/readme-gh-actions
update README
2020-05-25 13:36:41 -07:00
rushtehrani
212f70cbb5 update README 2020-05-25 13:35:31 -07:00
Andrey Melnikov
18e2c4e411 update: removed snapshot from develop branch for GithubActions 2020-05-25 09:55:19 -07:00
Rush Tehrani
afb7af1bbe Merge pull request #253 from onepanelio/develop
dev > master
2020-05-24 15:44:34 -07:00
Rush Tehrani
9c072f5b46 Merge pull request #250 from onepanelio/fix/onepanelio.core.237-template.tables.archived.not.null
Fix/onepanelio.core.237 template.tables.archived.not.null
2020-05-24 14:31:38 -07:00
Andrey Melnikov
3403efa18c update: renamed migrations to snake case so they are consistent with others. 2020-05-24 11:55:40 -07:00
Andrey Melnikov
d53dbe1097 fix: added migration to set workflow and workspace templates is_archived column to not nullable and default false. 2020-05-24 11:55:19 -07:00
Rush Tehrani
6005f55d63 Merge pull request #247 from onepanelio/feat/update.cron.delete
fix: cron workflows now return UID and the delete endpoint doesn't ha…
2020-05-22 21:01:29 -07:00
Aleksandr Melnikov
9b1ee3fbb7 Merge pull request #248 from onepanelio/fix/wft-versions
fix wtf version display and create issue
2020-05-22 20:55:03 -07:00
rushtehrani
0a80eeede4 fix wtf version displaying and create issue 2020-05-22 20:49:51 -07:00
Andrey Melnikov
9acd4cf6d3 fix: cron workflows now return UID and the delete endpoint doesn't have the terminate suffix.
Also updated Authorized endpoint to not have same path as IsValidToken
2020-05-22 20:25:05 -07:00
Rush Tehrani
8ba2f9f6a1 Merge pull request #246 from onepanelio/fix/delete.scheduled.cron
Fixed TerminateCronWorkflow
2020-05-22 20:22:45 -07:00
Andrey Melnikov
037e735b6b Merge pull request #245 from onepanelio/fix/workspace-validation
fix workspace name validation
2020-05-22 19:55:54 -07:00
rushtehrani
076078601d only allow workspace templates to be deleted if workspace is terminated 2020-05-22 19:52:41 -07:00
rushtehrani
06ada8ff95 use uid in host 2020-05-22 19:38:58 -07:00
Aleksandr Melnikov
b712ba676a Fixed TerminateCronWorkflow
- Code will clean up any WorkflowExecutions, including those in progress.
Code then cleans up the scheduled cron workflow, archiving it in the database.
2020-05-22 19:20:31 -07:00
rushtehrani
9f00c87d9c fix workspace name validation 2020-05-22 19:07:59 -07:00
Rush Tehrani
5f697b22f9 Merge pull request #242 from onepanelio/fix/increase-uid-size
increase column size to 63 for cron workflows and workflow executions
2020-05-22 17:55:54 -07:00
rushtehrani
7ff3ad0c98 uid => name in down migration 2020-05-22 17:32:19 -07:00
rushtehrani
3ebd7ab245 increase column size to 63 for cron workflows and workflo executions 2020-05-22 17:26:58 -07:00
Andrey Melnikov
2d3f51bf27 Merge pull request #241 from onepanelio/feat/core.171-rebase.develop.3
refactored workspace template archive changes.
2020-05-22 17:17:02 -07:00
Andrey Melnikov
0eaa2b5ea2 fix: added is_archived = false to getting a workspace template, otherwise we get non-archived versions and a crash. 2020-05-22 16:44:47 -07:00
Andrey Melnikov
6bc28c4e72 fix: getting workspace template by name ignores archived ones 2020-05-22 16:27:35 -07:00
Andrey Melnikov
2bc8f684c7 refactored workspace template archive changes. 2020-05-22 16:07:50 -07:00
Rush Tehrani
b57ffe8f71 Merge pull request #226 from onepanelio/feat/core.171-archiving.workflow.template.clean.up
Feat/core.171 archiving.workflow.template.clean.up
2020-05-22 16:01:41 -07:00
rushtehrani
617806011c move getCronWorkflowColumns to types.go 2020-05-22 16:01:17 -07:00
Aleksandr Melnikov
e405ccdf04 Removing unused functions. 2020-05-22 15:57:00 -07:00
Aleksandr Melnikov
cd4f429559 Merge branch 'develop' into feat/core.171-archiving.workflow.template.clean.up 2020-05-22 15:44:01 -07:00
Aleksandr Melnikov
f555584fc8 Per https://github.com/onepanelio/core/pull/226/files#r429475185
This method ended up being equal to the one mentioned.
2020-05-22 15:42:25 -07:00
Aleksandr Melnikov
f4743d3790 Making method not public.
Per https://github.com/onepanelio/core/pull/226#discussion_r429473764
2020-05-22 15:35:26 -07:00
Aleksandr Melnikov
7ec544550b Refactored per https://github.com/onepanelio/core/pull/226#discussion_r428964039. 2020-05-22 15:28:59 -07:00
Aleksandr Melnikov
472c50b9d7 Fixing update statement.
- sq has an issue with placeholders.
2020-05-22 15:22:32 -07:00
Aleksandr Melnikov
bd38568e6b Fixing "is_archived" not being set on insert, which had unintentional
consequences for displaying data in UI.
2020-05-22 15:22:14 -07:00
Aleksandr Melnikov
b94aaa8778 Refactoring
- Adding a helper method
https://github.com/onepanelio/core/pull/226#discussion_r428965941
2020-05-22 14:49:01 -07:00
Aleksandr Melnikov
a2521e90f2 Refactoring workflow template archive code.
- Some notes from https://github.com/onepanelio/core/pull/226#discussion_r428964510
Removing archiveWorkflowTemplate, replacing with direct db code.
- Abstraction doesn't help much
Removing DeleteWorkflowTemplateK8S
- Similarly, this abstraction doesn't help. Using direct code
where method was used.
2020-05-22 14:39:39 -07:00
Aleksandr Melnikov
4cdef38325 Refactoring CronWorkflow pkg
- Terminate function will focus on deleting data
- Archive will delete k8s but archive db data
Removing DB and K8s specific methods
- Per code guidelines, these do not add anything by abstracting them away.
2020-05-22 14:30:30 -07:00
Aleksandr Melnikov
16b3f37b1d Refactoring per feedback.
- https://github.com/onepanelio/core/pull/226#discussion_r429046881
Removing helper methods that are not saving code.
- This also fixes k8s / db methods that were exposed from the package.
Instead, using an ArchiveWorkflowExecution function to achieve
the same functionality.
2020-05-22 13:44:00 -07:00
Aleksandr Melnikov
375ef146f3 Removing unused function.
- Referenced: https://github.com/onepanelio/core/pull/226#discussion_r429026779
2020-05-22 12:53:40 -07:00
Aleksandr Melnikov
b91a82ece8 Refactored is_archived columns to be not null, default false.
Fixed the migration down.
2020-05-22 12:43:33 -07:00
Aleksandr Melnikov
bc1236fef3 Updated cron workflow and workflow execution select queries.
- Exclude "is_archived" rows.
2020-05-22 11:59:43 -07:00
Aleksandr Melnikov
d4fbd71d55 Updating workflow execution selection to not return archived executions. 2020-05-21 22:37:50 -07:00
Aleksandr Melnikov
123e8830bf Moving the workflow template clean-up to the end.
- This way, if some part of the process fails, it can be re-run again
for testing.
2020-05-21 22:33:34 -07:00
Aleksandr Melnikov
e8c28175f5 Fixing queries not executing. 2020-05-21 22:33:12 -07:00
Aleksandr Melnikov
860dc7398c Updating function names per feedback. 2020-05-21 22:20:00 -07:00
Aleksandr Melnikov
1a9ce9870d Refactoring DB queries related to archiving.
- Using Squirrel RunWith instead of ToSql.
2020-05-21 22:19:26 -07:00
Rush Tehrani
d273037954 Merge pull request #236 from onepanelio/fix/onepanelio.core.234-workflow.details.issues
Fix/onepanelio.core.234 workflow.details.issues
2020-05-21 16:07:28 -07:00
Andrey Melnikov
6d494a9643 update: added omitempty to json serialization of Parameters so they don't show empty values in the DB parameters. 2020-05-21 15:24:54 -07:00
Aleksandr Melnikov
e6d30407c9 Adding "is_archived" column to cron workflows and workflow executions. 2020-05-21 15:20:08 -07:00
Andrey Melnikov
ea5d4d56fb update: Updated GetWorkflowExecution request to also get information for the workflow template, since we query for it anyway. 2020-05-21 15:13:26 -07:00
Aleksandr Melnikov
92b3b2ae23 Adding index to cron workflows
- uid and namespace
2020-05-21 14:55:52 -07:00
Aleksandr Melnikov
92b9aba0d1 Adding namespace to cron workflow related code. 2020-05-21 12:47:42 -07:00
Aleksandr Melnikov
eed930c7f6 Adding namespace to Cron Workflow.
- Proto files
2020-05-21 12:45:10 -07:00
Aleksandr Melnikov
eb13274243 Added migration to add namespace column to cron workflows
#CORE-227
2020-05-21 12:19:30 -07:00
Rush Tehrani
a15e9fb3d3 Merge pull request #231 from onepanelio/feat/no-compression
feat: don't compress artifacts by default
2020-05-21 10:38:46 -07:00
rushtehrani
79aa54c0c1 don't compress artifacts by default 2020-05-21 08:35:13 -07:00
Aleksandr Melnikov
68ffbb1d93 Refactoring raw SQL to use squirrel. 2020-05-20 15:53:12 -07:00
Aleksandr Melnikov
b79cfa019f Added code to clean up Workflow Executions.
- Removes db and k8s entries.
2020-05-20 14:59:01 -07:00
Aleksandr Melnikov
819f48efde Added code to clean up CronWorkflows when a template is archived.
- Code iterates through all the related CronWorkflows
Deletes their workflowExecutions from k8s and db
Deletes the CronWorkflow from k8s and db
2020-05-20 14:28:05 -07:00
Aleksandr Melnikov
381fba4c8f Refactoring TerminateCronWorkflow into separate methods.
- Need these methods for archiving
2020-05-20 14:18:59 -07:00
Andrey Melnikov
1daca92c3e Merge pull request #215 from onepanelio/feat/archive.workspace.templates
Feat/archive.workspace.templates
2020-05-20 13:36:01 -07:00
Aleksandr Melnikov
81566969c7 Merge pull request #223 from onepanelio/feat/ns-scoped-artifact-config
feat: ns scoped artifact config
2020-05-20 13:32:19 -07:00
Rush Tehrani
af98871c0f Merge pull request #220 from onepanelio/fix/crashing.workflow.execution.watch
fix: fixed an issue where workflow watch crashed and closed web…
2020-05-20 13:30:36 -07:00
Andrey Melnikov
60e85c76e5 Merge pull request #224 from onepanelio/feat/core.214.errors
fix: added more detailed error message for 409 workspace template to …
2020-05-20 12:30:31 -07:00
Andrey Melnikov
d4f849073c fix: added more detailed error message for 409 workspace template to distinguish between archived workspace taking the name, or another template.
Also changed IsArchived to be a bool type instead of string for workspace template type, as that's what it is in the database.
2020-05-20 12:29:28 -07:00
rushtehrani
6d0260a623 get artifactRepository config separately 2020-05-20 12:15:53 -07:00
Aleksandr Melnikov
37350f78fb Added DeleteWorkflowTemplate function. 2020-05-20 12:01:14 -07:00
Andrey Melnikov
f3deea797b update: reworked watching workflow execution to keep watching until the workflow is done or failed. 2020-05-20 11:23:03 -07:00
Aleksandr Melnikov
adf117d56b Adding notes about utils and pkg directories. 2020-05-20 09:50:50 -07:00
Andrey Melnikov
dc1972a808 fix: (WIP) fixed an issue where workflow watch crashed and closed websocket, despite the workflow still running. 2020-05-19 20:59:05 -07:00
rushtehrani
609f24fcb2 update documentation 2020-05-19 18:03:58 -07:00
rushtehrani
933e1fa6fd add json tags for proper marshalling 2020-05-19 17:53:58 -07:00
rushtehrani
a7d075e7c7 use correct http method 2020-05-19 17:40:22 -07:00
rushtehrani
2df35cb27e add workflow status webhook 2020-05-19 17:33:02 -07:00
Aleksandr Melnikov
a46864a38f Ran into a case where the index being created already exists.
- Minor formatting
2020-05-19 15:13:53 -07:00
Aleksandr Melnikov
0aced56569 Added checking for existence of constraints.
- Since this is run on start-up and not in production, we're fine
2020-05-19 15:13:27 -07:00
rushtehrani
227d9c0d4e move functions to respective types 2020-05-19 14:57:41 -07:00
Andrey Melnikov
e0096f9be6 documentation: for ArchiveWorkspaceTemplate 2020-05-19 13:57:44 -07:00
Andrey Melnikov
4f8a92c7a4 fix: added case where a workspace is terminating - a workspace can be archived if all of it's workspaces are terminating. 2020-05-19 13:54:01 -07:00
Andrey Melnikov
21baabd634 update: check if workspace template has running workspaces before archiving it. 2020-05-19 13:47:38 -07:00
rushtehrani
260dd334f6 update api + remove unused import 2020-05-19 12:57:37 -07:00
Andrey Melnikov
9deee0cc8c Merge pull request #213 from onepanelio/feat/resource-env-vars
feat: resource env vars
2020-05-19 12:43:55 -07:00
rushtehrani
8540bb82b7 add comment to function + named return value 2020-05-19 12:40:22 -07:00
rushtehrani
ac8c622769 remove length check since range will not iterate on 0 length slices 2020-05-19 12:31:15 -07:00
Rush Tehrani
e75170d468 Merge pull request #205 from onepanelio/fix/labels
fix: remove label uid and fix migration
2020-05-19 11:38:48 -07:00
Andrey Melnikov
2c9dbf52b3 feature: Added ArchiveWorkspaceTemplate endpoint.
update: listing workspace templates ignores archived ones now.
2020-05-19 11:27:19 -07:00
rushtehrani
679d7e50b5 add resource env vars 2020-05-18 22:10:44 -07:00
rushtehrani
3f5108121b remove unused methods 2020-05-18 21:43:02 -07:00
rushtehrani
8ddab20769 append artifact repository to outputs as well if only key is provided 2020-05-18 19:49:18 -07:00
Andrey Melnikov
afda5003e7 fix: issue where workspace labels were not persisting on creation 2020-05-18 19:19:16 -07:00
Rush Tehrani
ac229239fa Merge pull request #210 from onepanelio/feat/core.208-expose.isauthorized
Feat/core.208 expose.isauthorized
2020-05-18 18:20:45 -07:00
rushtehrani
7c5f79ac60 add conditional uq index 2020-05-18 17:21:37 -07:00
Aleksandr Melnikov
abea64f05f Merge pull request #209 from onepanelio/feat/input-artifacts-config
feat: update namespace config structure
2020-05-18 16:53:51 -07:00
Andrey Melnikov
72fbff18cd fix: issue where workflow template labels did not work 2020-05-18 16:38:17 -07:00
rushtehrani
674c4f81e5 inject default artifact repository 2020-05-18 15:48:38 -07:00
Aleksandr Melnikov
e2d286356f Updating isAuthorized function name to isValidToken
- Simplified the returned values to just err.
- Updating related code
2020-05-18 14:17:38 -07:00
Aleksandr Melnikov
8f94318944 Renaming err2. 2020-05-18 14:03:58 -07:00
Aleksandr Melnikov
e0cca02a3a Added IsAuthorized function to AuthServer
- Put a helper function into isAuthorized.
2020-05-18 13:49:31 -07:00
Aleksandr Melnikov
2b67724e35 Adding IsAuthorized endpoint. 2020-05-18 13:49:27 -07:00
Andrey Melnikov
66760c5f44 fix: issue where labels were not editable for workspaces. 2020-05-18 13:09:02 -07:00
Andrey Melnikov
756010958d fix: GetWorkflowExecution now gets the same columns as List.
Also minor cleanup with method calls.
2020-05-18 12:47:04 -07:00
rushtehrani
cf7d52bb19 namespace config updates 2020-05-18 12:34:05 -07:00
Andrey Melnikov
14af381877 fix: issue where cloning a workflow by uid didn't work. 2020-05-17 14:03:23 -07:00
Andrey Melnikov
f8d7ec73ba fix: deleting labels and getting labels for workflow execution
* Fixed issue where ReplaceLabels did not work when no labels were passed in (a delete essentially)
* Updated workflow execution to also get the labels
* Removed unusued GetResourceIdBuilder method.
2020-05-17 13:25:08 -07:00
Andrey Melnikov
b9ccacc2ea fix: issue where workspace template labels were not working. 2020-05-16 17:37:47 -07:00
Aleksandr Melnikov
a19ae1c1c3 Merge pull request #206 from onepanelio/fix/cron
fix: cron workflow execution
2020-05-15 15:26:40 -07:00
rushtehrani
094503174c remove uid from workspace_template_versions 2020-05-15 13:41:56 -07:00
rushtehrani
1eb25e1b67 fix migrations 2020-05-15 13:27:02 -07:00
rushtehrani
fb09fb621d fix migrations 2020-05-15 13:11:04 -07:00
Andrey Melnikov
feeb42a038 fix: workflow_execution returns a pointer to workflow with get method, so type cast needs to reflect this. 2020-05-15 12:38:13 -07:00
rushtehrani
655bb3c15f don't generate UUID 2020-05-15 12:31:19 -07:00
rushtehrani
96a969fbdb remove label uid and fix migration 2020-05-15 11:25:45 -07:00
Rush Tehrani
84c19a231c Merge pull request #204 from onepanelio/feature/workspace.adjustments
Feature/workspace.adjustments
2020-05-14 20:45:04 -07:00
Rush Tehrani
c075719165 Merge pull request #201 from onepanelio/feat/combined
uid + env var changes
2020-05-14 20:41:15 -07:00
Andrey Melnikov
bad6fe47ec comment: added a comment explaining why we get templateParameters for workspace 2020-05-14 20:37:57 -07:00
rushtehrani
662f353512 update WorkflowExecutionStatisticReport struct 2020-05-14 20:19:20 -07:00
Andrey Melnikov
1595594dc8 fix: added back function that went missing. 2020-05-14 19:18:55 -07:00
rushtehrani
7eac879f40 gen with 3.11.4 version of protoc 2020-05-14 17:20:13 -07:00
Aleksandr Melnikov
56314a0850 Updating pb files. 2020-05-14 17:13:57 -07:00
Aleksandr Melnikov
62c8f5dcb2 Adding support for terminated workflow executions.
- When terminating, adding started_at and finished_at timestamps
Updated workflow_template.proto to return the count of terminated executions.
- Updating supporting code
2020-05-14 17:13:44 -07:00
Andrey Melnikov
21099b7627 update: Added template parameters to a workspace.
This is so we can get the options from a workflow template version, since the parameters for a workspace do not store options.
2020-05-14 16:45:48 -07:00
rushtehrani
61704062ba fix template version update uid 2020-05-14 15:57:44 -07:00
rushtehrani
f530a7fac2 fix workflowTemplate and version uid 2020-05-14 15:46:58 -07:00
Aleksandr Melnikov
076917278b Consolidated UID generation for WorkflowTemplate and WorkspaceTemplate 2020-05-14 15:04:49 -07:00
Aleksandr Melnikov
6a27719167 Updating TerminateWorkflowExecution to not remove the DB workflow entry.
- This keeps the Workflow in the UI list.
2020-05-14 13:47:10 -07:00
Andrey Melnikov
c9438a344b revert: undid storing the options as those can be obtained from the workflow template version. 2020-05-14 11:27:17 -07:00
Andrey Melnikov
9723f5685a update: store workspace parameter options in db 2020-05-14 11:19:55 -07:00
rushtehrani
195a332281 remove unused code 2020-05-14 10:45:38 -07:00
rushtehrani
4aeee1f2ac update api gen 2020-05-14 10:34:04 -07:00
Aleksandr Melnikov
9e48c3b406 Updating name generated to use onepanel uid generation. 2020-05-14 10:31:33 -07:00
Aleksandr Melnikov
3c0a138642 Adding development notes on how to develop core with minikube.
- Added disclaimer about minikube and driver VMWare.
2020-05-14 10:31:33 -07:00
Aleksandr Melnikov
fc10444656 Updating name to uid in cron_workflow and related code. 2020-05-14 10:31:33 -07:00
Aleksandr Melnikov
20151d5108 Adding generated proto files. 2020-05-14 10:31:33 -07:00
Aleksandr Melnikov
bcc72e2567 Changing name to uid for cron_workflow proto requests. 2020-05-14 10:31:33 -07:00
Aleksandr Melnikov
735b10c025 Refactored name to uid. 2020-05-14 10:31:33 -07:00
Aleksandr Melnikov
460b7c0604 Putting UID back as part of the WorkflowExecution response. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
a400d64c81 Revert "Removing uid parameter from WorkflowExecution message."
This reverts commit d9e6c3195a3990dd363b79d9e834a220d6cf499d.

Per discussion, name is okay to return as part of the response.
- It will not be set by user for workflows
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
c414673b13 Adding generated pb.go files. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
70e38c99c9 Removing uid parameter from WorkflowExecution message. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
b41c2ea848 Changed name to uid for CloneWorkflowExecution.
- Added supporting changes
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
c1ce0ad17b Changed name to uid for WatchWorkflowExecution. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
2048b7a4eb Using Onepanel UID generator. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
d308761f27 Changed name to uid for GetWorkflowExecution. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
8f257ca73e Removing UID as a value returned by the API request.
- This value is not managed by the user in the UI
- It may impact the UI code, to be determined
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
452bbfe258 Changing "name" into "uid" for Workflow Execution paths.
- WIP, updates to Core API code remaining.
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
4ad388e892 Adding import. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
b89a31323d Fixing error message.
- This is specific to us because of how we combine uid and namespace to create the subdomain.
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
18a795f129 Using GenerateUID to clean up the names. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
184bb1247d Removing sys-uid appending.
- Workflow generates the name on creation. We're continuing to use
workflow.name.
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
5e86a0e2aa Removing unused namespace parameter. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
2daa821cfb Removing label.WorkflowUid from label, for workflow execution. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
4bf928531a Fixing method name to fit go convention, per feedback. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
f437c9f0f9 Renaming function name per feedback.
- This is a onepanel uid.
2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
c7bd017725 Fixing error information. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
1420248489 Removing un-used function. 2020-05-14 10:29:55 -07:00
Aleksandr Melnikov
998d6bcca4 Removing injected "sys-uid" since we're injecting it before createWorkflow is called. 2020-05-14 10:29:08 -07:00
Aleksandr Melnikov
f7d20e9d54 Exiting loop once param found. 2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
263f963a4c Using parameters instead of labels. 2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
6111abd740 Adding sys-uid to CreateWorkflowExecution.
- Appending if it does not exist
2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
2a88ff8234 Changing length check. 2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
68e7b6b10f Refactoring uid and namespace to be a maximum length of 30.
- 60 altogether
The reason is we use <uid>--<ns>.<domain> for workspace urls.
- The maximum length for the subdomain is 63, per k8s restriction.
These changes will result in a subdomain max of 62 (including the --).
2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
6ce6991156 Changing uid varchar length. 2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
55db5f2708 Adding util function to generate k8s compatible uids (to be used
for k8s name).
2020-05-14 10:27:15 -07:00
Aleksandr Melnikov
963dd9adcc Refactoring migrations.
- uid is now 63 chars long, to fit k8s requirement
- Updating unique indices to use uid and namespace
2020-05-14 10:27:15 -07:00
rushtehrani
e5f5b8d183 fix typo 2020-05-14 01:05:49 -07:00
rushtehrani
c121116b9d move envfrom to util 2020-05-14 00:33:46 -07:00
rushtehrani
dd9e64ccf6 fix envvar mount issue 2020-05-13 23:35:30 -07:00
rushtehrani
5fe29d5f58 add precedence to env vars 2020-05-13 23:05:09 -07:00
rushtehrani
3edbc809de use EnvFrom for mounting env vars in workflows 2020-05-13 21:53:33 -07:00
rushtehrani
fd3dcdec9c fix constant name 2020-05-13 21:34:07 -07:00
rushtehrani
c7caeeb70a add env var to workspace 2020-05-13 21:30:52 -07:00
Rush Tehrani
089a49f8c3 Merge pull request #199 from onepanelio/feature/workspace.adjustments
fix: workspace count did not exclude terminated workspaces.
2020-05-13 12:55:37 -07:00
Andrey Melnikov
b5e5cbf2c6 fix: workspace count did not exclude terminated workspaces. 2020-05-13 12:38:52 -07:00
Andrey Melnikov
e2bc242657 Merge pull request #198 from onepanelio/feat/workspaces
feat: workspace updates
2020-05-13 11:48:52 -07:00
rushtehrani
23a70de39b exclude terminated workspaces from list 2020-05-12 19:54:51 -07:00
rushtehrani
dac2029969 update workspace params 2020-05-12 19:41:32 -07:00
rushtehrani
356459a011 started => launching 2020-05-12 18:17:37 -07:00
Rush Tehrani
a92cd13ffb Merge pull request #197 from onepanelio/feat/url.updates
Feat/url.updates
2020-05-12 16:41:49 -07:00
rushtehrani
7ef68ade48 workspace update 2020-05-12 16:04:35 -07:00
Andrey Melnikov
1c48a9a954 update: Get Workspace to use column select methods.
This adds in workspace template name among other columns.
2020-05-12 15:55:38 -07:00
Andrey Melnikov
99a5d24279 fix: issue where paginationw was not being applied to workspace template query 2020-05-12 10:46:57 -07:00
Andrey Melnikov
5621477465 update: updated logic to get protocol for workspaces to be based off onepanel api url 2020-05-12 10:35:20 -07:00
Rush Tehrani
7772a20482 Merge pull request #196 from onepanelio/feature/workspace.path
fix: issue where url was not selected for workspaces.
2020-05-11 19:16:11 -07:00
Andrey Melnikov
5fdaf16c47 fix: issue where url was not selected for workspaces. 2020-05-11 19:07:31 -07:00
Rush Tehrani
b1559ddf23 Merge pull request #195 from onepanelio/feature/workspace.path
feature: added path for workspaces
2020-05-11 18:51:45 -07:00
Andrey Melnikov
799330b50a fix: typo for inserting workspaces 2020-05-11 18:07:55 -07:00
Andrey Melnikov
4d4d5a23b1 update: rename path -> url 2020-05-11 17:52:20 -07:00
Andrey Melnikov
d11a2c8aa5 fix: added http prefix for path. We automatically redirect to https, so that should handle that case. 2020-05-11 16:56:48 -07:00
Andrey Melnikov
effd641bc7 feature: added path for workspaces 2020-05-11 16:48:48 -07:00
Andrey Melnikov
9e2f065d5d Merge pull request #194 from onepanelio/fix/circular-assignment
remove circular assignment
2020-05-11 16:42:17 -07:00
rushtehrani
43e3a1a97b remove circular assignment 2020-05-11 16:40:44 -07:00
Andrey Melnikov
4be301eb46 fix: sys-host was not being changed with mapping values. 2020-05-11 15:25:39 -07:00
Rush Tehrani
e85561a651 Merge pull request #193 from onepanelio/feature/workspace.api.updates
Feature/workspace.api.updates
2020-05-11 14:15:50 -07:00
Rush Tehrani
35bca23f4d Merge pull request #192 from onepanelio/feat/workspaces
feat: workspace update using uid + curl node with retries
2020-05-11 14:15:24 -07:00
Andrey Melnikov
1f9d68c382 Merge branch 'feat/simplify.create.workflow.execution' into feature/workspace.api.updates 2020-05-11 13:45:09 -07:00
Andrey Melnikov
9600794c38 update: List Workspaces request to include the workspace template information. 2020-05-11 12:18:31 -07:00
rushtehrani
6c785ed2a6 add is_system to workflow_templates for sys workflows 2020-05-10 20:42:33 -07:00
rushtehrani
1a387f6c72 get the correct version of workspace template 2020-05-10 13:30:20 -07:00
rushtehrani
1b4e16a168 update is_latest when a new workspace template version is added 2020-05-09 20:37:43 -07:00
rushtehrani
90804b77be change update workspace to use uid 2020-05-09 20:26:24 -07:00
Rush Tehrani
b4fc0b024e Merge pull request #191 from onepanelio/feat/simplify.create.workflow.execution
Feat/simplify.create.workflow.execution
2020-05-09 19:11:49 -07:00
Andrey Melnikov
9b8d3e83a9 update: swagger with recent workspace status changes. 2020-05-09 19:08:08 -07:00
rushtehrani
572a20a308 add retries to curl command 2020-05-09 18:52:01 -07:00
Andrey Melnikov
3a9e84c4a5 update: select columns for workspace status. 2020-05-09 18:31:26 -07:00
Andrey Melnikov
d611a8ca0c update: removed fields from workspace that are already in status. 2020-05-09 18:05:08 -07:00
Andrey Melnikov
df7c38de32 update: injectParameters to detect existing parameters by name and override them. 2020-05-08 20:47:50 -07:00
Andrey Melnikov
4543d381ce fix: verb for getting a workspace create -> get 2020-05-08 20:41:16 -07:00
Andrey Melnikov
383e915fa3 update: added labels and workspace type 2020-05-08 20:38:41 -07:00
Andrey Melnikov
5fc913fa7a Merge branch 'feat/simplify.create.workflow.execution' of github.com:onepanelio/core into feat/simplify.create.workflow.execution 2020-05-08 20:38:07 -07:00
Andrey Melnikov
1b30721a05 update: api definition and more fields for workspace. 2020-05-08 20:33:13 -07:00
Andrey Melnikov
8bfbf561a5 update: api definition and more fields for workspace. 2020-05-08 20:16:13 -07:00
Rush Tehrani
2aca938df8 Merge pull request #190 from onepanelio/feat/workspaces
feat: additional workspace fixes and actions
2020-05-08 18:45:12 -07:00
rushtehrani
14c6c6b8a7 resume workspace 2020-05-08 18:43:22 -07:00
rushtehrani
f472b9263e fix issue with workspace creation 2020-05-08 17:57:42 -07:00
Rush Tehrani
a0196f433f Merge pull request #189 from onepanelio/feat/workspaces
feat: use uid in workspaces
2020-05-08 16:21:33 -07:00
rushtehrani
cc7cd1201b check for existing workspace on creation 2020-05-08 16:21:00 -07:00
rushtehrani
de9947defa change namespace and uid to 30 characters each 2020-05-08 15:53:30 -07:00
rushtehrani
841c3bc635 use sys-uid instead of sys-name 2020-05-08 15:10:30 -07:00
rushtehrani
5659975fb9 generate UID based on name 2020-05-08 14:26:10 -07:00
Rush Tehrani
61763f7eaf Merge pull request #188 from onepanelio/feature/simplify.workflow.executions
update: Workflow Execution body into a separate message
2020-05-08 14:25:05 -07:00
Andrey Melnikov
e339e698d0 update: Workflow Execution body into a separate message 2020-05-08 13:25:58 -07:00
Rush Tehrani
79d02f2b5c Merge pull request #185 from onepanelio/feature/simplify.workflow.executions
update: simplified create workflow execution
2020-05-08 13:12:24 -07:00
Rush Tehrani
e7483535f8 Merge pull request #187 from onepanelio/revert-183-feat/simplify.create.workflow.execution
Revert "update: simplified request for creating a workflow execution."
2020-05-08 13:11:37 -07:00
Rush Tehrani
3a8e170e73 Revert "update: simplified request for creating a workflow execution." 2020-05-08 13:11:13 -07:00
Rush Tehrani
828315ef94 Merge pull request #183 from onepanelio/feat/simplify.create.workflow.execution
update: simplified request for creating a workflow execution.
2020-05-08 13:05:40 -07:00
Andrey Melnikov
6e9105a742 update: simplified create workflow execution 2020-05-08 11:21:39 -07:00
Andrey Melnikov
97f9b78efa update: workspaces with labels and simplified use of parameters. 2020-05-08 11:02:42 -07:00
Andrey Melnikov
af6b053147 update: removed inner body from create workflow request. 2020-05-08 09:38:16 -07:00
Rush Tehrani
1480a8da8c Merge pull request #184 from onepanelio/feat/core.124-add.envoy.filter
feat: add envoy filter
2020-05-07 16:32:40 -07:00
Rush Tehrani
a1d74dff42 Merge pull request #176 from onepanelio/feat/core.124-add.envoy.filter
Feat/core.124 add.envoy.filter
2020-05-07 16:31:40 -07:00
Andrey Melnikov
5859da5520 update: simplified request for creating a workflow execution. 2020-05-07 13:36:16 -07:00
Rush Tehrani
473bc9d27a Merge branch 'master' into feat/core.124-add.envoy.filter 2020-05-07 10:29:49 -07:00
Aleksandr Melnikov
49451b5008 Per feedback, using the new auth code logic.
Also, using "apps" instead of "apps/v1"
2020-05-06 14:10:09 -07:00
Aleksandr Melnikov
fae40730ae Fixing the IsAuthorized value checking.
- IsAuthorized would return nil for err, but allowed was false.
The code returned "empty, err", which was "empty, nil".
So nothing was blocked.
- Using status.Error to properly return a 403.
2020-05-04 16:21:17 -07:00
Aleksandr Melnikov
7616a5ff92 Handling an issue if the user is logging in for the first time,
or if they logged out.
- EnvoyFilter would prevent the user from getting to the login page.
Or any page at all, because the "authorization" header would be missing.
Or, the cookie "auth-token".
2020-05-04 16:20:07 -07:00
85 changed files with 6898 additions and 2312 deletions

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,16 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. Please read our contributor guidelines: https://docs.onepanel.ai/docs/getting-started/contributing
2. Prefix the title of this PR with `feat:`, `fix:`, `docs:` or `chore:`, example: `feat: added great feature`
3. If this PR is a feature or enhancement, then create an issue (https://github.com/onepanelio/core/issues) first.
-->
**What this PR does**:
**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes onepanelio/core#<issue-number>`
-->
Fixes onepanelio/core#
**Special notes for your reviewer**:

1
.github/semantic.yml vendored Normal file
View File

@@ -0,0 +1 @@
titleOnly: true

View File

@@ -1,4 +1,4 @@
name: Bump version and create tag
name: Build and publish to Docker Hub
on:
push:
branches:

View File

@@ -1,8 +1,8 @@
name: Publish develop docker image
name: Publish dev docker image
on:
push:
branches:
- develop
- dev
jobs:
build:
runs-on: ubuntu-latest
@@ -13,5 +13,4 @@ jobs:
with:
name: onepanel/core
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
snapshot: true
password: ${{ secrets.DOCKER_HUB_TOKEN }}

View File

@@ -21,7 +21,7 @@ Install gRPC:
go get -u google.golang.org/grpc
```
Download pre-compiled binaries for your platform(protoc-<version>-<platform>.zip) from here: https://github.com/google/protobuf/releases
Download pre-compiled binaries for your platform (protoc-<version>-<platform>.zip) from here: https://github.com/google/protobuf/releases
On macOS or Linux:
@@ -49,5 +49,128 @@ Make sure that your `$GOBIN` is in your `$PATH`.
Generate Go and Swagger APIs:
```bash
make api
make api version=1.0.0
```
## Minikube Debugging and Development
It is possible to access host resources with minikube.
- This means you can run core and core-ui on your machine, and have minikube
execute API calls to your machine.
NOTE:
- Do not use host access with Minikube and VMWare. This has been shown not to work
in our testing.
If you have a work-around, feel free to let us know.
To make this work, some setup is needed.
- Minikube started with driver=virtualbox
Get your Minikube ssh IP
https://minikube.sigs.k8s.io/docs/handbook/host-access/
```shell script
minikube ssh "route -n | grep ^0.0.0.0 | awk '{ print \$2 }'"
```
Example output:
```shell script
10.0.2.2
```
When running core api, add these ENV variables.
```shell script
ONEPANEL_CORE_SERVICE_HOST=10.0.2.2 # IP you just got
ONEPANEL_CORE_SERVICE_PORT=8888 # HTTP Port set in main.go
```
DB Access
- You will need to change the Postgres service from ClusterIP to NodePort
Run
```shell script
minikube service list
```
Look at Postgres, you'll see something like this:
```shell script
$ minikube service list
|----------------------|----------------------------------------|--------------------|--------------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|----------------------|----------------------------------------|--------------------|--------------------------------|
| application-system | application-controller-manager-service | No node port |
| default | kubernetes | No node port |
| kube-system | kube-dns | No node port |
| kubernetes-dashboard | dashboard-metrics-scraper | No node port |
| kubernetes-dashboard | kubernetes-dashboard | No node port |
| onepanel | onepanel-core | http/8888 | http://192.168.99.101:32000 |
| | | grpc/8887 | http://192.168.99.101:32001 |
| onepanel | onepanel-core-ui | http/80 | http://192.168.99.101:32002 |
| onepanel | postgres | 5432 | http://192.168.99.101:31975 |
|----------------------|----------------------------------------|--------------------|--------------------------------|
```
Grab `http://192.168.99.101:31975`
Use this in main.go for the following lines:
```shell script
databaseDataSourceName := fmt.Sprintf("port=31975 host=%v user=%v password=%v dbname=%v sslmode=disable",
"192.168.99.101", config["databaseUsername"], config["databasePassword"], config["databaseName"])
```
This should connect your developing core to the minikube db.
After this, build main.go and run the executable.
- Or use your IDE equivalent
## Code Structure & Organization
### `utils` dir
```shell script
utils/*.go
```
Utils are intended to stand-alone.
- They do not track state
- They are meant to mutate metadata
Do not add onepanel specific code in here.
- Such as "Client"
```shell script
pkg/*.go
```
Code here has to be package friendly.
- Meaning, you can pull the code out into it's own package as needed
That's why you see
```shell script
workspace_template.go
workspace_template_test.go
workspace_template_types.go
```
These can be pulled out into their own package or into a new v2 directory if needed.
You can add
- kubernetes specific operations
- database specific operations
- types
### `cmd` dir
Each source file here is assumed to result in an executable.
- Hence the `package main` at the top of each
Place each source file into it's own folder.
Example source file name: `flush_cache.go`
- Dir structure: `cmd/flush-cache/flush_cache.go`
To avoid errors like this during docker build
```text
# github.com/onepanelio/core/cmd
cmd/goose.go:22:6: main redeclared in this block
previous declaration at cmd/gen-release-md.go:136:6
github.com/onepanelio/core
```
Caused by
```dockerfile
RUN go install -v ./...
```

View File

@@ -5,11 +5,13 @@ COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
RUN go get -u github.com/pressly/goose/cmd/goose
RUN go build -o /go/bin/goose ./cmd/goose/goose.go
FROM golang:1.13.10
COPY --from=builder /go/bin/core .
COPY --from=builder /go/src/db ./db
COPY --from=builder /go/bin/goose .
EXPOSE 8888
EXPOSE 8887

View File

@@ -1,3 +1,5 @@
Copyright 2020 Onepanel, Inc. All rights reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

View File

@@ -1,9 +1,17 @@
COMMIT_HASH=$(shell git rev-parse --short HEAD)
.PHONY: init
init:
ifndef version
$(error version is undefined)
endif
jq:
cat api/apidocs.swagger.json \
| jq 'walk( if type == "object" then with_entries( .key |= sub( "api\\."; "") ) else . end )' \
| jq 'walk( if type == "string" then gsub( "api\\."; "") else . end )' \
| jq '.info.version = "$(version)"' \
> api/api.swagger.json
rm api/apidocs.swagger.json
@@ -16,7 +24,7 @@ protoc:
--grpc-gateway_out=logtostderr=true,allow_delete_body=true:api \
--swagger_out=allow_merge=true,fqn_for_swagger_name=true,allow_delete_body=true,logtostderr=true,simple_operation_ids=true:api
api: protoc jq
api: init protoc jq
docker-build:
docker build -t onepanel-core .

View File

@@ -1,10 +1,15 @@
![Build and publish to Docker Hub](https://github.com/onepanelio/core/workflows/Build%20and%20publish%20to%20Docker%20Hub/badge.svg)
# Onepanel
Welcome to Onepanel! This is the main repository for the API and also where you can submit bugs and enhancement requests.
Welcome to Onepanel! This is the main repository for the API. It is also where you can submit bugs and enhancement requests.
## Getting started
See our [deployment guide](https://onepanelio.github.io/core-docs/docs/deployment/overview) to get started.
See our [Quick start guide](https://docs.onepanel.ai/docs/getting-started/quickstart) to get started.
## Contributing
See our [contribution guide](https://onepanelio.github.io/core-docs/docs/getting-started/contributing) to get started.
See our [Contribution guide](https://docs.onepanel.ai/docs/getting-started/contributing) to get started.
## Acknowledgments
Onepanel uses the excellent [Argo](https://github.com/argoproj/argo) project under the hood to orchestrate workflows.

View File

@@ -31,25 +31,23 @@ var file_api_proto_rawDesc = []byte{
0x0a, 0x09, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x61, 0x70, 0x69,
0x1a, 0x2c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x73, 0x77, 0x61,
0x67, 0x67, 0x65, 0x72, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x8b,
0x02, 0x92, 0x41, 0x87, 0x02, 0x12, 0x74, 0x0a, 0x0d, 0x4f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65,
0x6c, 0x20, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x19, 0x4f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c,
0x20, 0x43, 0x6f, 0x72, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x41, 0x50,
0x49, 0x22, 0x3b, 0x0a, 0x15, 0x4f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x20, 0x43, 0x6f,
0x72, 0x65, 0x20, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x22, 0x68, 0x74, 0x74, 0x70,
0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f,
0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x32, 0x0b,
0x31, 0x2e, 0x30, 0x2e, 0x30, 0x2d, 0x62, 0x65, 0x74, 0x61, 0x31, 0x1a, 0x0e, 0x6c, 0x6f, 0x63,
0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x3a, 0x38, 0x38, 0x38, 0x38, 0x2a, 0x02, 0x01, 0x02, 0x32,
0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f,
0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a,
0x73, 0x6f, 0x6e, 0x5a, 0x49, 0x0a, 0x47, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12,
0x3d, 0x08, 0x02, 0x12, 0x28, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2c, 0x20, 0x70, 0x72, 0x65, 0x66, 0x69,
0x78, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x1a, 0x0d, 0x61,
0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x02, 0x62, 0x0c,
0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0xef,
0x01, 0x92, 0x41, 0xeb, 0x01, 0x12, 0x58, 0x0a, 0x08, 0x4f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65,
0x6c, 0x12, 0x0c, 0x4f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x20, 0x41, 0x50, 0x49, 0x22,
0x36, 0x0a, 0x10, 0x4f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c, 0x20, 0x70, 0x72, 0x6f, 0x6a,
0x65, 0x63, 0x74, 0x12, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x65, 0x70, 0x61, 0x6e, 0x65, 0x6c,
0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x32, 0x06, 0x30, 0x2e, 0x31, 0x30, 0x2e, 0x30, 0x1a,
0x0e, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x3a, 0x38, 0x38, 0x38, 0x38, 0x2a,
0x02, 0x01, 0x02, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x5a, 0x49, 0x0a, 0x47, 0x0a, 0x06, 0x42, 0x65, 0x61,
0x72, 0x65, 0x72, 0x12, 0x3d, 0x08, 0x02, 0x12, 0x28, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x2c, 0x20, 0x70,
0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x42, 0x65, 0x61, 0x72, 0x65,
0x72, 0x1a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x20, 0x02, 0x62, 0x0c, 0x0a, 0x0a, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x72, 0x65, 0x72, 0x12, 0x00,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_api_proto_goTypes = []interface{}{}

View File

@@ -6,11 +6,11 @@ import "protoc-gen-swagger/options/annotations.proto";
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = {
info: {
title: "Onepanel Core";
description: "Onepanel Core project API";
version: "1.0.0-beta1";
title: "Onepanel";
description: "Onepanel API";
version: "0.10.0";
contact: {
name: "Onepanel Core project";
name: "Onepanel project";
url: "https://github.com/onepanelio/core";
};
};

View File

@@ -1,11 +1,11 @@
{
"swagger": "2.0",
"info": {
"title": "Onepanel Core",
"description": "Onepanel Core project API",
"version": "1.0.0-beta1",
"title": "Onepanel",
"description": "Onepanel API",
"version": "0.10.0",
"contact": {
"name": "Onepanel Core project",
"name": "Onepanel project",
"url": "https://github.com/onepanelio/core"
}
},
@@ -21,6 +21,28 @@
"application/json"
],
"paths": {
"/apis/v1beta1/auth": {
"post": {
"operationId": "IsAuthorized",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/IsAuthorizedResponse"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"tags": [
"AuthService"
]
}
},
"/apis/v1beta1/auth/token": {
"post": {
"operationId": "IsValidToken",
@@ -165,7 +187,7 @@
]
}
},
"/apis/v1beta1/{namespace}/cron_workflow/{name}": {
"/apis/v1beta1/{namespace}/cron_workflow/{uid}": {
"get": {
"operationId": "GetCronWorkflow",
"responses": {
@@ -190,7 +212,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -224,7 +246,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -293,9 +315,9 @@
]
}
},
"/apis/v1beta1/{namespace}/cron_workflows/{name}/terminate": {
"/apis/v1beta1/{namespace}/cron_workflows/{uid}": {
"delete": {
"operationId": "TerminateCronWorkflow",
"operationId": "DeleteCronWorkflow",
"responses": {
"200": {
"description": "A successful response.",
@@ -318,7 +340,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -762,7 +784,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/WorkflowExecution"
"$ref": "#/definitions/CreateWorkflowExecutionBody"
}
}
],
@@ -771,7 +793,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}": {
"get": {
"operationId": "GetWorkflowExecution",
"responses": {
@@ -796,7 +818,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -830,7 +852,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -841,7 +863,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/artifacts/{key}": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/artifacts/{key}": {
"get": {
"operationId": "GetArtifact",
"responses": {
@@ -866,7 +888,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -883,7 +905,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/cron_start_statistics": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/cron_start_statistics": {
"post": {
"operationId": "CronStartWorkflowExecutionStatistic",
"responses": {
@@ -908,7 +930,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -927,7 +949,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/files/{path}": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/files/{path}": {
"get": {
"operationId": "ListFiles",
"responses": {
@@ -952,7 +974,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -969,7 +991,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/pods/{podName}/containers/{containerName}/logs": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/pods/{podName}/containers/{containerName}/logs": {
"get": {
"operationId": "GetWorkflowExecutionLogs",
"responses": {
@@ -1003,7 +1025,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -1026,7 +1048,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/pods/{podName}/metrics": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/pods/{podName}/metrics": {
"get": {
"operationId": "GetWorkflowExecutionMetrics",
"responses": {
@@ -1051,7 +1073,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -1068,7 +1090,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/resubmit": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/resubmit": {
"put": {
"operationId": "ResubmitWorkflowExecution",
"responses": {
@@ -1093,7 +1115,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -1104,7 +1126,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/statistics": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/statistics": {
"post": {
"operationId": "AddWorkflowExecutionStatistics",
"responses": {
@@ -1129,7 +1151,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -1148,7 +1170,51 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/terminate": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/status": {
"put": {
"operationId": "UpdateWorkflowExecutionStatus",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"properties": {}
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/WorkflowExecutionStatus"
}
}
],
"tags": [
"WorkflowService"
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/terminate": {
"put": {
"operationId": "TerminateWorkflowExecution",
"responses": {
@@ -1173,7 +1239,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -1184,7 +1250,7 @@
]
}
},
"/apis/v1beta1/{namespace}/workflow_executions/{name}/watch": {
"/apis/v1beta1/{namespace}/workflow_executions/{uid}/watch": {
"get": {
"operationId": "WatchWorkflowExecution",
"responses": {
@@ -1218,7 +1284,7 @@
"type": "string"
},
{
"name": "name",
"name": "uid",
"in": "path",
"required": true,
"type": "string"
@@ -1740,50 +1806,6 @@
]
}
},
"/apis/v1beta1/{namespace}/workspace_templates/{name}": {
"put": {
"operationId": "UpdateWorkspaceTemplate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/WorkspaceTemplate"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "name",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/WorkspaceTemplate"
}
}
],
"tags": [
"WorkspaceTemplateService"
]
}
},
"/apis/v1beta1/{namespace}/workspace_templates/{uid}": {
"get": {
"operationId": "GetWorkspaceTemplate",
@@ -1825,6 +1847,84 @@
"tags": [
"WorkspaceTemplateService"
]
},
"put": {
"operationId": "UpdateWorkspaceTemplate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/WorkspaceTemplate"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/WorkspaceTemplate"
}
}
],
"tags": [
"WorkspaceTemplateService"
]
}
},
"/apis/v1beta1/{namespace}/workspace_templates/{uid}/archive": {
"put": {
"operationId": "ArchiveWorkspaceTemplate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/WorkspaceTemplate"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"WorkspaceTemplateService"
]
}
},
"/apis/v1beta1/{namespace}/workspace_templates/{uid}/versions": {
@@ -1978,7 +2078,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Workspace"
"$ref": "#/definitions/CreateWorkspaceBody"
}
}
],
@@ -1988,6 +2088,40 @@
}
},
"/apis/v1beta1/{namespace}/workspaces/{uid}": {
"get": {
"operationId": "GetWorkspace",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/Workspace"
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"WorkspaceService"
]
},
"delete": {
"operationId": "DeleteWorkspace",
"responses": {
@@ -2021,6 +2155,48 @@
"tags": [
"WorkspaceService"
]
},
"put": {
"operationId": "UpdateWorkspace",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"properties": {}
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UpdateWorkspaceBody"
}
}
],
"tags": [
"WorkspaceService"
]
}
},
"/apis/v1beta1/{namespace}/workspaces/{uid}/pause": {
@@ -2059,6 +2235,42 @@
]
}
},
"/apis/v1beta1/{namespace}/workspaces/{uid}/resume": {
"put": {
"operationId": "ResumeWorkspace",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"properties": {}
}
},
"default": {
"description": "An unexpected error response",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
},
"parameters": [
{
"name": "namespace",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "uid",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"WorkspaceService"
]
}
},
"/apis/v1beta1/{namespace}/workspaces/{uid}/status": {
"put": {
"operationId": "UpdateWorkspaceStatus",
@@ -2317,12 +2529,63 @@
}
}
},
"CreateWorkflowExecutionBody": {
"type": "object",
"properties": {
"workflowTemplateUid": {
"type": "string"
},
"workflowTemplateVersion": {
"type": "string",
"format": "int64"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/Parameter"
}
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue"
}
}
}
},
"CreateWorkspaceBody": {
"type": "object",
"properties": {
"workspaceTemplateUid": {
"type": "string"
},
"workspaceTemplateVersion": {
"type": "string",
"format": "int64"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/Parameter"
}
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue"
}
}
}
},
"CronWorkflow": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"uid": {
"type": "string"
},
"manifest": {
"type": "string"
},
@@ -2334,6 +2597,9 @@
"items": {
"$ref": "#/definitions/KeyValue"
}
},
"namespace": {
"type": "string"
}
}
},
@@ -2414,6 +2680,15 @@
}
}
},
"IsAuthorizedResponse": {
"type": "object",
"properties": {
"authorized": {
"type": "boolean",
"format": "boolean"
}
}
},
"IsValidTokenResponse": {
"type": "object",
"properties": {
@@ -2792,6 +3067,23 @@
}
}
},
"UpdateWorkspaceBody": {
"type": "object",
"properties": {
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/Parameter"
}
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue"
}
}
}
},
"WorkflowExecution": {
"type": "object",
"properties": {
@@ -2854,6 +3146,18 @@
"failed": {
"type": "integer",
"format": "int32"
},
"terminated": {
"type": "integer",
"format": "int32"
}
}
},
"WorkflowExecutionStatus": {
"type": "object",
"properties": {
"phase": {
"type": "string"
}
}
},
@@ -2863,6 +3167,9 @@
"createdAt": {
"type": "string"
},
"modifiedAt": {
"type": "string"
},
"uid": {
"type": "string"
},
@@ -2935,6 +3242,15 @@
"items": {
"$ref": "#/definitions/KeyValue"
}
},
"url": {
"type": "string"
},
"templateParameters": {
"type": "array",
"items": {
"$ref": "#/definitions/Parameter"
}
}
}
},
@@ -2980,6 +3296,16 @@
},
"workflowTemplate": {
"$ref": "#/definitions/WorkflowTemplate"
},
"labels": {
"type": "array",
"items": {
"$ref": "#/definitions/KeyValue"
}
},
"isArchived": {
"type": "boolean",
"format": "boolean"
}
}
},

View File

@@ -31,6 +31,132 @@ const (
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type IsAuthorizedRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Verb string `protobuf:"bytes,2,opt,name=verb,proto3" json:"verb,omitempty"`
Group string `protobuf:"bytes,3,opt,name=group,proto3" json:"group,omitempty"`
Resource string `protobuf:"bytes,4,opt,name=resource,proto3" json:"resource,omitempty"`
ResourceName string `protobuf:"bytes,5,opt,name=resourceName,proto3" json:"resourceName,omitempty"`
}
func (x *IsAuthorizedRequest) Reset() {
*x = IsAuthorizedRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *IsAuthorizedRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IsAuthorizedRequest) ProtoMessage() {}
func (x *IsAuthorizedRequest) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use IsAuthorizedRequest.ProtoReflect.Descriptor instead.
func (*IsAuthorizedRequest) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{0}
}
func (x *IsAuthorizedRequest) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *IsAuthorizedRequest) GetVerb() string {
if x != nil {
return x.Verb
}
return ""
}
func (x *IsAuthorizedRequest) GetGroup() string {
if x != nil {
return x.Group
}
return ""
}
func (x *IsAuthorizedRequest) GetResource() string {
if x != nil {
return x.Resource
}
return ""
}
func (x *IsAuthorizedRequest) GetResourceName() string {
if x != nil {
return x.ResourceName
}
return ""
}
type IsAuthorizedResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"`
}
func (x *IsAuthorizedResponse) Reset() {
*x = IsAuthorizedResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *IsAuthorizedResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IsAuthorizedResponse) ProtoMessage() {}
func (x *IsAuthorizedResponse) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use IsAuthorizedResponse.ProtoReflect.Descriptor instead.
func (*IsAuthorizedResponse) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{1}
}
func (x *IsAuthorizedResponse) GetAuthorized() bool {
if x != nil {
return x.Authorized
}
return false
}
type TokenWrapper struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -42,7 +168,7 @@ type TokenWrapper struct {
func (x *TokenWrapper) Reset() {
*x = TokenWrapper{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[0]
mi := &file_auth_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -55,7 +181,7 @@ func (x *TokenWrapper) String() string {
func (*TokenWrapper) ProtoMessage() {}
func (x *TokenWrapper) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[0]
mi := &file_auth_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -68,7 +194,7 @@ func (x *TokenWrapper) ProtoReflect() protoreflect.Message {
// Deprecated: Use TokenWrapper.ProtoReflect.Descriptor instead.
func (*TokenWrapper) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{0}
return file_auth_proto_rawDescGZIP(), []int{2}
}
func (x *TokenWrapper) GetToken() string {
@@ -89,7 +215,7 @@ type IsValidTokenRequest struct {
func (x *IsValidTokenRequest) Reset() {
*x = IsValidTokenRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[1]
mi := &file_auth_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -102,7 +228,7 @@ func (x *IsValidTokenRequest) String() string {
func (*IsValidTokenRequest) ProtoMessage() {}
func (x *IsValidTokenRequest) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[1]
mi := &file_auth_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -115,7 +241,7 @@ func (x *IsValidTokenRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use IsValidTokenRequest.ProtoReflect.Descriptor instead.
func (*IsValidTokenRequest) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{1}
return file_auth_proto_rawDescGZIP(), []int{3}
}
func (x *IsValidTokenRequest) GetToken() *TokenWrapper {
@@ -130,13 +256,13 @@ type IsValidTokenResponse struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"`
}
func (x *IsValidTokenResponse) Reset() {
*x = IsValidTokenResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[2]
mi := &file_auth_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -149,7 +275,7 @@ func (x *IsValidTokenResponse) String() string {
func (*IsValidTokenResponse) ProtoMessage() {}
func (x *IsValidTokenResponse) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[2]
mi := &file_auth_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -162,7 +288,7 @@ func (x *IsValidTokenResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use IsValidTokenResponse.ProtoReflect.Descriptor instead.
func (*IsValidTokenResponse) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{2}
return file_auth_proto_rawDescGZIP(), []int{4}
}
func (x *IsValidTokenResponse) GetDomain() string {
@@ -186,7 +312,7 @@ type IsWorkspaceAuthenticatedRequest struct {
func (x *IsWorkspaceAuthenticatedRequest) Reset() {
*x = IsWorkspaceAuthenticatedRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[3]
mi := &file_auth_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -199,7 +325,7 @@ func (x *IsWorkspaceAuthenticatedRequest) String() string {
func (*IsWorkspaceAuthenticatedRequest) ProtoMessage() {}
func (x *IsWorkspaceAuthenticatedRequest) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[3]
mi := &file_auth_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -212,7 +338,7 @@ func (x *IsWorkspaceAuthenticatedRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use IsWorkspaceAuthenticatedRequest.ProtoReflect.Descriptor instead.
func (*IsWorkspaceAuthenticatedRequest) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{3}
return file_auth_proto_rawDescGZIP(), []int{5}
}
func (x *IsWorkspaceAuthenticatedRequest) GetFQDN() string {
@@ -250,45 +376,64 @@ var file_auth_proto_rawDesc = []byte{
0x69, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e,
0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x0c,
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05,
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b,
0x65, 0x6e, 0x22, 0x3e, 0x0a, 0x13, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x05, 0x74, 0x6f, 0x6b,
0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x54,
0x6f, 0x6b, 0x65, 0x6e, 0x57, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x52, 0x05, 0x74, 0x6f, 0x6b,
0x65, 0x6e, 0x22, 0x2e, 0x0a, 0x14, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f,
0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61,
0x69, 0x6e, 0x22, 0xb3, 0x01, 0x0a, 0x1f, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x51, 0x44, 0x4e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x46, 0x51, 0x44, 0x4e, 0x12, 0x28, 0x0a, 0x0f, 0x58, 0x4f,
0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0f, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4d, 0x65,
0x74, 0x68, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61,
0x6c, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x12, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x41, 0x75, 0x74, 0x68, 0x6f,
0x72, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61,
0x6c, 0x55, 0x72, 0x69, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x58, 0x4f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x72, 0x69, 0x32, 0x80, 0x02, 0x0a, 0x0b, 0x41, 0x75, 0x74,
0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6c, 0x0a, 0x0c, 0x49, 0x73, 0x56, 0x61,
0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49,
0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64,
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a,
0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x82, 0x01, 0x0a, 0x18, 0x49, 0x73, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61,
0x74, 0x65, 0x64, 0x12, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x79, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x42, 0x20, 0x0a, 0x04, 0x48, 0x45, 0x41,
0x44, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x01, 0x0a,
0x13, 0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x76, 0x65, 0x72, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x76, 0x65, 0x72, 0x62, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1a, 0x0a, 0x08,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x36, 0x0a, 0x14,
0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a,
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
0x69, 0x7a, 0x65, 0x64, 0x22, 0x24, 0x0a, 0x0c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x57, 0x72, 0x61,
0x70, 0x70, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x3e, 0x0a, 0x13, 0x49, 0x73,
0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x27, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x57, 0x72, 0x61, 0x70,
0x70, 0x65, 0x72, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x2e, 0x0a, 0x14, 0x49, 0x73,
0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0xb3, 0x01, 0x0a, 0x1f, 0x49,
0x73, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e,
0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12,
0x0a, 0x04, 0x46, 0x51, 0x44, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x46, 0x51,
0x44, 0x4e, 0x12, 0x28, 0x0a, 0x0f, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4d,
0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x58, 0x4f, 0x72,
0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x12,
0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69,
0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x61, 0x6c, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c,
0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x72, 0x69, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0c, 0x58, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x72, 0x69,
0x32, 0xe1, 0x02, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x12, 0x6c, 0x0a, 0x0c, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x49, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x22, 0x18, 0x2f,
0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74,
0x68, 0x2f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x3a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x82,
0x01, 0x0a, 0x18, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x75,
0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x24, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x41, 0x75, 0x74,
0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x22, 0x42, 0x20, 0x0a, 0x04, 0x48, 0x45, 0x41, 0x44, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x73,
0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x74, 0x6f,
0x6b, 0x65, 0x6e, 0x12, 0x5f, 0x0a, 0x0c, 0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69,
0x7a, 0x65, 0x64, 0x12, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x41, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14,
0x22, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f,
0x61, 0x75, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -303,22 +448,26 @@ func file_auth_proto_rawDescGZIP() []byte {
return file_auth_proto_rawDescData
}
var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_auth_proto_goTypes = []interface{}{
(*TokenWrapper)(nil), // 0: api.TokenWrapper
(*IsValidTokenRequest)(nil), // 1: api.IsValidTokenRequest
(*IsValidTokenResponse)(nil), // 2: api.IsValidTokenResponse
(*IsWorkspaceAuthenticatedRequest)(nil), // 3: api.IsWorkspaceAuthenticatedRequest
(*empty.Empty)(nil), // 4: google.protobuf.Empty
(*IsAuthorizedRequest)(nil), // 0: api.IsAuthorizedRequest
(*IsAuthorizedResponse)(nil), // 1: api.IsAuthorizedResponse
(*TokenWrapper)(nil), // 2: api.TokenWrapper
(*IsValidTokenRequest)(nil), // 3: api.IsValidTokenRequest
(*IsValidTokenResponse)(nil), // 4: api.IsValidTokenResponse
(*IsWorkspaceAuthenticatedRequest)(nil), // 5: api.IsWorkspaceAuthenticatedRequest
(*empty.Empty)(nil), // 6: google.protobuf.Empty
}
var file_auth_proto_depIdxs = []int32{
0, // 0: api.IsValidTokenRequest.token:type_name -> api.TokenWrapper
1, // 1: api.AuthService.IsValidToken:input_type -> api.IsValidTokenRequest
3, // 2: api.AuthService.IsWorkspaceAuthenticated:input_type -> api.IsWorkspaceAuthenticatedRequest
2, // 3: api.AuthService.IsValidToken:output_type -> api.IsValidTokenResponse
4, // 4: api.AuthService.IsWorkspaceAuthenticated:output_type -> google.protobuf.Empty
3, // [3:5] is the sub-list for method output_type
1, // [1:3] is the sub-list for method input_type
2, // 0: api.IsValidTokenRequest.token:type_name -> api.TokenWrapper
3, // 1: api.AuthService.IsValidToken:input_type -> api.IsValidTokenRequest
5, // 2: api.AuthService.IsWorkspaceAuthenticated:input_type -> api.IsWorkspaceAuthenticatedRequest
0, // 3: api.AuthService.IsAuthorized:input_type -> api.IsAuthorizedRequest
4, // 4: api.AuthService.IsValidToken:output_type -> api.IsValidTokenResponse
6, // 5: api.AuthService.IsWorkspaceAuthenticated:output_type -> google.protobuf.Empty
1, // 6: api.AuthService.IsAuthorized:output_type -> api.IsAuthorizedResponse
4, // [4:7] is the sub-list for method output_type
1, // [1:4] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
@@ -331,7 +480,7 @@ func file_auth_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TokenWrapper); i {
switch v := v.(*IsAuthorizedRequest); i {
case 0:
return &v.state
case 1:
@@ -343,7 +492,7 @@ func file_auth_proto_init() {
}
}
file_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsValidTokenRequest); i {
switch v := v.(*IsAuthorizedResponse); i {
case 0:
return &v.state
case 1:
@@ -355,7 +504,7 @@ func file_auth_proto_init() {
}
}
file_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsValidTokenResponse); i {
switch v := v.(*TokenWrapper); i {
case 0:
return &v.state
case 1:
@@ -367,6 +516,30 @@ func file_auth_proto_init() {
}
}
file_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsValidTokenRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_auth_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsValidTokenResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_auth_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsWorkspaceAuthenticatedRequest); i {
case 0:
return &v.state
@@ -385,7 +558,7 @@ func file_auth_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_auth_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
@@ -413,6 +586,7 @@ const _ = grpc.SupportPackageIsVersion6
type AuthServiceClient interface {
IsValidToken(ctx context.Context, in *IsValidTokenRequest, opts ...grpc.CallOption) (*IsValidTokenResponse, error)
IsWorkspaceAuthenticated(ctx context.Context, in *IsWorkspaceAuthenticatedRequest, opts ...grpc.CallOption) (*empty.Empty, error)
IsAuthorized(ctx context.Context, in *IsAuthorizedRequest, opts ...grpc.CallOption) (*IsAuthorizedResponse, error)
}
type authServiceClient struct {
@@ -441,10 +615,20 @@ func (c *authServiceClient) IsWorkspaceAuthenticated(ctx context.Context, in *Is
return out, nil
}
func (c *authServiceClient) IsAuthorized(ctx context.Context, in *IsAuthorizedRequest, opts ...grpc.CallOption) (*IsAuthorizedResponse, error) {
out := new(IsAuthorizedResponse)
err := c.cc.Invoke(ctx, "/api.AuthService/IsAuthorized", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthServiceServer is the server API for AuthService service.
type AuthServiceServer interface {
IsValidToken(context.Context, *IsValidTokenRequest) (*IsValidTokenResponse, error)
IsWorkspaceAuthenticated(context.Context, *IsWorkspaceAuthenticatedRequest) (*empty.Empty, error)
IsAuthorized(context.Context, *IsAuthorizedRequest) (*IsAuthorizedResponse, error)
}
// UnimplementedAuthServiceServer can be embedded to have forward compatible implementations.
@@ -457,6 +641,9 @@ func (*UnimplementedAuthServiceServer) IsValidToken(context.Context, *IsValidTok
func (*UnimplementedAuthServiceServer) IsWorkspaceAuthenticated(context.Context, *IsWorkspaceAuthenticatedRequest) (*empty.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsWorkspaceAuthenticated not implemented")
}
func (*UnimplementedAuthServiceServer) IsAuthorized(context.Context, *IsAuthorizedRequest) (*IsAuthorizedResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsAuthorized not implemented")
}
func RegisterAuthServiceServer(s *grpc.Server, srv AuthServiceServer) {
s.RegisterService(&_AuthService_serviceDesc, srv)
@@ -498,6 +685,24 @@ func _AuthService_IsWorkspaceAuthenticated_Handler(srv interface{}, ctx context.
return interceptor(ctx, in, info, handler)
}
func _AuthService_IsAuthorized_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsAuthorizedRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).IsAuthorized(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.AuthService/IsAuthorized",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).IsAuthorized(ctx, req.(*IsAuthorizedRequest))
}
return interceptor(ctx, in, info, handler)
}
var _AuthService_serviceDesc = grpc.ServiceDesc{
ServiceName: "api.AuthService",
HandlerType: (*AuthServiceServer)(nil),
@@ -510,6 +715,10 @@ var _AuthService_serviceDesc = grpc.ServiceDesc{
MethodName: "IsWorkspaceAuthenticated",
Handler: _AuthService_IsWorkspaceAuthenticated_Handler,
},
{
MethodName: "IsAuthorized",
Handler: _AuthService_IsAuthorized_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth.proto",

View File

@@ -98,6 +98,39 @@ func local_request_AuthService_IsWorkspaceAuthenticated_0(ctx context.Context, m
}
var (
filter_AuthService_IsAuthorized_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_AuthService_IsAuthorized_0(ctx context.Context, marshaler runtime.Marshaler, client AuthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq IsAuthorizedRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuthService_IsAuthorized_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.IsAuthorized(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_AuthService_IsAuthorized_0(ctx context.Context, marshaler runtime.Marshaler, server AuthServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq IsAuthorizedRequest
var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_AuthService_IsAuthorized_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.IsAuthorized(ctx, &protoReq)
return msg, metadata, err
}
// RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux".
// UnaryRPC :call AuthServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -143,6 +176,26 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
})
mux.Handle("POST", pattern_AuthService_IsAuthorized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_AuthService_IsAuthorized_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_IsAuthorized_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -224,6 +277,26 @@ func RegisterAuthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux
})
mux.Handle("POST", pattern_AuthService_IsAuthorized_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_AuthService_IsAuthorized_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_AuthService_IsAuthorized_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -231,10 +304,14 @@ var (
pattern_AuthService_IsValidToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"apis", "v1beta1", "auth", "token"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_AuthService_IsWorkspaceAuthenticated_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"apis", "v1beta1", "auth", "token"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_AuthService_IsAuthorized_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "v1beta1", "auth"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
forward_AuthService_IsValidToken_0 = runtime.ForwardResponseMessage
forward_AuthService_IsWorkspaceAuthenticated_0 = runtime.ForwardResponseMessage
forward_AuthService_IsAuthorized_0 = runtime.ForwardResponseMessage
)

View File

@@ -21,6 +21,24 @@ service AuthService {
}
};
}
rpc IsAuthorized(IsAuthorizedRequest) returns (IsAuthorizedResponse) {
option (google.api.http) = {
post: "/apis/v1beta1/auth"
};
}
}
message IsAuthorizedRequest {
string namespace = 1;
string verb = 2;
string group = 3;
string resource = 4;
string resourceName = 5;
}
message IsAuthorizedResponse {
bool authorized = 1;
}
message TokenWrapper {
@@ -32,7 +50,7 @@ message IsValidTokenRequest {
}
message IsValidTokenResponse {
string domain = 2;
string domain = 1;
}
message IsWorkspaceAuthenticatedRequest {

View File

@@ -37,9 +37,11 @@ type CronWorkflow struct {
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Manifest string `protobuf:"bytes,2,opt,name=manifest,proto3" json:"manifest,omitempty"`
WorkflowExecution *WorkflowExecution `protobuf:"bytes,3,opt,name=workflowExecution,proto3" json:"workflowExecution,omitempty"`
Labels []*KeyValue `protobuf:"bytes,4,rep,name=labels,proto3" json:"labels,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
Manifest string `protobuf:"bytes,3,opt,name=manifest,proto3" json:"manifest,omitempty"`
WorkflowExecution *WorkflowExecution `protobuf:"bytes,4,opt,name=workflowExecution,proto3" json:"workflowExecution,omitempty"`
Labels []*KeyValue `protobuf:"bytes,5,rep,name=labels,proto3" json:"labels,omitempty"`
Namespace string `protobuf:"bytes,6,opt,name=namespace,proto3" json:"namespace,omitempty"`
}
func (x *CronWorkflow) Reset() {
@@ -81,6 +83,13 @@ func (x *CronWorkflow) GetName() string {
return ""
}
func (x *CronWorkflow) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *CronWorkflow) GetManifest() string {
if x != nil {
return x.Manifest
@@ -102,6 +111,13 @@ func (x *CronWorkflow) GetLabels() []*KeyValue {
return nil
}
func (x *CronWorkflow) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
type CreateCronWorkflowRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -163,7 +179,7 @@ type GetCronWorkflowRequest struct {
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
}
func (x *GetCronWorkflowRequest) Reset() {
@@ -205,9 +221,9 @@ func (x *GetCronWorkflowRequest) GetNamespace() string {
return ""
}
func (x *GetCronWorkflowRequest) GetName() string {
func (x *GetCronWorkflowRequest) GetUid() string {
if x != nil {
return x.Name
return x.Uid
}
return ""
}
@@ -218,7 +234,7 @@ type UpdateCronWorkflowRequest struct {
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
CronWorkflow *CronWorkflow `protobuf:"bytes,3,opt,name=cronWorkflow,proto3" json:"cronWorkflow,omitempty"`
}
@@ -261,9 +277,9 @@ func (x *UpdateCronWorkflowRequest) GetNamespace() string {
return ""
}
func (x *UpdateCronWorkflowRequest) GetName() string {
func (x *UpdateCronWorkflowRequest) GetUid() string {
if x != nil {
return x.Name
return x.Uid
}
return ""
}
@@ -275,17 +291,17 @@ func (x *UpdateCronWorkflowRequest) GetCronWorkflow() *CronWorkflow {
return nil
}
type TerminateCronWorkflowRequest struct {
type DeleteCronWorkflowRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
}
func (x *TerminateCronWorkflowRequest) Reset() {
*x = TerminateCronWorkflowRequest{}
func (x *DeleteCronWorkflowRequest) Reset() {
*x = DeleteCronWorkflowRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_cron_workflow_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -293,13 +309,13 @@ func (x *TerminateCronWorkflowRequest) Reset() {
}
}
func (x *TerminateCronWorkflowRequest) String() string {
func (x *DeleteCronWorkflowRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TerminateCronWorkflowRequest) ProtoMessage() {}
func (*DeleteCronWorkflowRequest) ProtoMessage() {}
func (x *TerminateCronWorkflowRequest) ProtoReflect() protoreflect.Message {
func (x *DeleteCronWorkflowRequest) ProtoReflect() protoreflect.Message {
mi := &file_cron_workflow_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -311,21 +327,21 @@ func (x *TerminateCronWorkflowRequest) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use TerminateCronWorkflowRequest.ProtoReflect.Descriptor instead.
func (*TerminateCronWorkflowRequest) Descriptor() ([]byte, []int) {
// Deprecated: Use DeleteCronWorkflowRequest.ProtoReflect.Descriptor instead.
func (*DeleteCronWorkflowRequest) Descriptor() ([]byte, []int) {
return file_cron_workflow_proto_rawDescGZIP(), []int{4}
}
func (x *TerminateCronWorkflowRequest) GetNamespace() string {
func (x *DeleteCronWorkflowRequest) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *TerminateCronWorkflowRequest) GetName() string {
func (x *DeleteCronWorkflowRequest) GetUid() string {
if x != nil {
return x.Name
return x.Uid
}
return ""
}
@@ -490,17 +506,20 @@ var file_cron_workflow_proto_rawDesc = []byte{
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0xab, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x74, 0x6f, 0x22, 0xdb, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66,
0x65, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66,
0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45,
0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65,
0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77,
0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x06, 0x6c, 0x61, 0x62,
0x65, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e,
0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e,
0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45,
0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x06, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65,
0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18,
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x22, 0x70, 0x0a, 0x19, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a,
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
@@ -508,96 +527,94 @@ var file_cron_workflow_proto_rawDesc = []byte{
0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x52, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
0x6f, 0x77, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6f, 0x77, 0x22, 0x48, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x84,
0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x35,
0x0a, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57,
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x50, 0x0a, 0x1c, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61,
0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74,
0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
0x65, 0x12, 0x34, 0x0a, 0x16, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53,
0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53,
0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, 0xb4, 0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74,
0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0d, 0x63,
0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x0d, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x67, 0x65,
0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1e,
0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01,
0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x8c,
0x06, 0x0a, 0x13, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x86, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74,
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x82, 0x01, 0x0a,
0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x0c, 0x63, 0x72,
0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x52, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x22, 0x4b, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57,
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c,
0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x9d,
0x01, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x77, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61,
0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, 0xb4,
0x01, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0d, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
0x6f, 0x77, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x0d, 0x63, 0x72,
0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70,
0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12,
0x14, 0x0a, 0x05, 0x70, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x70, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0xf9, 0x05, 0x0a, 0x13, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x86, 0x01,
0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57,
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x22,
0x27, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x5f,
0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x3a, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x8c, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1e, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f,
0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77,
0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x22, 0x27, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f,
0x22, 0x43, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3d, 0x1a, 0x2d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f,
0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x3a, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12,
0x8d, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f,
0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x44, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x3e, 0x1a, 0x2e, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0x77, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x3a, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x78, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6f, 0x6e,
0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47,
0x65, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e,
0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f,
0x12, 0x2d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f,
0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e,
0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12,
0xc8, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x73, 0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72,
0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x75, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x6f, 0x12, 0x28, 0x2f, 0x61, 0x70,
0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x73, 0x5a, 0x43, 0x12, 0x41, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76,
0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77,
0x73, 0x2f, 0x7b, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x84, 0x01, 0x0a, 0x12, 0x44,
0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x12, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x43, 0x72,
0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x30, 0x2a, 0x2e, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f,
0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,
0x7d, 0x3a, 0x0c, 0x63, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12,
0x79, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
0x6f, 0x77, 0x12, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6f, 0x6e,
0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c,
0x6f, 0x77, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x61, 0x70, 0x69,
0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0xc8, 0x01, 0x0a, 0x11, 0x4c,
0x69, 0x73, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73,
0x12, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57,
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x6f, 0x12, 0x28, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x7d, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73,
0x5a, 0x43, 0x12, 0x41, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72,
0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x7b, 0x77, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x95, 0x01, 0x0a, 0x15, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e,
0x61, 0x74, 0x65, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12,
0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x43,
0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x41, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x3b, 0x2a, 0x39, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61,
0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x63, 0x72,
0x6f, 0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x7b, 0x6e, 0x61,
0x6d, 0x65, 0x7d, 0x2f, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64,
0x7d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -614,16 +631,16 @@ func file_cron_workflow_proto_rawDescGZIP() []byte {
var file_cron_workflow_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_cron_workflow_proto_goTypes = []interface{}{
(*CronWorkflow)(nil), // 0: api.CronWorkflow
(*CreateCronWorkflowRequest)(nil), // 1: api.CreateCronWorkflowRequest
(*GetCronWorkflowRequest)(nil), // 2: api.GetCronWorkflowRequest
(*UpdateCronWorkflowRequest)(nil), // 3: api.UpdateCronWorkflowRequest
(*TerminateCronWorkflowRequest)(nil), // 4: api.TerminateCronWorkflowRequest
(*ListCronWorkflowRequest)(nil), // 5: api.ListCronWorkflowRequest
(*ListCronWorkflowsResponse)(nil), // 6: api.ListCronWorkflowsResponse
(*WorkflowExecution)(nil), // 7: api.WorkflowExecution
(*KeyValue)(nil), // 8: api.KeyValue
(*empty.Empty)(nil), // 9: google.protobuf.Empty
(*CronWorkflow)(nil), // 0: api.CronWorkflow
(*CreateCronWorkflowRequest)(nil), // 1: api.CreateCronWorkflowRequest
(*GetCronWorkflowRequest)(nil), // 2: api.GetCronWorkflowRequest
(*UpdateCronWorkflowRequest)(nil), // 3: api.UpdateCronWorkflowRequest
(*DeleteCronWorkflowRequest)(nil), // 4: api.DeleteCronWorkflowRequest
(*ListCronWorkflowRequest)(nil), // 5: api.ListCronWorkflowRequest
(*ListCronWorkflowsResponse)(nil), // 6: api.ListCronWorkflowsResponse
(*WorkflowExecution)(nil), // 7: api.WorkflowExecution
(*KeyValue)(nil), // 8: api.KeyValue
(*empty.Empty)(nil), // 9: google.protobuf.Empty
}
var file_cron_workflow_proto_depIdxs = []int32{
7, // 0: api.CronWorkflow.workflowExecution:type_name -> api.WorkflowExecution
@@ -635,12 +652,12 @@ var file_cron_workflow_proto_depIdxs = []int32{
3, // 6: api.CronWorkflowService.UpdateCronWorkflow:input_type -> api.UpdateCronWorkflowRequest
2, // 7: api.CronWorkflowService.GetCronWorkflow:input_type -> api.GetCronWorkflowRequest
5, // 8: api.CronWorkflowService.ListCronWorkflows:input_type -> api.ListCronWorkflowRequest
4, // 9: api.CronWorkflowService.TerminateCronWorkflow:input_type -> api.TerminateCronWorkflowRequest
4, // 9: api.CronWorkflowService.DeleteCronWorkflow:input_type -> api.DeleteCronWorkflowRequest
0, // 10: api.CronWorkflowService.CreateCronWorkflow:output_type -> api.CronWorkflow
0, // 11: api.CronWorkflowService.UpdateCronWorkflow:output_type -> api.CronWorkflow
0, // 12: api.CronWorkflowService.GetCronWorkflow:output_type -> api.CronWorkflow
6, // 13: api.CronWorkflowService.ListCronWorkflows:output_type -> api.ListCronWorkflowsResponse
9, // 14: api.CronWorkflowService.TerminateCronWorkflow:output_type -> google.protobuf.Empty
9, // 14: api.CronWorkflowService.DeleteCronWorkflow:output_type -> google.protobuf.Empty
10, // [10:15] is the sub-list for method output_type
5, // [5:10] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
@@ -705,7 +722,7 @@ func file_cron_workflow_proto_init() {
}
}
file_cron_workflow_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TerminateCronWorkflowRequest); i {
switch v := v.(*DeleteCronWorkflowRequest); i {
case 0:
return &v.state
case 1:
@@ -777,7 +794,7 @@ type CronWorkflowServiceClient interface {
UpdateCronWorkflow(ctx context.Context, in *UpdateCronWorkflowRequest, opts ...grpc.CallOption) (*CronWorkflow, error)
GetCronWorkflow(ctx context.Context, in *GetCronWorkflowRequest, opts ...grpc.CallOption) (*CronWorkflow, error)
ListCronWorkflows(ctx context.Context, in *ListCronWorkflowRequest, opts ...grpc.CallOption) (*ListCronWorkflowsResponse, error)
TerminateCronWorkflow(ctx context.Context, in *TerminateCronWorkflowRequest, opts ...grpc.CallOption) (*empty.Empty, error)
DeleteCronWorkflow(ctx context.Context, in *DeleteCronWorkflowRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}
type cronWorkflowServiceClient struct {
@@ -824,9 +841,9 @@ func (c *cronWorkflowServiceClient) ListCronWorkflows(ctx context.Context, in *L
return out, nil
}
func (c *cronWorkflowServiceClient) TerminateCronWorkflow(ctx context.Context, in *TerminateCronWorkflowRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
func (c *cronWorkflowServiceClient) DeleteCronWorkflow(ctx context.Context, in *DeleteCronWorkflowRequest, opts ...grpc.CallOption) (*empty.Empty, error) {
out := new(empty.Empty)
err := c.cc.Invoke(ctx, "/api.CronWorkflowService/TerminateCronWorkflow", in, out, opts...)
err := c.cc.Invoke(ctx, "/api.CronWorkflowService/DeleteCronWorkflow", in, out, opts...)
if err != nil {
return nil, err
}
@@ -839,7 +856,7 @@ type CronWorkflowServiceServer interface {
UpdateCronWorkflow(context.Context, *UpdateCronWorkflowRequest) (*CronWorkflow, error)
GetCronWorkflow(context.Context, *GetCronWorkflowRequest) (*CronWorkflow, error)
ListCronWorkflows(context.Context, *ListCronWorkflowRequest) (*ListCronWorkflowsResponse, error)
TerminateCronWorkflow(context.Context, *TerminateCronWorkflowRequest) (*empty.Empty, error)
DeleteCronWorkflow(context.Context, *DeleteCronWorkflowRequest) (*empty.Empty, error)
}
// UnimplementedCronWorkflowServiceServer can be embedded to have forward compatible implementations.
@@ -858,8 +875,8 @@ func (*UnimplementedCronWorkflowServiceServer) GetCronWorkflow(context.Context,
func (*UnimplementedCronWorkflowServiceServer) ListCronWorkflows(context.Context, *ListCronWorkflowRequest) (*ListCronWorkflowsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListCronWorkflows not implemented")
}
func (*UnimplementedCronWorkflowServiceServer) TerminateCronWorkflow(context.Context, *TerminateCronWorkflowRequest) (*empty.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method TerminateCronWorkflow not implemented")
func (*UnimplementedCronWorkflowServiceServer) DeleteCronWorkflow(context.Context, *DeleteCronWorkflowRequest) (*empty.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteCronWorkflow not implemented")
}
func RegisterCronWorkflowServiceServer(s *grpc.Server, srv CronWorkflowServiceServer) {
@@ -938,20 +955,20 @@ func _CronWorkflowService_ListCronWorkflows_Handler(srv interface{}, ctx context
return interceptor(ctx, in, info, handler)
}
func _CronWorkflowService_TerminateCronWorkflow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TerminateCronWorkflowRequest)
func _CronWorkflowService_DeleteCronWorkflow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteCronWorkflowRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CronWorkflowServiceServer).TerminateCronWorkflow(ctx, in)
return srv.(CronWorkflowServiceServer).DeleteCronWorkflow(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.CronWorkflowService/TerminateCronWorkflow",
FullMethod: "/api.CronWorkflowService/DeleteCronWorkflow",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CronWorkflowServiceServer).TerminateCronWorkflow(ctx, req.(*TerminateCronWorkflowRequest))
return srv.(CronWorkflowServiceServer).DeleteCronWorkflow(ctx, req.(*DeleteCronWorkflowRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -977,8 +994,8 @@ var _CronWorkflowService_serviceDesc = grpc.ServiceDesc{
Handler: _CronWorkflowService_ListCronWorkflows_Handler,
},
{
MethodName: "TerminateCronWorkflow",
Handler: _CronWorkflowService_TerminateCronWorkflow_Handler,
MethodName: "DeleteCronWorkflow",
Handler: _CronWorkflowService_DeleteCronWorkflow_Handler,
},
},
Streams: []grpc.StreamDesc{},

View File

@@ -131,15 +131,15 @@ func request_CronWorkflowService_UpdateCronWorkflow_0(ctx context.Context, marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.UpdateCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -177,15 +177,15 @@ func local_request_CronWorkflowService_UpdateCronWorkflow_0(ctx context.Context,
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.UpdateCronWorkflow(ctx, &protoReq)
@@ -215,15 +215,15 @@ func request_CronWorkflowService_GetCronWorkflow_0(ctx context.Context, marshale
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.GetCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -253,15 +253,15 @@ func local_request_CronWorkflowService_GetCronWorkflow_0(ctx context.Context, ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.GetCronWorkflow(ctx, &protoReq)
@@ -429,8 +429,8 @@ func local_request_CronWorkflowService_ListCronWorkflows_1(ctx context.Context,
}
func request_CronWorkflowService_TerminateCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq TerminateCronWorkflowRequest
func request_CronWorkflowService_DeleteCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, client CronWorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteCronWorkflowRequest
var metadata runtime.ServerMetadata
var (
@@ -451,24 +451,24 @@ func request_CronWorkflowService_TerminateCronWorkflow_0(ctx context.Context, ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.TerminateCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
msg, err := client.DeleteCronWorkflow(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_CronWorkflowService_TerminateCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, server CronWorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq TerminateCronWorkflowRequest
func local_request_CronWorkflowService_DeleteCronWorkflow_0(ctx context.Context, marshaler runtime.Marshaler, server CronWorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteCronWorkflowRequest
var metadata runtime.ServerMetadata
var (
@@ -489,18 +489,18 @@ func local_request_CronWorkflowService_TerminateCronWorkflow_0(ctx context.Conte
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.TerminateCronWorkflow(ctx, &protoReq)
msg, err := server.DeleteCronWorkflow(ctx, &protoReq)
return msg, metadata, err
}
@@ -610,7 +610,7 @@ func RegisterCronWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.
})
mux.Handle("DELETE", pattern_CronWorkflowService_TerminateCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("DELETE", pattern_CronWorkflowService_DeleteCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@@ -619,14 +619,14 @@ func RegisterCronWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_CronWorkflowService_TerminateCronWorkflow_0(rctx, inboundMarshaler, server, req, pathParams)
resp, md, err := local_request_CronWorkflowService_DeleteCronWorkflow_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_CronWorkflowService_TerminateCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_CronWorkflowService_DeleteCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -771,7 +771,7 @@ func RegisterCronWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.
})
mux.Handle("DELETE", pattern_CronWorkflowService_TerminateCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
mux.Handle("DELETE", pattern_CronWorkflowService_DeleteCronWorkflow_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@@ -780,14 +780,14 @@ func RegisterCronWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_CronWorkflowService_TerminateCronWorkflow_0(rctx, inboundMarshaler, client, req, pathParams)
resp, md, err := request_CronWorkflowService_DeleteCronWorkflow_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_CronWorkflowService_TerminateCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
forward_CronWorkflowService_DeleteCronWorkflow_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
@@ -797,15 +797,15 @@ func RegisterCronWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.
var (
pattern_CronWorkflowService_CreateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "cron_workflow"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_UpdateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflow", "name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_UpdateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflow", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_GetCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflow", "name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_GetCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflow", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_ListCronWorkflows_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "cron_workflows"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_ListCronWorkflows_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflows", "workflow_template_name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_TerminateCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "cron_workflows", "name", "terminate"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_CronWorkflowService_DeleteCronWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "cron_workflows", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@@ -819,5 +819,5 @@ var (
forward_CronWorkflowService_ListCronWorkflows_1 = runtime.ForwardResponseMessage
forward_CronWorkflowService_TerminateCronWorkflow_0 = runtime.ForwardResponseMessage
forward_CronWorkflowService_DeleteCronWorkflow_0 = runtime.ForwardResponseMessage
)

View File

@@ -17,14 +17,14 @@ service CronWorkflowService {
rpc UpdateCronWorkflow(UpdateCronWorkflowRequest) returns (CronWorkflow) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/cron_workflow/{name}"
put: "/apis/v1beta1/{namespace}/cron_workflow/{uid}"
body: "cronWorkflow"
};
}
rpc GetCronWorkflow(GetCronWorkflowRequest) returns (CronWorkflow) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/cron_workflow/{name}"
get: "/apis/v1beta1/{namespace}/cron_workflow/{uid}"
};
}
@@ -37,20 +37,22 @@ service CronWorkflowService {
};
}
rpc TerminateCronWorkflow (TerminateCronWorkflowRequest) returns (google.protobuf.Empty) {
rpc DeleteCronWorkflow (DeleteCronWorkflowRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/apis/v1beta1/{namespace}/cron_workflows/{name}/terminate"
delete: "/apis/v1beta1/{namespace}/cron_workflows/{uid}"
};
}
}
message CronWorkflow {
string name = 1;
string manifest = 2;
string uid = 2;
string manifest = 3;
WorkflowExecution workflowExecution = 3;
WorkflowExecution workflowExecution = 4;
repeated KeyValue labels = 4;
repeated KeyValue labels = 5;
string namespace = 6;
}
message CreateCronWorkflowRequest {
@@ -60,18 +62,18 @@ message CreateCronWorkflowRequest {
message GetCronWorkflowRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message UpdateCronWorkflowRequest {
string namespace = 1 ;
string name = 2;
string uid = 2;
CronWorkflow cronWorkflow = 3;
}
message TerminateCronWorkflowRequest {
message DeleteCronWorkflowRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message ListCronWorkflowRequest {

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@ func request_WorkflowService_CreateWorkflowExecution_0(ctx context.Context, mars
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.WorkflowExecution); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -74,7 +74,7 @@ func local_request_WorkflowService_CreateWorkflowExecution_0(ctx context.Context
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.WorkflowExecution); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -123,15 +123,15 @@ func request_WorkflowService_CloneWorkflowExecution_0(ctx context.Context, marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.CloneWorkflowExecution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -161,15 +161,15 @@ func local_request_WorkflowService_CloneWorkflowExecution_0(ctx context.Context,
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.CloneWorkflowExecution(ctx, &protoReq)
@@ -199,15 +199,15 @@ func request_WorkflowService_GetWorkflowExecution_0(ctx context.Context, marshal
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.GetWorkflowExecution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -237,15 +237,15 @@ func local_request_WorkflowService_GetWorkflowExecution_0(ctx context.Context, m
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.GetWorkflowExecution(ctx, &protoReq)
@@ -344,15 +344,15 @@ func request_WorkflowService_WatchWorkflowExecution_0(ctx context.Context, marsh
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
stream, err := client.WatchWorkflowExecution(ctx, &protoReq)
@@ -390,15 +390,15 @@ func request_WorkflowService_GetWorkflowExecutionLogs_0(ctx context.Context, mar
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["podName"]
@@ -458,15 +458,15 @@ func request_WorkflowService_GetWorkflowExecutionMetrics_0(ctx context.Context,
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["podName"]
@@ -507,15 +507,15 @@ func local_request_WorkflowService_GetWorkflowExecutionMetrics_0(ctx context.Con
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["podName"]
@@ -556,15 +556,15 @@ func request_WorkflowService_ResubmitWorkflowExecution_0(ctx context.Context, ma
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.ResubmitWorkflowExecution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -594,15 +594,15 @@ func local_request_WorkflowService_ResubmitWorkflowExecution_0(ctx context.Conte
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.ResubmitWorkflowExecution(ctx, &protoReq)
@@ -632,15 +632,15 @@ func request_WorkflowService_TerminateWorkflowExecution_0(ctx context.Context, m
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.TerminateWorkflowExecution(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -670,15 +670,15 @@ func local_request_WorkflowService_TerminateWorkflowExecution_0(ctx context.Cont
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.TerminateWorkflowExecution(ctx, &protoReq)
@@ -708,15 +708,15 @@ func request_WorkflowService_GetArtifact_0(ctx context.Context, marshaler runtim
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["key"]
@@ -757,15 +757,15 @@ func local_request_WorkflowService_GetArtifact_0(ctx context.Context, marshaler
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["key"]
@@ -806,15 +806,15 @@ func request_WorkflowService_ListFiles_0(ctx context.Context, marshaler runtime.
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["path"]
@@ -855,15 +855,15 @@ func local_request_WorkflowService_ListFiles_0(ctx context.Context, marshaler ru
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
val, ok = pathParams["path"]
@@ -912,15 +912,15 @@ func request_WorkflowService_AddWorkflowExecutionStatistics_0(ctx context.Contex
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.AddWorkflowExecutionStatistics(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -958,15 +958,15 @@ func local_request_WorkflowService_AddWorkflowExecutionStatistics_0(ctx context.
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.AddWorkflowExecutionStatistics(ctx, &protoReq)
@@ -1004,15 +1004,15 @@ func request_WorkflowService_CronStartWorkflowExecutionStatistic_0(ctx context.C
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.CronStartWorkflowExecutionStatistic(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -1050,15 +1050,15 @@ func local_request_WorkflowService_CronStartWorkflowExecutionStatistic_0(ctx con
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.CronStartWorkflowExecutionStatistic(ctx, &protoReq)
@@ -1066,6 +1066,98 @@ func local_request_WorkflowService_CronStartWorkflowExecutionStatistic_0(ctx con
}
func request_WorkflowService_UpdateWorkflowExecutionStatus_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateWorkflowExecutionStatusRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Status); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.UpdateWorkflowExecutionStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkflowService_UpdateWorkflowExecutionStatus_0(ctx context.Context, marshaler runtime.Marshaler, server WorkflowServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateWorkflowExecutionStatusRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Status); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.UpdateWorkflowExecutionStatus(ctx, &protoReq)
return msg, metadata, err
}
// RegisterWorkflowServiceHandlerServer registers the http handlers for service WorkflowService to "mux".
// UnaryRPC :call WorkflowServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -1305,6 +1397,26 @@ func RegisterWorkflowServiceHandlerServer(ctx context.Context, mux *runtime.Serv
})
mux.Handle("PUT", pattern_WorkflowService_UpdateWorkflowExecutionStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkflowService_UpdateWorkflowExecutionStatus_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkflowService_UpdateWorkflowExecutionStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -1606,35 +1718,57 @@ func RegisterWorkflowServiceHandlerClient(ctx context.Context, mux *runtime.Serv
})
mux.Handle("PUT", pattern_WorkflowService_UpdateWorkflowExecutionStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkflowService_UpdateWorkflowExecutionStatus_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkflowService_UpdateWorkflowExecutionStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_WorkflowService_CreateWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workflow_executions"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_CloneWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_CloneWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_ListWorkflowExecutions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workflow_executions"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_WatchWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "watch"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_WatchWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "watch"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowExecutionLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "pods", "podName", "containers", "containerName", "logs"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowExecutionLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "pods", "podName", "containers", "containerName", "logs"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowExecutionMetrics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "pods", "podName", "metrics"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowExecutionMetrics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "pods", "podName", "metrics"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_ResubmitWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "resubmit"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_ResubmitWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "resubmit"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_TerminateWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "terminate"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_TerminateWorkflowExecution_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "terminate"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetArtifact_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 3, 0, 4, 1, 5, 6}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "artifacts", "key"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetArtifact_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 3, 0, 4, 1, 5, 6}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "artifacts", "key"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_ListFiles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 3, 0, 4, 1, 5, 6}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "files", "path"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_ListFiles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 3, 0, 4, 1, 5, 6}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "files", "path"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_AddWorkflowExecutionStatistics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "statistics"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_AddWorkflowExecutionStatistics_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "statistics"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_CronStartWorkflowExecutionStatistic_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "name", "cron_start_statistics"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_CronStartWorkflowExecutionStatistic_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "cron_start_statistics"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_UpdateWorkflowExecutionStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflow_executions", "uid", "status"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
@@ -1663,4 +1797,6 @@ var (
forward_WorkflowService_AddWorkflowExecutionStatistics_0 = runtime.ForwardResponseMessage
forward_WorkflowService_CronStartWorkflowExecutionStatistic_0 = runtime.ForwardResponseMessage
forward_WorkflowService_UpdateWorkflowExecutionStatus_0 = runtime.ForwardResponseMessage
)

View File

@@ -14,20 +14,20 @@ service WorkflowService {
rpc CreateWorkflowExecution (CreateWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_executions"
body: "workflowExecution"
body: "body"
};
}
// Clone a Workflow. This is the same as running it again.
rpc CloneWorkflowExecution (CloneWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_executions/{name}"
post: "/apis/v1beta1/{namespace}/workflow_executions/{uid}"
};
}
rpc GetWorkflowExecution (GetWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}"
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}"
};
}
@@ -39,108 +39,123 @@ service WorkflowService {
rpc WatchWorkflowExecution (WatchWorkflowExecutionRequest) returns (stream WorkflowExecution) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/watch"
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/watch"
};
}
rpc GetWorkflowExecutionLogs (GetWorkflowExecutionLogsRequest) returns (stream LogEntry) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/pods/{podName}/containers/{containerName}/logs"
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/pods/{podName}/containers/{containerName}/logs"
};
}
rpc GetWorkflowExecutionMetrics (GetWorkflowExecutionMetricsRequest) returns (GetWorkflowExecutionMetricsResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/pods/{podName}/metrics"
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/pods/{podName}/metrics"
};
}
rpc ResubmitWorkflowExecution (ResubmitWorkflowExecutionRequest) returns (WorkflowExecution) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_executions/{name}/resubmit"
put: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/resubmit"
};
}
rpc TerminateWorkflowExecution (TerminateWorkflowExecutionRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_executions/{name}/terminate"
put: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/terminate"
};
}
rpc GetArtifact (GetArtifactRequest) returns (ArtifactResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/artifacts/{key=**}"
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/artifacts/{key=**}"
};
}
rpc ListFiles (ListFilesRequest) returns (ListFilesResponse) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflow_executions/{name}/files/{path=**}"
get: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/files/{path=**}"
};
}
rpc AddWorkflowExecutionStatistics (AddWorkflowExecutionStatisticRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_executions/{name}/statistics"
post: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/statistics"
body: "statistics"
};
}
rpc CronStartWorkflowExecutionStatistic (CronStartWorkflowExecutionStatisticRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workflow_executions/{name}/cron_start_statistics"
post: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/cron_start_statistics"
body: "statistics"
};
}
rpc UpdateWorkflowExecutionStatus (UpdateWorkflowExecutionStatusRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workflow_executions/{uid}/status"
body: "status"
};
}
}
message CreateWorkflowExecutionRequest {
message CreateWorkflowExecutionBody {
string workflowTemplateUid = 2;
int64 workflowTemplateVersion = 3;
repeated Parameter parameters = 4;
repeated KeyValue labels = 5;
}
message CreateWorkflowExecutionRequest {
string namespace = 1;
WorkflowExecution workflowExecution = 2;
CreateWorkflowExecutionBody body = 2;
}
message CloneWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message GetWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message GetArtifactRequest {
string namespace = 1;
string name = 2;
string uid = 2;
string key = 3;
}
message WatchWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message ResubmitWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message TerminateWorkflowExecutionRequest {
string namespace = 1;
string name = 2;
string uid = 2;
}
message GetWorkflowExecutionLogsRequest {
string namespace = 1;
string name = 2;
string uid = 2;
string podName = 3;
string containerName = 4;
}
message GetWorkflowExecutionMetricsRequest {
string namespace = 1;
string name = 2;
string uid = 2;
string podName = 3;
}
@@ -201,7 +216,7 @@ message File {
message ListFilesRequest {
string namespace = 1;
string name = 2;
string uid = 2;
string path = 3;
}
@@ -217,12 +232,22 @@ message Statistics {
message AddWorkflowExecutionStatisticRequest {
string namespace = 1;
string name = 2;
string uid = 2;
Statistics statistics = 3;
}
message CronStartWorkflowExecutionStatisticRequest {
string namespace = 1;
string name = 2;
string uid = 2;
Statistics statistics = 3;
}
message WorkflowExecutionStatus {
string phase = 1;
}
message UpdateWorkflowExecutionStatusRequest {
string namespace = 1;
string uid = 2;
WorkflowExecutionStatus status = 3;
}

View File

@@ -638,6 +638,7 @@ type WorkflowExecutionStatisticReport struct {
Running int32 `protobuf:"varint,3,opt,name=running,proto3" json:"running,omitempty"`
Completed int32 `protobuf:"varint,4,opt,name=completed,proto3" json:"completed,omitempty"`
Failed int32 `protobuf:"varint,5,opt,name=failed,proto3" json:"failed,omitempty"`
Terminated int32 `protobuf:"varint,6,opt,name=terminated,proto3" json:"terminated,omitempty"`
}
func (x *WorkflowExecutionStatisticReport) Reset() {
@@ -707,6 +708,13 @@ func (x *WorkflowExecutionStatisticReport) GetFailed() int32 {
return 0
}
func (x *WorkflowExecutionStatisticReport) GetTerminated() int32 {
if x != nil {
return x.Terminated
}
return 0
}
type CronWorkflowStatisticsReport struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -760,16 +768,17 @@ type WorkflowTemplate struct {
unknownFields protoimpl.UnknownFields
CreatedAt string `protobuf:"bytes,1,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"`
Versions int64 `protobuf:"varint,5,opt,name=versions,proto3" json:"versions,omitempty"`
Manifest string `protobuf:"bytes,6,opt,name=manifest,proto3" json:"manifest,omitempty"`
IsLatest bool `protobuf:"varint,7,opt,name=isLatest,proto3" json:"isLatest,omitempty"`
IsArchived bool `protobuf:"varint,8,opt,name=isArchived,proto3" json:"isArchived,omitempty"`
Labels []*KeyValue `protobuf:"bytes,9,rep,name=labels,proto3" json:"labels,omitempty"`
Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,10,opt,name=stats,proto3" json:"stats,omitempty"`
CronStats *CronWorkflowStatisticsReport `protobuf:"bytes,11,opt,name=cronStats,proto3" json:"cronStats,omitempty"`
ModifiedAt string `protobuf:"bytes,2,opt,name=modifiedAt,proto3" json:"modifiedAt,omitempty"`
Uid string `protobuf:"bytes,3,opt,name=uid,proto3" json:"uid,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Version int64 `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"`
Versions int64 `protobuf:"varint,6,opt,name=versions,proto3" json:"versions,omitempty"`
Manifest string `protobuf:"bytes,7,opt,name=manifest,proto3" json:"manifest,omitempty"`
IsLatest bool `protobuf:"varint,8,opt,name=isLatest,proto3" json:"isLatest,omitempty"`
IsArchived bool `protobuf:"varint,9,opt,name=isArchived,proto3" json:"isArchived,omitempty"`
Labels []*KeyValue `protobuf:"bytes,10,rep,name=labels,proto3" json:"labels,omitempty"`
Stats *WorkflowExecutionStatisticReport `protobuf:"bytes,11,opt,name=stats,proto3" json:"stats,omitempty"`
CronStats *CronWorkflowStatisticsReport `protobuf:"bytes,12,opt,name=cronStats,proto3" json:"cronStats,omitempty"`
}
func (x *WorkflowTemplate) Reset() {
@@ -811,6 +820,13 @@ func (x *WorkflowTemplate) GetCreatedAt() string {
return ""
}
func (x *WorkflowTemplate) GetModifiedAt() string {
if x != nil {
return x.ModifiedAt
}
return ""
}
func (x *WorkflowTemplate) GetUid() string {
if x != nil {
return x.Uid
@@ -1027,7 +1043,7 @@ var file_workflow_template_proto_rawDesc = []byte{
0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x20, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x6c, 0x61, 0x74, 0x65, 0x22, 0xcc, 0x01, 0x0a, 0x20, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73,
0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12,
@@ -1038,32 +1054,36 @@ var file_workflow_template_proto_rawDesc = []byte{
0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x52, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66,
0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x61, 0x69,
0x6c, 0x65, 0x64, 0x22, 0x34, 0x0a, 0x1c, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65,
0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61,
0x74, 0x65, 0x64, 0x22, 0x34, 0x0a, 0x1c, 0x43, 0x72, 0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x89, 0x03, 0x0a, 0x10, 0x57, 0x6f,
0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xa9, 0x03, 0x0a, 0x10, 0x57, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x1c,
0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x10, 0x0a, 0x03,
0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,
0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1e, 0x0a, 0x0a,
0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x41, 0x74, 0x12, 0x10, 0x0a, 0x03,
0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69,
0x66, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69,
0x66, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69,
0x66, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74,
0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74,
0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x08,
0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74,
0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x09,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64,
0x12, 0x25, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b,
0x12, 0x25, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52,
0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x3b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x05, 0x73,
0x74, 0x61, 0x74, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x63, 0x72, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74,
0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72,
0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72,
0x6f, 0x6e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73,
0x74, 0x69, 0x63, 0x73, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x09, 0x63, 0x72, 0x6f, 0x6e,
0x53, 0x74, 0x61, 0x74, 0x73, 0x22, 0x6e, 0x0a, 0x20, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b,

View File

@@ -126,6 +126,7 @@ message WorkflowExecutionStatisticReport {
int32 running = 3;
int32 completed = 4;
int32 failed = 5;
int32 terminated = 6;
}
message CronWorkflowStatisticsReport {
@@ -134,18 +135,18 @@ message CronWorkflowStatisticsReport {
message WorkflowTemplate {
string createdAt = 1;
string uid = 2;
string name = 3;
int64 version = 4;
int64 versions = 5;
string manifest = 6;
bool isLatest = 7;
bool isArchived = 8;
repeated KeyValue labels = 9;
WorkflowExecutionStatisticReport stats = 10;
CronWorkflowStatisticsReport cronStats = 11;
string modifiedAt = 2;
string uid = 3;
string name = 4;
int64 version = 5;
int64 versions = 6;
string manifest = 7;
bool isLatest = 8;
bool isArchived = 9;
repeated KeyValue labels = 10;
WorkflowExecutionStatisticReport stats = 11;
CronWorkflowStatisticsReport cronStats = 12;
}
message GetWorkflowTemplateLabelsRequest {

File diff suppressed because it is too large Load Diff

View File

@@ -39,7 +39,7 @@ func request_WorkspaceService_CreateWorkspace_0(ctx context.Context, marshaler r
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Workspace); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -74,7 +74,7 @@ func local_request_WorkspaceService_CreateWorkspace_0(ctx context.Context, marsh
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Workspace); err != nil && err != io.EOF {
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -101,6 +101,82 @@ func local_request_WorkspaceService_CreateWorkspace_0(ctx context.Context, marsh
}
func request_WorkspaceService_GetWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetWorkspaceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.GetWorkspace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkspaceService_GetWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetWorkspaceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.GetWorkspace(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_WorkspaceService_ListWorkspaces_0 = &utilities.DoubleArray{Encoding: map[string]int{"namespace": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
@@ -262,6 +338,98 @@ func local_request_WorkspaceService_UpdateWorkspaceStatus_0(ctx context.Context,
}
func request_WorkspaceService_UpdateWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateWorkspaceRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.UpdateWorkspace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkspaceService_UpdateWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateWorkspaceRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Body); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.UpdateWorkspace(ctx, &protoReq)
return msg, metadata, err
}
func request_WorkspaceService_PauseWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq PauseWorkspaceRequest
var metadata runtime.ServerMetadata
@@ -338,6 +506,82 @@ func local_request_WorkspaceService_PauseWorkspace_0(ctx context.Context, marsha
}
func request_WorkspaceService_ResumeWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ResumeWorkspaceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.ResumeWorkspace(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkspaceService_ResumeWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ResumeWorkspaceRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.ResumeWorkspace(ctx, &protoReq)
return msg, metadata, err
}
func request_WorkspaceService_DeleteWorkspace_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteWorkspaceRequest
var metadata runtime.ServerMetadata
@@ -439,6 +683,26 @@ func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.Ser
})
mux.Handle("GET", pattern_WorkspaceService_GetWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkspaceService_GetWorkspace_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceService_GetWorkspace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WorkspaceService_ListWorkspaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -479,6 +743,26 @@ func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.Ser
})
mux.Handle("PUT", pattern_WorkspaceService_UpdateWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkspaceService_UpdateWorkspace_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceService_UpdateWorkspace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("PUT", pattern_WorkspaceService_PauseWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -499,6 +783,26 @@ func RegisterWorkspaceServiceHandlerServer(ctx context.Context, mux *runtime.Ser
})
mux.Handle("PUT", pattern_WorkspaceService_ResumeWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkspaceService_ResumeWorkspace_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceService_ResumeWorkspace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("DELETE", pattern_WorkspaceService_DeleteWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -580,6 +884,26 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser
})
mux.Handle("GET", pattern_WorkspaceService_GetWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkspaceService_GetWorkspace_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceService_GetWorkspace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WorkspaceService_ListWorkspaces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -620,6 +944,26 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser
})
mux.Handle("PUT", pattern_WorkspaceService_UpdateWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkspaceService_UpdateWorkspace_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceService_UpdateWorkspace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("PUT", pattern_WorkspaceService_PauseWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -640,6 +984,26 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser
})
mux.Handle("PUT", pattern_WorkspaceService_ResumeWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkspaceService_ResumeWorkspace_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceService_ResumeWorkspace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("DELETE", pattern_WorkspaceService_DeleteWorkspace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -666,23 +1030,35 @@ func RegisterWorkspaceServiceHandlerClient(ctx context.Context, mux *runtime.Ser
var (
pattern_WorkspaceService_CreateWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workspaces"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_GetWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workspaces", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_ListWorkspaces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workspaces"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_UpdateWorkspaceStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workspaces", "uid", "status"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_UpdateWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workspaces", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_PauseWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workspaces", "uid", "pause"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_ResumeWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workspaces", "uid", "resume"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceService_DeleteWorkspace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workspaces", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
)
var (
forward_WorkspaceService_CreateWorkspace_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_GetWorkspace_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_ListWorkspaces_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_UpdateWorkspaceStatus_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_UpdateWorkspace_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_PauseWorkspace_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_ResumeWorkspace_0 = runtime.ForwardResponseMessage
forward_WorkspaceService_DeleteWorkspace_0 = runtime.ForwardResponseMessage
)

View File

@@ -12,7 +12,13 @@ service WorkspaceService {
rpc CreateWorkspace (CreateWorkspaceRequest) returns (Workspace) {
option (google.api.http) = {
post: "/apis/v1beta1/{namespace}/workspaces"
body: "workspace"
body: "body"
};
}
rpc GetWorkspace (GetWorkspaceRequest) returns (Workspace) {
option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workspaces/{uid}"
};
}
@@ -29,12 +35,25 @@ service WorkspaceService {
};
}
rpc UpdateWorkspace (UpdateWorkspaceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workspaces/{uid}"
body: "body"
};
}
rpc PauseWorkspace (PauseWorkspaceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workspaces/{uid}/pause"
};
}
rpc ResumeWorkspace (ResumeWorkspaceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workspaces/{uid}/resume"
};
}
rpc DeleteWorkspace (DeleteWorkspaceRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/apis/v1beta1/{namespace}/workspaces/{uid}"
@@ -51,6 +70,8 @@ message Workspace {
WorkspaceTemplate workspaceTemplate = 6;
WorkspaceStatus status = 7;
repeated KeyValue labels = 8;
string url = 9;
repeated Parameter templateParameters = 10;
}
message WorkspaceStatus {
@@ -60,9 +81,23 @@ message WorkspaceStatus {
string terminatedAt = 4;
}
message CreateWorkspaceBody {
string workspaceTemplateUid = 1;
int64 workspaceTemplateVersion = 2;
repeated Parameter parameters = 3;
repeated KeyValue labels = 4;
}
message CreateWorkspaceRequest {
string namespace = 1;
Workspace workspace = 2;
CreateWorkspaceBody body = 2;
}
message GetWorkspaceRequest {
string namespace = 1;
string uid = 2;
}
message UpdateWorkspaceStatusRequest {
@@ -71,6 +106,17 @@ message UpdateWorkspaceStatusRequest {
WorkspaceStatus status = 3;
}
message UpdateWorkspaceBody {
repeated Parameter parameters = 1;
repeated KeyValue labels = 2;
}
message UpdateWorkspaceRequest {
string namespace = 1;
string uid = 2;
UpdateWorkspaceBody body = 3;
}
message ListWorkspaceRequest {
string namespace = 1;
int32 pageSize = 2;
@@ -90,6 +136,11 @@ message PauseWorkspaceRequest {
string uid = 2;
}
message ResumeWorkspaceRequest {
string namespace = 1;
string uid = 2;
}
message DeleteWorkspaceRequest {
string namespace = 1;
string uid = 2;

View File

@@ -43,6 +43,8 @@ type WorkspaceTemplate struct {
IsLatest bool `protobuf:"varint,5,opt,name=isLatest,proto3" json:"isLatest,omitempty"`
CreatedAt string `protobuf:"bytes,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
WorkflowTemplate *WorkflowTemplate `protobuf:"bytes,7,opt,name=workflowTemplate,proto3" json:"workflowTemplate,omitempty"`
Labels []*KeyValue `protobuf:"bytes,8,rep,name=labels,proto3" json:"labels,omitempty"`
IsArchived bool `protobuf:"varint,9,opt,name=isArchived,proto3" json:"isArchived,omitempty"`
}
func (x *WorkspaceTemplate) Reset() {
@@ -126,6 +128,20 @@ func (x *WorkspaceTemplate) GetWorkflowTemplate() *WorkflowTemplate {
return nil
}
func (x *WorkspaceTemplate) GetLabels() []*KeyValue {
if x != nil {
return x.Labels
}
return nil
}
func (x *WorkspaceTemplate) GetIsArchived() bool {
if x != nil {
return x.IsArchived
}
return false
}
type GenerateWorkspaceTemplateWorkflowTemplateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -250,7 +266,7 @@ type UpdateWorkspaceTemplateRequest struct {
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
WorkspaceTemplate *WorkspaceTemplate `protobuf:"bytes,3,opt,name=workspaceTemplate,proto3" json:"workspaceTemplate,omitempty"`
}
@@ -293,9 +309,9 @@ func (x *UpdateWorkspaceTemplateRequest) GetNamespace() string {
return ""
}
func (x *UpdateWorkspaceTemplateRequest) GetName() string {
func (x *UpdateWorkspaceTemplateRequest) GetUid() string {
if x != nil {
return x.Name
return x.Uid
}
return ""
}
@@ -370,6 +386,61 @@ func (x *GetWorkspaceTemplateRequest) GetVersion() int64 {
return 0
}
type ArchiveWorkspaceTemplateRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
}
func (x *ArchiveWorkspaceTemplateRequest) Reset() {
*x = ArchiveWorkspaceTemplateRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_workspace_template_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ArchiveWorkspaceTemplateRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ArchiveWorkspaceTemplateRequest) ProtoMessage() {}
func (x *ArchiveWorkspaceTemplateRequest) ProtoReflect() protoreflect.Message {
mi := &file_workspace_template_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ArchiveWorkspaceTemplateRequest.ProtoReflect.Descriptor instead.
func (*ArchiveWorkspaceTemplateRequest) Descriptor() ([]byte, []int) {
return file_workspace_template_proto_rawDescGZIP(), []int{5}
}
func (x *ArchiveWorkspaceTemplateRequest) GetNamespace() string {
if x != nil {
return x.Namespace
}
return ""
}
func (x *ArchiveWorkspaceTemplateRequest) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
type ListWorkspaceTemplatesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -383,7 +454,7 @@ type ListWorkspaceTemplatesRequest struct {
func (x *ListWorkspaceTemplatesRequest) Reset() {
*x = ListWorkspaceTemplatesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_workspace_template_proto_msgTypes[5]
mi := &file_workspace_template_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -396,7 +467,7 @@ func (x *ListWorkspaceTemplatesRequest) String() string {
func (*ListWorkspaceTemplatesRequest) ProtoMessage() {}
func (x *ListWorkspaceTemplatesRequest) ProtoReflect() protoreflect.Message {
mi := &file_workspace_template_proto_msgTypes[5]
mi := &file_workspace_template_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -409,7 +480,7 @@ func (x *ListWorkspaceTemplatesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListWorkspaceTemplatesRequest.ProtoReflect.Descriptor instead.
func (*ListWorkspaceTemplatesRequest) Descriptor() ([]byte, []int) {
return file_workspace_template_proto_rawDescGZIP(), []int{5}
return file_workspace_template_proto_rawDescGZIP(), []int{6}
}
func (x *ListWorkspaceTemplatesRequest) GetNamespace() string {
@@ -448,7 +519,7 @@ type ListWorkspaceTemplatesResponse struct {
func (x *ListWorkspaceTemplatesResponse) Reset() {
*x = ListWorkspaceTemplatesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_workspace_template_proto_msgTypes[6]
mi := &file_workspace_template_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -461,7 +532,7 @@ func (x *ListWorkspaceTemplatesResponse) String() string {
func (*ListWorkspaceTemplatesResponse) ProtoMessage() {}
func (x *ListWorkspaceTemplatesResponse) ProtoReflect() protoreflect.Message {
mi := &file_workspace_template_proto_msgTypes[6]
mi := &file_workspace_template_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -474,7 +545,7 @@ func (x *ListWorkspaceTemplatesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListWorkspaceTemplatesResponse.ProtoReflect.Descriptor instead.
func (*ListWorkspaceTemplatesResponse) Descriptor() ([]byte, []int) {
return file_workspace_template_proto_rawDescGZIP(), []int{6}
return file_workspace_template_proto_rawDescGZIP(), []int{7}
}
func (x *ListWorkspaceTemplatesResponse) GetCount() int32 {
@@ -524,7 +595,7 @@ type ListWorkspaceTemplateVersionsRequest struct {
func (x *ListWorkspaceTemplateVersionsRequest) Reset() {
*x = ListWorkspaceTemplateVersionsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_workspace_template_proto_msgTypes[7]
mi := &file_workspace_template_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -537,7 +608,7 @@ func (x *ListWorkspaceTemplateVersionsRequest) String() string {
func (*ListWorkspaceTemplateVersionsRequest) ProtoMessage() {}
func (x *ListWorkspaceTemplateVersionsRequest) ProtoReflect() protoreflect.Message {
mi := &file_workspace_template_proto_msgTypes[7]
mi := &file_workspace_template_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -550,7 +621,7 @@ func (x *ListWorkspaceTemplateVersionsRequest) ProtoReflect() protoreflect.Messa
// Deprecated: Use ListWorkspaceTemplateVersionsRequest.ProtoReflect.Descriptor instead.
func (*ListWorkspaceTemplateVersionsRequest) Descriptor() ([]byte, []int) {
return file_workspace_template_proto_rawDescGZIP(), []int{7}
return file_workspace_template_proto_rawDescGZIP(), []int{8}
}
func (x *ListWorkspaceTemplateVersionsRequest) GetNamespace() string {
@@ -579,7 +650,7 @@ type ListWorkspaceTemplateVersionsResponse struct {
func (x *ListWorkspaceTemplateVersionsResponse) Reset() {
*x = ListWorkspaceTemplateVersionsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_workspace_template_proto_msgTypes[8]
mi := &file_workspace_template_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -592,7 +663,7 @@ func (x *ListWorkspaceTemplateVersionsResponse) String() string {
func (*ListWorkspaceTemplateVersionsResponse) ProtoMessage() {}
func (x *ListWorkspaceTemplateVersionsResponse) ProtoReflect() protoreflect.Message {
mi := &file_workspace_template_proto_msgTypes[8]
mi := &file_workspace_template_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -605,7 +676,7 @@ func (x *ListWorkspaceTemplateVersionsResponse) ProtoReflect() protoreflect.Mess
// Deprecated: Use ListWorkspaceTemplateVersionsResponse.ProtoReflect.Descriptor instead.
func (*ListWorkspaceTemplateVersionsResponse) Descriptor() ([]byte, []int) {
return file_workspace_template_proto_rawDescGZIP(), []int{8}
return file_workspace_template_proto_rawDescGZIP(), []int{9}
}
func (x *ListWorkspaceTemplateVersionsResponse) GetCount() int32 {
@@ -632,158 +703,178 @@ var file_workspace_template_proto_rawDesc = []byte{
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xec, 0x01, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e,
0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e,
0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73,
0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73,
0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
0x41, 0x0a, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x52, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x22, 0xa8, 0x01, 0x0a, 0x30, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x57,
0x6f, 0x74, 0x6f, 0x1a, 0x0b, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0xb3, 0x02, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65,
0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65,
0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x05,
0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x1c,
0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x41, 0x0a, 0x10,
0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x10, 0x77,
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12,
0x25, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06,
0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41, 0x72, 0x63, 0x68,
0x69, 0x76, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x41, 0x72,
0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x22, 0xa8, 0x01, 0x0a, 0x30, 0x47, 0x65, 0x6e, 0x65, 0x72,
0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x44, 0x0a, 0x11, 0x77,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65,
0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x44, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73,
0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x11, 0x77, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x84, 0x01,
0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x11,
0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x22, 0x84, 0x01, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
0x63, 0x65, 0x12, 0x44, 0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d,
0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x1e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x44, 0x0a, 0x11, 0x77,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x11,
0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x22, 0x67, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x44,
0x0a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x52, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65,
0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x44, 0x0a, 0x11, 0x77, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73,
0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x11, 0x77, 0x6f,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22,
0x67, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c,
0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10,
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,
0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x51, 0x0a, 0x1f, 0x41, 0x72,
0x63, 0x68, 0x69, 0x76, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a,
0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x6d, 0x0a,
0x1d, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c,
0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x6d, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d,
0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53,
0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53,
0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, 0xc8, 0x01, 0x0a, 0x1e, 0x4c, 0x69, 0x73, 0x74,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x12, 0x46, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d,
0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x52, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x70, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x70, 0x61, 0x67,
0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x22, 0x56, 0x0a, 0x24, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69,
0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x85, 0x01, 0x0a, 0x25, 0x4c,
0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x12, 0x77, 0x6f,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x12,
0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x73, 0x32, 0xaf, 0x08, 0x0a, 0x18, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0xdb, 0x01, 0x0a, 0x29, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x35, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72,
0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66,
0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x60, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x5a, 0x22, 0x45, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74,
0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, 0xc8, 0x01, 0x0a,
0x1e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73,
0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x12, 0x0a,
0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67,
0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x70, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x56, 0x0a, 0x24, 0x4c, 0x69, 0x73, 0x74, 0x57,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22,
0x85, 0x01, 0x0a, 0x25, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x46, 0x0a, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x52, 0x12, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x32, 0xce, 0x09, 0x0a, 0x18, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0xdb, 0x01, 0x0a, 0x29, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x12, 0x35, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74,
0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x22, 0x60, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x5a, 0x22, 0x45, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f,
0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
0x63, 0x65, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x2f, 0x77, 0x6f,
0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x3a,
0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x12, 0xa0, 0x01, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x23,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73,
0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x48, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x42, 0x22, 0x2d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74,
0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x77,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x77, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x3a, 0x11, 0x77, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0xa0, 0x01,
0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65,
0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x48, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x42, 0x22, 0x2d,
0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x3a, 0x11, 0x77,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65,
0x12, 0xa7, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73,
0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x23, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x65, 0x73, 0x3a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d,
0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0xa6, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x6f,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x4e,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x48, 0x1a, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x3a, 0x11, 0x77, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x9d,
0x01, 0x0a, 0x18, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x4f, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x49, 0x1a, 0x34, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x43, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x3d, 0x1a, 0x3b, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31,
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x77, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73,
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x11, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x8d, 0x01, 0x0a, 0x14, 0x47,
0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x6f, 0x72, 0x6b,
0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x3b, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x35, 0x12, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31, 0x62,
0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d,
0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x98, 0x01, 0x0a, 0x16, 0x4c,
0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x2f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x8d,
0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65,
0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74,
0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x65, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x35, 0x12, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x73,
0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
0x61, 0x63, 0x65, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x98,
0x01, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d,
0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x35,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x12, 0x2d, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0xbc, 0x01, 0x0a, 0x1d, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69,
0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63,
0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x35, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x12, 0x2d, 0x2f, 0x61, 0x70, 0x69,
0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f,
0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x12, 0xbc, 0x01, 0x0a, 0x1d, 0x4c, 0x69,
0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c,
0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65,
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x44,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3e, 0x12, 0x3c, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x76, 0x31,
0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x65, 0x6d, 0x70,
0x6c, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54,
0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73,
0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61,
0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x44, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3e, 0x12, 0x3c, 0x2f, 0x61, 0x70, 0x69,
0x73, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f,
0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x2f,
0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -798,43 +889,48 @@ func file_workspace_template_proto_rawDescGZIP() []byte {
return file_workspace_template_proto_rawDescData
}
var file_workspace_template_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_workspace_template_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_workspace_template_proto_goTypes = []interface{}{
(*WorkspaceTemplate)(nil), // 0: api.WorkspaceTemplate
(*GenerateWorkspaceTemplateWorkflowTemplateRequest)(nil), // 1: api.GenerateWorkspaceTemplateWorkflowTemplateRequest
(*CreateWorkspaceTemplateRequest)(nil), // 2: api.CreateWorkspaceTemplateRequest
(*UpdateWorkspaceTemplateRequest)(nil), // 3: api.UpdateWorkspaceTemplateRequest
(*GetWorkspaceTemplateRequest)(nil), // 4: api.GetWorkspaceTemplateRequest
(*ListWorkspaceTemplatesRequest)(nil), // 5: api.ListWorkspaceTemplatesRequest
(*ListWorkspaceTemplatesResponse)(nil), // 6: api.ListWorkspaceTemplatesResponse
(*ListWorkspaceTemplateVersionsRequest)(nil), // 7: api.ListWorkspaceTemplateVersionsRequest
(*ListWorkspaceTemplateVersionsResponse)(nil), // 8: api.ListWorkspaceTemplateVersionsResponse
(*WorkflowTemplate)(nil), // 9: api.WorkflowTemplate
(*ArchiveWorkspaceTemplateRequest)(nil), // 5: api.ArchiveWorkspaceTemplateRequest
(*ListWorkspaceTemplatesRequest)(nil), // 6: api.ListWorkspaceTemplatesRequest
(*ListWorkspaceTemplatesResponse)(nil), // 7: api.ListWorkspaceTemplatesResponse
(*ListWorkspaceTemplateVersionsRequest)(nil), // 8: api.ListWorkspaceTemplateVersionsRequest
(*ListWorkspaceTemplateVersionsResponse)(nil), // 9: api.ListWorkspaceTemplateVersionsResponse
(*WorkflowTemplate)(nil), // 10: api.WorkflowTemplate
(*KeyValue)(nil), // 11: api.KeyValue
}
var file_workspace_template_proto_depIdxs = []int32{
9, // 0: api.WorkspaceTemplate.workflowTemplate:type_name -> api.WorkflowTemplate
0, // 1: api.GenerateWorkspaceTemplateWorkflowTemplateRequest.workspaceTemplate:type_name -> api.WorkspaceTemplate
0, // 2: api.CreateWorkspaceTemplateRequest.workspaceTemplate:type_name -> api.WorkspaceTemplate
0, // 3: api.UpdateWorkspaceTemplateRequest.workspaceTemplate:type_name -> api.WorkspaceTemplate
0, // 4: api.ListWorkspaceTemplatesResponse.workspaceTemplates:type_name -> api.WorkspaceTemplate
0, // 5: api.ListWorkspaceTemplateVersionsResponse.workspaceTemplates:type_name -> api.WorkspaceTemplate
1, // 6: api.WorkspaceTemplateService.GenerateWorkspaceTemplateWorkflowTemplate:input_type -> api.GenerateWorkspaceTemplateWorkflowTemplateRequest
2, // 7: api.WorkspaceTemplateService.CreateWorkspaceTemplate:input_type -> api.CreateWorkspaceTemplateRequest
3, // 8: api.WorkspaceTemplateService.UpdateWorkspaceTemplate:input_type -> api.UpdateWorkspaceTemplateRequest
4, // 9: api.WorkspaceTemplateService.GetWorkspaceTemplate:input_type -> api.GetWorkspaceTemplateRequest
5, // 10: api.WorkspaceTemplateService.ListWorkspaceTemplates:input_type -> api.ListWorkspaceTemplatesRequest
7, // 11: api.WorkspaceTemplateService.ListWorkspaceTemplateVersions:input_type -> api.ListWorkspaceTemplateVersionsRequest
9, // 12: api.WorkspaceTemplateService.GenerateWorkspaceTemplateWorkflowTemplate:output_type -> api.WorkflowTemplate
0, // 13: api.WorkspaceTemplateService.CreateWorkspaceTemplate:output_type -> api.WorkspaceTemplate
0, // 14: api.WorkspaceTemplateService.UpdateWorkspaceTemplate:output_type -> api.WorkspaceTemplate
0, // 15: api.WorkspaceTemplateService.GetWorkspaceTemplate:output_type -> api.WorkspaceTemplate
6, // 16: api.WorkspaceTemplateService.ListWorkspaceTemplates:output_type -> api.ListWorkspaceTemplatesResponse
8, // 17: api.WorkspaceTemplateService.ListWorkspaceTemplateVersions:output_type -> api.ListWorkspaceTemplateVersionsResponse
12, // [12:18] is the sub-list for method output_type
6, // [6:12] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
10, // 0: api.WorkspaceTemplate.workflowTemplate:type_name -> api.WorkflowTemplate
11, // 1: api.WorkspaceTemplate.labels:type_name -> api.KeyValue
0, // 2: api.GenerateWorkspaceTemplateWorkflowTemplateRequest.workspaceTemplate:type_name -> api.WorkspaceTemplate
0, // 3: api.CreateWorkspaceTemplateRequest.workspaceTemplate:type_name -> api.WorkspaceTemplate
0, // 4: api.UpdateWorkspaceTemplateRequest.workspaceTemplate:type_name -> api.WorkspaceTemplate
0, // 5: api.ListWorkspaceTemplatesResponse.workspaceTemplates:type_name -> api.WorkspaceTemplate
0, // 6: api.ListWorkspaceTemplateVersionsResponse.workspaceTemplates:type_name -> api.WorkspaceTemplate
1, // 7: api.WorkspaceTemplateService.GenerateWorkspaceTemplateWorkflowTemplate:input_type -> api.GenerateWorkspaceTemplateWorkflowTemplateRequest
2, // 8: api.WorkspaceTemplateService.CreateWorkspaceTemplate:input_type -> api.CreateWorkspaceTemplateRequest
3, // 9: api.WorkspaceTemplateService.UpdateWorkspaceTemplate:input_type -> api.UpdateWorkspaceTemplateRequest
5, // 10: api.WorkspaceTemplateService.ArchiveWorkspaceTemplate:input_type -> api.ArchiveWorkspaceTemplateRequest
4, // 11: api.WorkspaceTemplateService.GetWorkspaceTemplate:input_type -> api.GetWorkspaceTemplateRequest
6, // 12: api.WorkspaceTemplateService.ListWorkspaceTemplates:input_type -> api.ListWorkspaceTemplatesRequest
8, // 13: api.WorkspaceTemplateService.ListWorkspaceTemplateVersions:input_type -> api.ListWorkspaceTemplateVersionsRequest
10, // 14: api.WorkspaceTemplateService.GenerateWorkspaceTemplateWorkflowTemplate:output_type -> api.WorkflowTemplate
0, // 15: api.WorkspaceTemplateService.CreateWorkspaceTemplate:output_type -> api.WorkspaceTemplate
0, // 16: api.WorkspaceTemplateService.UpdateWorkspaceTemplate:output_type -> api.WorkspaceTemplate
0, // 17: api.WorkspaceTemplateService.ArchiveWorkspaceTemplate:output_type -> api.WorkspaceTemplate
0, // 18: api.WorkspaceTemplateService.GetWorkspaceTemplate:output_type -> api.WorkspaceTemplate
7, // 19: api.WorkspaceTemplateService.ListWorkspaceTemplates:output_type -> api.ListWorkspaceTemplatesResponse
9, // 20: api.WorkspaceTemplateService.ListWorkspaceTemplateVersions:output_type -> api.ListWorkspaceTemplateVersionsResponse
14, // [14:21] is the sub-list for method output_type
7, // [7:14] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_workspace_template_proto_init() }
@@ -843,6 +939,7 @@ func file_workspace_template_proto_init() {
return
}
file_workflow_template_proto_init()
file_label_proto_init()
if !protoimpl.UnsafeEnabled {
file_workspace_template_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorkspaceTemplate); i {
@@ -905,7 +1002,7 @@ func file_workspace_template_proto_init() {
}
}
file_workspace_template_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceTemplatesRequest); i {
switch v := v.(*ArchiveWorkspaceTemplateRequest); i {
case 0:
return &v.state
case 1:
@@ -917,7 +1014,7 @@ func file_workspace_template_proto_init() {
}
}
file_workspace_template_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceTemplatesResponse); i {
switch v := v.(*ListWorkspaceTemplatesRequest); i {
case 0:
return &v.state
case 1:
@@ -929,7 +1026,7 @@ func file_workspace_template_proto_init() {
}
}
file_workspace_template_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceTemplateVersionsRequest); i {
switch v := v.(*ListWorkspaceTemplatesResponse); i {
case 0:
return &v.state
case 1:
@@ -941,6 +1038,18 @@ func file_workspace_template_proto_init() {
}
}
file_workspace_template_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceTemplateVersionsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_workspace_template_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceTemplateVersionsResponse); i {
case 0:
return &v.state
@@ -959,7 +1068,7 @@ func file_workspace_template_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_workspace_template_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
@@ -991,6 +1100,8 @@ type WorkspaceTemplateServiceClient interface {
CreateWorkspaceTemplate(ctx context.Context, in *CreateWorkspaceTemplateRequest, opts ...grpc.CallOption) (*WorkspaceTemplate, error)
// Updates a WorkspaceTemplate
UpdateWorkspaceTemplate(ctx context.Context, in *UpdateWorkspaceTemplateRequest, opts ...grpc.CallOption) (*WorkspaceTemplate, error)
// Archives a WorkspaceTemplate
ArchiveWorkspaceTemplate(ctx context.Context, in *ArchiveWorkspaceTemplateRequest, opts ...grpc.CallOption) (*WorkspaceTemplate, error)
// Get a WorkspaceTemplate
GetWorkspaceTemplate(ctx context.Context, in *GetWorkspaceTemplateRequest, opts ...grpc.CallOption) (*WorkspaceTemplate, error)
ListWorkspaceTemplates(ctx context.Context, in *ListWorkspaceTemplatesRequest, opts ...grpc.CallOption) (*ListWorkspaceTemplatesResponse, error)
@@ -1032,6 +1143,15 @@ func (c *workspaceTemplateServiceClient) UpdateWorkspaceTemplate(ctx context.Con
return out, nil
}
func (c *workspaceTemplateServiceClient) ArchiveWorkspaceTemplate(ctx context.Context, in *ArchiveWorkspaceTemplateRequest, opts ...grpc.CallOption) (*WorkspaceTemplate, error) {
out := new(WorkspaceTemplate)
err := c.cc.Invoke(ctx, "/api.WorkspaceTemplateService/ArchiveWorkspaceTemplate", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *workspaceTemplateServiceClient) GetWorkspaceTemplate(ctx context.Context, in *GetWorkspaceTemplateRequest, opts ...grpc.CallOption) (*WorkspaceTemplate, error) {
out := new(WorkspaceTemplate)
err := c.cc.Invoke(ctx, "/api.WorkspaceTemplateService/GetWorkspaceTemplate", in, out, opts...)
@@ -1067,6 +1187,8 @@ type WorkspaceTemplateServiceServer interface {
CreateWorkspaceTemplate(context.Context, *CreateWorkspaceTemplateRequest) (*WorkspaceTemplate, error)
// Updates a WorkspaceTemplate
UpdateWorkspaceTemplate(context.Context, *UpdateWorkspaceTemplateRequest) (*WorkspaceTemplate, error)
// Archives a WorkspaceTemplate
ArchiveWorkspaceTemplate(context.Context, *ArchiveWorkspaceTemplateRequest) (*WorkspaceTemplate, error)
// Get a WorkspaceTemplate
GetWorkspaceTemplate(context.Context, *GetWorkspaceTemplateRequest) (*WorkspaceTemplate, error)
ListWorkspaceTemplates(context.Context, *ListWorkspaceTemplatesRequest) (*ListWorkspaceTemplatesResponse, error)
@@ -1086,6 +1208,9 @@ func (*UnimplementedWorkspaceTemplateServiceServer) CreateWorkspaceTemplate(cont
func (*UnimplementedWorkspaceTemplateServiceServer) UpdateWorkspaceTemplate(context.Context, *UpdateWorkspaceTemplateRequest) (*WorkspaceTemplate, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkspaceTemplate not implemented")
}
func (*UnimplementedWorkspaceTemplateServiceServer) ArchiveWorkspaceTemplate(context.Context, *ArchiveWorkspaceTemplateRequest) (*WorkspaceTemplate, error) {
return nil, status.Errorf(codes.Unimplemented, "method ArchiveWorkspaceTemplate not implemented")
}
func (*UnimplementedWorkspaceTemplateServiceServer) GetWorkspaceTemplate(context.Context, *GetWorkspaceTemplateRequest) (*WorkspaceTemplate, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceTemplate not implemented")
}
@@ -1154,6 +1279,24 @@ func _WorkspaceTemplateService_UpdateWorkspaceTemplate_Handler(srv interface{},
return interceptor(ctx, in, info, handler)
}
func _WorkspaceTemplateService_ArchiveWorkspaceTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ArchiveWorkspaceTemplateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WorkspaceTemplateServiceServer).ArchiveWorkspaceTemplate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/api.WorkspaceTemplateService/ArchiveWorkspaceTemplate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WorkspaceTemplateServiceServer).ArchiveWorkspaceTemplate(ctx, req.(*ArchiveWorkspaceTemplateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WorkspaceTemplateService_GetWorkspaceTemplate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWorkspaceTemplateRequest)
if err := dec(in); err != nil {
@@ -1224,6 +1367,10 @@ var _WorkspaceTemplateService_serviceDesc = grpc.ServiceDesc{
MethodName: "UpdateWorkspaceTemplate",
Handler: _WorkspaceTemplateService_UpdateWorkspaceTemplate_Handler,
},
{
MethodName: "ArchiveWorkspaceTemplate",
Handler: _WorkspaceTemplateService_ArchiveWorkspaceTemplate_Handler,
},
{
MethodName: "GetWorkspaceTemplate",
Handler: _WorkspaceTemplateService_GetWorkspaceTemplate_Handler,

View File

@@ -223,15 +223,15 @@ func request_WorkspaceTemplateService_UpdateWorkspaceTemplate_0(ctx context.Cont
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.UpdateWorkspaceTemplate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
@@ -269,15 +269,15 @@ func local_request_WorkspaceTemplateService_UpdateWorkspaceTemplate_0(ctx contex
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["name"]
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name")
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Name, err = runtime.String(val)
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err)
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.UpdateWorkspaceTemplate(ctx, &protoReq)
@@ -285,6 +285,82 @@ func local_request_WorkspaceTemplateService_UpdateWorkspaceTemplate_0(ctx contex
}
func request_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceTemplateServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ArchiveWorkspaceTemplateRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := client.ArchiveWorkspaceTemplate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceTemplateServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ArchiveWorkspaceTemplateRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["namespace"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace")
}
protoReq.Namespace, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err)
}
val, ok = pathParams["uid"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
}
protoReq.Uid, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
}
msg, err := server.ArchiveWorkspaceTemplate(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_WorkspaceTemplateService_GetWorkspaceTemplate_0 = &utilities.DoubleArray{Encoding: map[string]int{"namespace": 0, "uid": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}}
)
@@ -586,6 +662,26 @@ func RegisterWorkspaceTemplateServiceHandlerServer(ctx context.Context, mux *run
})
mux.Handle("PUT", pattern_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WorkspaceTemplateService_GetWorkspaceTemplate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -747,6 +843,26 @@ func RegisterWorkspaceTemplateServiceHandlerClient(ctx context.Context, mux *run
})
mux.Handle("PUT", pattern_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WorkspaceTemplateService_GetWorkspaceTemplate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -815,7 +931,9 @@ var (
pattern_WorkspaceTemplateService_CreateWorkspaceTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workspace_templates"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceTemplateService_UpdateWorkspaceTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workspace_templates", "name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceTemplateService_UpdateWorkspaceTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workspace_templates", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workspace_templates", "uid", "archive"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkspaceTemplateService_GetWorkspaceTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"apis", "v1beta1", "namespace", "workspace_templates", "uid"}, "", runtime.AssumeColonVerbOpt(true)))
@@ -831,6 +949,8 @@ var (
forward_WorkspaceTemplateService_UpdateWorkspaceTemplate_0 = runtime.ForwardResponseMessage
forward_WorkspaceTemplateService_ArchiveWorkspaceTemplate_0 = runtime.ForwardResponseMessage
forward_WorkspaceTemplateService_GetWorkspaceTemplate_0 = runtime.ForwardResponseMessage
forward_WorkspaceTemplateService_ListWorkspaceTemplates_0 = runtime.ForwardResponseMessage

View File

@@ -5,6 +5,7 @@ package api;
import "google/api/annotations.proto";
import "workflow_template.proto";
import "google/protobuf/empty.proto";
import "label.proto";
service WorkspaceTemplateService {
// Get the generated WorkflowTemplate for a WorkspaceTemplate
@@ -26,11 +27,18 @@ service WorkspaceTemplateService {
// Updates a WorkspaceTemplate
rpc UpdateWorkspaceTemplate (UpdateWorkspaceTemplateRequest) returns (WorkspaceTemplate) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workspace_templates/{name}"
put: "/apis/v1beta1/{namespace}/workspace_templates/{uid}"
body: "workspaceTemplate"
};
}
// Archives a WorkspaceTemplate
rpc ArchiveWorkspaceTemplate (ArchiveWorkspaceTemplateRequest) returns (WorkspaceTemplate) {
option (google.api.http) = {
put: "/apis/v1beta1/{namespace}/workspace_templates/{uid}/archive"
};
}
// Get a WorkspaceTemplate
rpc GetWorkspaceTemplate (GetWorkspaceTemplateRequest) returns (WorkspaceTemplate) {
option (google.api.http) = {
@@ -59,6 +67,8 @@ message WorkspaceTemplate {
bool isLatest = 5;
string createdAt = 6;
WorkflowTemplate workflowTemplate = 7;
repeated KeyValue labels = 8;
bool isArchived = 9;
}
message GenerateWorkspaceTemplateWorkflowTemplateRequest {
@@ -74,7 +84,7 @@ message CreateWorkspaceTemplateRequest {
message UpdateWorkspaceTemplateRequest {
string namespace = 1;
string name = 2;
string uid = 2;
WorkspaceTemplate workspaceTemplate = 3;
}
@@ -84,6 +94,11 @@ message GetWorkspaceTemplateRequest {
int64 version = 3;
}
message ArchiveWorkspaceTemplateRequest {
string namespace = 1;
string uid = 2;
}
message ListWorkspaceTemplatesRequest {
string namespace = 1;
int32 pageSize = 2;

17
cmd/README.md Normal file
View File

@@ -0,0 +1,17 @@
# Helper scripts
## gen-release-md.go
Generates markdown for releases.
Usage:
```bash
go run cmd/gen-release-md/gen-release-md.go -v=0.10.0 > /tmp/release.md
```
## goose.go
Supports both Go and SQL migrations.
```bash
go run cmd/goose/goose up # run up migrations
go run cmd/goose/goose down # run down migrations
```

View File

@@ -0,0 +1,158 @@
package main
import (
"encoding/json"
"flag"
"fmt"
"net/http"
"strings"
)
type User struct {
Login string `json:"login"`
URL string `json:"html_url"`
AvatarURL string `json:"avatar_url"`
}
type Label struct {
Name string `json:"name"`
}
type PullRequest struct {
URL string `json:"url"`
}
type Issue struct {
Number int `json:"number"`
URL string `json:"html_url"`
Title string `json:"title"`
User User `json:"user"`
PullRequest *PullRequest `json:"pull_request"`
Labels []Label `json:"labels"`
}
const (
apiPrefix = "https://api.github.com/repos/"
issuesPathAndQuery = "/issues?milestone=3&state=closed"
)
var releaseTemplate = `# Documentation
See [Documentation](https://docs.onepanel.ai)
# CLI Installation
## Linux
` + "```" + `
# Download the binary
curl -sLO https://github.com/onepanelio/core/releases/download/v%s/opctl-linux-amd64
# Make binary executable
chmod +x opctl-linux-amd64
# Move binary to path
mv ./opctl-linux-amd64 /usr/local/bin/opctl
# Test installation
opctl version
` + "```" + `
## macOS
` + "```" + `
# Download the binary
curl -sLO https://github.com/onepanelio/core/releases/download/v%s/opctl-macos-amd64
# Make binary executable
chmod +x opctl-macos-amd64
# Move binary to path
mv ./opctl-macos-amd64 /usr/local/bin/opctl
# Test installation
opctl version
` + "```"
var repositories = []string{
"onepanelio/core",
"onepanelio/core-ui",
"onepanelio/cli",
"onepanelio/manifests",
"onepanelio/core-docs",
}
// Parse issues, pulling only PRs and categorize them based on labels
// Print everything as MD that can be copied into release notes
func printMarkDown(issues []*Issue, version *string) {
contributors := make(map[string]User, 0)
sections := make(map[string]string, 0)
for _, iss := range issues {
if iss.PullRequest == nil {
continue
}
parts := strings.Split(iss.Title, ":")
if len(parts) > 0 {
contributors[iss.User.Login] = iss.User
sections[parts[0]] += fmt.Sprintf("- %s ([#%d](%s))\n", iss.Title, iss.Number, iss.URL)
}
}
releaseTemplate := fmt.Sprintf(releaseTemplate, *version, *version)
fmt.Println(releaseTemplate)
fmt.Println("# Changelog\n")
fmt.Println("## Features\n")
fmt.Println(sections["feat"])
fmt.Println("## Fixes\n")
fmt.Println(sections["fix"])
fmt.Println("## Docs\n")
fmt.Println(sections["docs"])
fmt.Println("## Chores\n")
fmt.Println(sections["chore"])
fmt.Println("# Contributors\n")
for _, user := range contributors {
fmt.Println(fmt.Sprintf("- <a href=\"%s\"><img src=\"%s\" width=\"12\"/> <strong>%s</strong></a> %s", user.URL, user.AvatarURL, user.Login, user.Login))
}
}
// Get issues from repository
func getIssues(repository string, username *string) ([]*Issue, error) {
client := &http.Client{}
req, err := http.NewRequest(http.MethodGet, apiPrefix+repository+issuesPathAndQuery, nil)
if username != nil {
req.SetBasicAuth(*username, "")
}
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
issues := make([]*Issue, 0)
if err = json.NewDecoder(res.Body).Decode(&issues); err != nil {
return nil, err
}
return issues, nil
}
func main() {
version := flag.String("v", "1.0.0", "Version of release, example: -v=1.0.0")
username := flag.String("u", "", "GitHub username for request, example: -u=octocat")
flag.Parse()
issues := make([]*Issue, 0)
for _, repository := range repositories {
iss, err := getIssues(repository, username)
if err != nil {
return
}
issues = append(issues, iss...)
}
printMarkDown(issues, version)
}

56
cmd/goose/goose.go Normal file
View File

@@ -0,0 +1,56 @@
// This is custom goose binary to support .go migration files in ./db dir
package main
import (
"flag"
"fmt"
"github.com/jmoiron/sqlx"
_ "github.com/onepanelio/core/db"
v1 "github.com/onepanelio/core/pkg"
"log"
"os"
"github.com/pressly/goose"
)
var (
flags = flag.NewFlagSet("goose", flag.ExitOnError)
dir = flags.String("dir", ".", "directory with migration files")
)
func main() {
flags.Parse(os.Args[1:])
args := flags.Args()
if len(args) < 1 {
flags.Usage()
return
}
kubeConfig := v1.NewConfig()
client, err := v1.NewClient(kubeConfig, nil)
if err != nil {
log.Fatalf("Failed to connect to Kubernetes cluster: %v", err)
}
config, err := client.GetSystemConfig()
if err != nil {
log.Fatalf("Failed to get system config: %v", err)
}
databaseDataSourceName := fmt.Sprintf("host=%v user=%v password=%v dbname=%v sslmode=disable",
config["databaseHost"], config["databaseUsername"], config["databasePassword"], config["databaseName"])
db := sqlx.MustConnect(config["databaseDriverName"], databaseDataSourceName)
command := args[0]
arguments := []string{}
if len(args) > 2 {
arguments = append(arguments, args[2:]...)
}
if err := goose.Run(command, db.DB, *dir, arguments...); err != nil {
log.Fatalf("goose %v: %v", command, err)
}
}

View File

@@ -2,15 +2,15 @@
CREATE TABLE workflow_templates
(
id serial PRIMARY KEY,
uid varchar(36) UNIQUE NOT NULL CHECK(uid <> ''),
uid varchar(30) UNIQUE NOT NULL CHECK(uid <> ''),
name text NOT NULL CHECK(name <> ''),
namespace varchar(36) NOT NULL,
namespace varchar(30) NOT NULL,
-- auditing info
created_at timestamp NOT NULL DEFAULT (NOW() at time zone 'utc'),
modified_at timestamp,
UNIQUE (name, namespace)
UNIQUE (uid, namespace)
);
-- +goose Down

View File

@@ -1,7 +0,0 @@
-- +goose Up
ALTER TABLE workflow_templates DROP CONSTRAINT workflow_templates_name_namespace_key;
CREATE UNIQUE INDEX workflow_templates_name_namespace_key ON workflow_templates (name, namespace) WHERE is_archived = false;
-- +goose Down
DROP INDEX workflow_templates_name_namespace_key;
ALTER TABLE workflow_templates ADD CONSTRAINT workflow_templates_name_namespace_key UNIQUE (name, namespace);

View File

@@ -1,5 +0,0 @@
-- +goose Up
ALTER TABLE workflow_template_versions DROP COLUMN manifest;
-- +goose Down
ALTER TABLE workflow_template_versions ADD COLUMN manifest TEXT NOT NULL;

View File

@@ -3,9 +3,10 @@
CREATE TABLE workflow_executions
(
id serial PRIMARY KEY,
uid varchar(30) UNIQUE NOT NULL CHECK(uid <> ''),
workflow_template_id integer NOT NULL REFERENCES workflow_templates ON DELETE CASCADE,
name text NOT NULL CHECK (name <> ''),
namespace varchar(36) NOT NULL,
namespace varchar(30) NOT NULL,
-- auditing info
created_at timestamp NOT NULL DEFAULT (NOW() at time zone 'utc'),

View File

@@ -2,6 +2,7 @@
CREATE TABLE workflow_template_versions
(
id serial PRIMARY KEY,
uid varchar(30) UNIQUE NOT NULL CHECK(uid <> ''),
workflow_template_id integer NOT NULL REFERENCES workflow_templates ON DELETE CASCADE,
version integer NOT NULL,
is_latest boolean NOT NULL,

View File

@@ -2,8 +2,8 @@
CREATE TABLE cron_workflows
(
id serial PRIMARY KEY,
uid varchar(36) UNIQUE NOT NULL CHECK(uid <> ''),
name varchar(255),
uid varchar(30) UNIQUE NOT NULL CHECK(uid <> ''),
name varchar(30),
workflow_template_version_id INT REFERENCES workflow_template_versions,
schedule varchar(255),
timezone varchar(255),

View File

@@ -2,9 +2,9 @@
CREATE TABLE workspace_templates
(
id serial PRIMARY KEY,
uid varchar(36) UNIQUE NOT NULL CHECK(uid <> ''),
name text NOT NULL CHECK(name <> ''),
namespace varchar(36) NOT NULL,
uid varchar(30) NOT NULL CHECK(uid <> ''),
name varchar(30) NOT NULL CHECK(name <> ''),
namespace varchar(30) NOT NULL,
is_archived boolean DEFAULT false,
workflow_template_id integer NOT NULL REFERENCES workflow_templates ON DELETE CASCADE,
@@ -15,6 +15,7 @@ CREATE TABLE workspace_templates
);
CREATE UNIQUE INDEX workspace_templates_name_namespace_key ON workspace_templates (name, namespace) WHERE is_archived = false;
CREATE UNIQUE INDEX workspace_templates_uid_namespace_key ON workspace_templates (uid, namespace) WHERE is_archived = false;
-- +goose Down
DROP TABLE workspace_templates;
DROP TABLE workspace_templates;

View File

@@ -1,14 +0,0 @@
-- +goose Up
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
ALTER TABLE workflow_template_versions ADD COLUMN uid varchar(36) UNIQUE CHECK(uid <> '');
UPDATE workflow_template_versions SET uid = uuid_generate_v4();
ALTER TABLE workflow_template_versions ALTER COLUMN uid SET NOT NULL;
ALTER TABLE labels ADD COLUMN uid varchar(36) UNIQUE CHECK(uid <> '');
UPDATE labels SET uid = uuid_generate_v4();
ALTER TABLE labels ALTER COLUMN uid SET NOT NULL;
-- +goose Down
ALTER TABLE workflow_template_versions DROP COLUMN uid;
ALTER TABLE labels DROP COLUMN uid;
DROP EXTENSION IF EXISTS "uuid-ossp"

View File

@@ -1,7 +0,0 @@
-- +goose Up
ALTER TABLE workflow_executions ADD COLUMN uid varchar(36) UNIQUE CHECK(uid <> '');
UPDATE workflow_executions SET uid = uuid_generate_v4();
ALTER TABLE workflow_executions ALTER COLUMN uid SET NOT NULL;
-- +goose Down
ALTER TABLE workflow_executions DROP COLUMN uid;

View File

@@ -2,9 +2,9 @@
CREATE TABLE workspaces
(
id serial PRIMARY KEY,
uid varchar(36) UNIQUE NOT NULL CHECK(uid <> ''),
name text NOT NULL CHECK(name <> ''),
namespace varchar(36) NOT NULL,
uid varchar(30) NOT NULL CHECK(uid <> ''),
name varchar(30) NOT NULL CHECK(name <> ''),
namespace varchar(30) NOT NULL,
phase varchar(50) NOT NULL,
parameters jsonb NOT NULL,
@@ -20,5 +20,8 @@ CREATE TABLE workspaces
modified_at timestamp
);
CREATE UNIQUE INDEX workspaces_name_namespace_key ON workspaces (name, namespace) WHERE phase <> 'Terminated';
CREATE UNIQUE INDEX workspaces_uid_namespace_key ON workspaces (uid, namespace) WHERE phase <> 'Terminated';
-- +goose Down
DROP TABLE workspaces;
DROP TABLE workspaces;

View File

@@ -0,0 +1,7 @@
-- +goose Up
ALTER TABLE workflow_templates ADD COLUMN is_system BOOLEAN DEFAULT false;
UPDATE workflow_templates SET is_system = false;
ALTER TABLE workflow_templates ALTER COLUMN is_system SET NOT NULL;
-- +goose Down
ALTER TABLE workflow_templates DROP COLUMN is_system;

View File

@@ -0,0 +1,7 @@
-- +goose Up
ALTER TABLE workspaces ADD COLUMN url TEXT;
UPDATE workspaces set url = '';
ALTER TABLE workspaces ALTER COLUMN url SET NOT NULL;
-- +goose Down
ALTER TABLE workspaces DROP COLUMN url;

View File

@@ -0,0 +1,5 @@
-- +goose Up
ALTER TABLE workspaces ADD COLUMN updated_at timestamp;
-- +goose Down
ALTER TABLE workspaces DROP COLUMN updated_at;

View File

@@ -0,0 +1,13 @@
-- +goose Up
ALTER TABLE workflow_templates DROP CONSTRAINT IF EXISTS workflow_templates_uid_key;
ALTER TABLE workflow_templates DROP CONSTRAINT IF EXISTS workflow_templates_uid_namespace_key;
DROP INDEX IF EXISTS workflow_templates_name_namespace_key;
CREATE UNIQUE INDEX workflow_templates_name_namespace_key ON workflow_templates (name, namespace) WHERE is_archived = false;
CREATE UNIQUE INDEX workflow_templates_uid_namespace_key ON workflow_templates (uid, namespace) WHERE is_archived = false;
-- +goose Down
-- SQL in this section is executed when the migration is rolled back.
DROP INDEX workflow_templates_name_namespace_key;
DROP INDEX workflow_templates_uid_namespace_key;
ALTER TABLE workflow_templates ADD CONSTRAINT workflow_templates_uid_key UNIQUE (uid);
ALTER TABLE workflow_templates ADD CONSTRAINT workflow_templates_uid_namespace_key UNIQUE (uid, namespace);

View File

@@ -0,0 +1,15 @@
-- +goose Up
-- SQL in this section is executed when the migration is applied.
ALTER TABLE cron_workflows ADD COLUMN namespace varchar(30);
UPDATE cron_workflows cwfs
SET namespace = q.namespace
FROM (
SELECT wft.id, wft.namespace, wtv.id as wtv_id, wtv.workflow_template_id, cw.id
FROM workflow_templates wft
INNER JOIN workflow_template_versions wtv on wft.id = wtv.workflow_template_id
INNER JOIN cron_workflows cw on wtv.id = cw.workflow_template_version_id) q
WHERE cwfs.workflow_template_version_id = q.wtv_id;
ALTER TABLE cron_workflows ALTER COLUMN namespace SET NOT NULL;
-- +goose Down
-- SQL in this section is executed when the migration is rolled back.
ALTER TABLE cron_workflows DROP COLUMN namespace;

View File

@@ -0,0 +1,6 @@
-- +goose Up
-- SQL in this section is executed when the migration is applied.
CREATE UNIQUE INDEX cron_workflow_namespace_uid ON cron_workflows (uid, namespace);
-- +goose Down
-- SQL in this section is executed when the migration is rolled back.
DROP INDEX cron_workflow_namespace_uid;

View File

@@ -0,0 +1,8 @@
-- +goose Up
-- SQL in this section is executed when the migration is applied.
ALTER TABLE cron_workflows ADD COLUMN is_archived BOOL DEFAULT false NOT NULL;
ALTER TABLE workflow_executions ADD COLUMN is_archived BOOL DEFAULT false NOT NULL;
-- +goose Down
-- SQL in this section is executed when the migration is rolled back.
ALTER TABLE cron_workflows DROP COLUMN is_archived;
ALTER TABLE workflow_executions DROP COLUMN is_archived;

View File

@@ -0,0 +1,7 @@
-- +goose Up
ALTER TABLE workflow_executions ALTER COLUMN uid TYPE varchar(63);
ALTER TABLE workflow_executions ALTER COLUMN name TYPE varchar(63);
-- +goose Down
ALTER TABLE workflow_executions ALTER COLUMN uid TYPE varchar(30);
ALTER TABLE workflow_executions ALTER COLUMN name TYPE text;

View File

@@ -0,0 +1,7 @@
-- +goose Up
ALTER TABLE cron_workflows ALTER COLUMN uid TYPE varchar(63);
ALTER TABLE cron_workflows ALTER COLUMN name TYPE varchar(63);
-- +goose Down
ALTER TABLE cron_workflows ALTER COLUMN uid TYPE varchar(30);
ALTER TABLE cron_workflows ALTER COLUMN name TYPE varchar(30);

View File

@@ -0,0 +1,13 @@
-- +goose Up
ALTER TABLE workflow_templates ALTER COLUMN is_archived SET DEFAULT false;
ALTER TABLE workflow_templates ALTER COLUMN is_archived SET NOT NULL;
ALTER TABLE workspace_templates ALTER COLUMN is_archived SET DEFAULT false;
ALTER TABLE workspace_templates ALTER COLUMN is_archived SET NOT NULL;
-- +goose Down
ALTER TABLE workspace_templates ALTER COLUMN is_archived DROP NOT NULL;
ALTER TABLE workspace_templates ALTER COLUMN is_archived DROP DEFAULT;
ALTER TABLE workflow_templates ALTER COLUMN is_archived DROP NOT NULL;
ALTER TABLE workflow_templates ALTER COLUMN is_archived DROP DEFAULT;

View File

@@ -0,0 +1,124 @@
// Package migration is for carrying out migrations against the database.
// To support Onepanel Core operations.
package migration
import (
"database/sql"
v1 "github.com/onepanelio/core/pkg"
uid2 "github.com/onepanelio/core/pkg/util/uid"
"github.com/pressly/goose"
"log"
)
const jupyterWorkspaceTemplate = `# Docker containers that are part of the Workspace
containers:
- name: jupyterlab-tensorflow
image: jupyter/tensorflow-notebook
command: [start.sh, jupyter]
env:
- name: tornado
value: "{ 'headers': { 'Content-Security-Policy': \"frame-ancestors * 'self'\" } }"
args:
- lab
- --LabApp.token=''
- --LabApp.allow_remote_access=True
- --LabApp.allow_origin="*"
- --LabApp.disable_check_xsrf=True
- --LabApp.trust_xheaders=True
- --LabApp.tornado_settings=$(tornado)
- --notebook-dir='/data'
ports:
- containerPort: 8888
name: jupyterlab
# Volumes to be mounted in this container
# Onepanel will automatically create these volumes and mount them to the container
volumeMounts:
- name: data
mountPath: /data
# Ports that need to be exposed
ports:
- name: jupyterlab
port: 80
protocol: TCP
targetPort: 8888
# Routes that will map to ports
routes:
- match:
- uri:
prefix: /
route:
- destination:
port:
number: 80
# DAG Workflow to be executed once a Workspace action completes
# postExecutionWorkflow:
# entrypoint: main
# templates:
# - name: main
# dag:
# tasks:
# - name: slack-notify
# template: slack-notify
# - name: slack-notify
# container:
# image: technosophos/slack-notify
# args:
# - SLACK_USERNAME=onepanel SLACK_TITLE="Your workspace is ready" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE="Your workspace is now running" ./slack-notify
# command:
# - sh
# - -c
`
const jupyterLabTemplateName = "JupyterLab"
func init() {
goose.AddMigration(Up20200525160514, Down20200525160514)
}
func Up20200525160514(tx *sql.Tx) error {
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
workspaceTemplate := &v1.WorkspaceTemplate{
Name: jupyterLabTemplateName,
Manifest: jupyterWorkspaceTemplate,
}
for _, namespace := range namespaces {
if _, err := client.CreateWorkspaceTemplate(namespace.Name, workspaceTemplate); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}
func Down20200525160514(tx *sql.Tx) error {
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
uid, err := uid2.GenerateUID(jupyterLabTemplateName, 30)
if err != nil {
return err
}
for _, namespace := range namespaces {
if _, err := client.ArchiveWorkspaceTemplate(namespace.Name, uid); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}

View File

@@ -0,0 +1,176 @@
package migration
import (
"database/sql"
v1 "github.com/onepanelio/core/pkg"
uid2 "github.com/onepanelio/core/pkg/util/uid"
"github.com/pressly/goose"
"log"
)
const cvatWorkspaceTemplate = `# Docker containers that are part of the Workspace
containers:
- name: cvat-db
image: postgres:10-alpine
env:
- name: POSTGRES_USER
value: root
- name: POSTGRES_DB
value: cvat
- name: POSTGRES_HOST_AUTH_METHOD
value: trust
- name: PGDATA
value: /var/lib/psql/data
ports:
- containerPort: 5432
name: tcp
volumeMounts:
- name: db
mountPath: /var/lib/psql
- name: cvat-redis
image: redis:4.0-alpine
ports:
- containerPort: 6379
name: tcp
- name: cvat
image: onepanel/cvat:v0.7.0
env:
- name: DJANGO_MODWSGI_EXTRA_ARGS
value: ""
- name: ALLOWED_HOSTS
value: '*'
- name: CVAT_REDIS_HOST
value: localhost
- name: CVAT_POSTGRES_HOST
value: localhost
- name: CVAT_SHARE_URL
value: /home/django/data
ports:
- containerPort: 8080
name: http
volumeMounts:
- name: data
mountPath: /home/django/data
- name: keys
mountPath: /home/django/keys
- name: logs
mountPath: /home/django/logs
- name: models
mountPath: /home/django/models
- name: cvat-ui
image: onepanel/cvat-ui:v0.7.0
ports:
- containerPort: 80
name: http
ports:
- name: cvat-ui
port: 80
protocol: TCP
targetPort: 80
- name: cvat
port: 8080
protocol: TCP
targetPort: 8080
routes:
- match:
- uri:
regex: /api/.*|/git/.*|/tensorflow/.*|/auto_annotation/.*|/analytics/.*|/static/.*|/admin/.*|/documentation/.*|/dextr/.*|/reid/.*
- queryParams:
id:
regex: \d+.*
route:
- destination:
port:
number: 8080
- match:
- uri:
prefix: /
route:
- destination:
port:
number: 80
# DAG Workflow to be executed once a Workspace action completes
# postExecutionWorkflow:
# entrypoint: main
# templates:
# - name: main
# dag:
# tasks:
# - name: slack-notify
# template: slack-notify
# - name: slack-notify
# container:
# image: technosophos/slack-notify
# args:
# - SLACK_USERNAME=onepanel SLACK_TITLE="Your workspace is ready" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE="Your workspace is now running" ./slack-notify
# command:
# - sh
# - -c
`
const cvatTemplateName = "CVAT"
func init() {
goose.AddMigration(Up20200528140124, Down20200528140124)
}
// Up20200528140124 will insert the cvatTemplate to each user.
// Each user is determined by onepanel enabled namespaces.
// Any errors reported are logged as fatal.
func Up20200528140124(tx *sql.Tx) error {
// This code is executed when the migration is applied.
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
workspaceTemplate := &v1.WorkspaceTemplate{
Name: cvatTemplateName,
Manifest: cvatWorkspaceTemplate,
}
for _, namespace := range namespaces {
if _, err := client.CreateWorkspaceTemplate(namespace.Name, workspaceTemplate); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}
// Down20200528140124 will attempt to remove cvatTemplate from each user.
// Each user is determined by onepanel enabled namespaces.
// DB entries are archived, K8S components are deleted.
// Active workspaces with that template are terminated.
// Any errors reported are logged as fatal.
func Down20200528140124(tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
uid, err := uid2.GenerateUID(cvatTemplateName, 30)
if err != nil {
return err
}
for _, namespace := range namespaces {
if _, err := client.ArchiveWorkspaceTemplate(namespace.Name, uid); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}

View File

@@ -0,0 +1,151 @@
package migration
import (
"database/sql"
"log"
v1 "github.com/onepanelio/core/pkg"
uid2 "github.com/onepanelio/core/pkg/util/uid"
"github.com/pressly/goose"
)
const pytorchMnistWorkflowTemplate = `entrypoint: main
arguments:
parameters:
- name: source
value: https://github.com/onepanelio/pytorch-examples.git
- name: command
value: "python mnist/main.py --epochs=1"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
- metadata:
name: output
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
templates:
- name: main
dag:
tasks:
- name: train-model
template: pytorch
# Uncomment section below to send metrics to Slack
# - name: notify-in-slack
# dependencies: [train-model]
# template: slack-notify-success
# arguments:
# parameters:
# - name: status
# value: "{{tasks.train-model.status}}"
# artifacts:
# - name: metrics
# from: "{{tasks.train-model.outputs.artifacts.sys-metrics}}"
- name: pytorch
inputs:
artifacts:
- name: src
path: /mnt/src
git:
repo: "{{workflow.parameters.source}}"
outputs:
artifacts:
- name: model
path: /mnt/output
optional: true
archive:
none: {}
container:
image: pytorch/pytorch:latest
command: [sh,-c]
args: ["{{workflow.parameters.command}}"]
workingDir: /mnt/src
volumeMounts:
- name: data
mountPath: /mnt/data
- name: output
mountPath: /mnt/output
- name: slack-notify-success
container:
image: technosophos/slack-notify
command: [sh,-c]
args: ['SLACK_USERNAME=Worker SLACK_TITLE="{{workflow.name}} {{inputs.parameters.status}}" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE=$(cat /tmp/metrics.json)} ./slack-notify']
inputs:
parameters:
- name: status
artifacts:
- name: metrics
path: /tmp/metrics.json
optional: true
`
const pytorchMnistWorkflowTemplateName = "PyTorch Training"
func init() {
goose.AddMigration(Up20200605090509, Down20200605090509)
}
// Up20200605090509 will insert a Pytorch workflow template to each user.
// Each user is determined by onepanel enabled namespaces.
// Any errors reported are logged as fatal.
func Up20200605090509(tx *sql.Tx) error {
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
workflowTemplate := &v1.WorkflowTemplate{
Name: pytorchMnistWorkflowTemplateName,
Manifest: pytorchMnistWorkflowTemplate,
}
for _, namespace := range namespaces {
if _, err := client.CreateWorkflowTemplate(namespace.Name, workflowTemplate); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}
// Down20200605090509 will attempt to remove Pytorch workflow from each user.
// Each user is determined by onepanel enabled namespaces.
// DB entries are archived, K8S components are deleted.
// Active workflows with that template are terminated.
// Any errors reported are logged as fatal.
func Down20200605090509(tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
uid, err := uid2.GenerateUID(pytorchMnistWorkflowTemplateName, 30)
if err != nil {
return err
}
for _, namespace := range namespaces {
if _, err := client.ArchiveWorkflowTemplate(namespace.Name, uid); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}

View File

@@ -0,0 +1,150 @@
package migration
import (
"database/sql"
"log"
v1 "github.com/onepanelio/core/pkg"
uid2 "github.com/onepanelio/core/pkg/util/uid"
"github.com/pressly/goose"
)
const tensorflowWorkflowTemplate = `entrypoint: main
arguments:
parameters:
- name: source
value: https://github.com/onepanelio/tensorflow-examples.git
- name: command
value: "python mnist/main.py --epochs=5"
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
- metadata:
name: output
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 2Gi
templates:
- name: main
dag:
tasks:
- name: train-model
template: pytorch
# Uncomment section below to send metrics to Slack
# - name: notify-in-slack
# dependencies: [train-model]
# template: slack-notify-success
# arguments:
# parameters:
# - name: status
# value: "{{tasks.train-model.status}}"
# artifacts:
# - name: metrics
# from: "{{tasks.train-model.outputs.artifacts.sys-metrics}}"
- name: pytorch
inputs:
artifacts:
- name: src
path: /mnt/src
git:
repo: "{{workflow.parameters.source}}"
outputs:
artifacts:
- name: model
path: /mnt/output
optional: true
archive:
none: {}
container:
image: tensorflow/tensorflow:latest
command: [sh,-c]
args: ["{{workflow.parameters.command}}"]
workingDir: /mnt/src
volumeMounts:
- name: data
mountPath: /mnt/data
- name: output
mountPath: /mnt/output
- name: slack-notify-success
container:
image: technosophos/slack-notify
command: [sh,-c]
args: ['SLACK_USERNAME=Worker SLACK_TITLE="{{workflow.name}} {{inputs.parameters.status}}" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE=$(cat /tmp/metrics.json)} ./slack-notify']
inputs:
parameters:
- name: status
artifacts:
- name: metrics
path: /tmp/metrics.json
optional: true
`
const tensorflowWorkflowTemplateName = "TensorFlow Training"
func init() {
goose.AddMigration(Up20200605090535, Down20200605090535)
}
// Up20200605090535 will insert a tensorflow workflow template to each user.
// Each user is determined by onepanel enabled namespaces.
// Any errors reported are logged as fatal.
func Up20200605090535(tx *sql.Tx) error {
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
workflowTemplate := &v1.WorkflowTemplate{
Name: tensorflowWorkflowTemplateName,
Manifest: tensorflowWorkflowTemplate,
}
for _, namespace := range namespaces {
if _, err := client.CreateWorkflowTemplate(namespace.Name, workflowTemplate); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}
// Down20200605090535 will attempt to remove tensorflow workflow from each user.
// Each user is determined by onepanel enabled namespaces.
// DB entries are archived, K8S components are deleted.
// Active workflows with that template are terminated.
// Any errors reported are logged as fatal.
func Down20200605090535(tx *sql.Tx) error {
// This code is executed when the migration is rolled back.
client, err := getClient()
if err != nil {
return err
}
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
return err
}
uid, err := uid2.GenerateUID(tensorflowWorkflowTemplateName, 30)
if err != nil {
return err
}
for _, namespace := range namespaces {
if _, err := client.ArchiveWorkflowTemplate(namespace.Name, uid); err != nil {
log.Fatalf("error %v", err.Error())
}
}
return nil
}

25
db/db.go Normal file
View File

@@ -0,0 +1,25 @@
package migration
import (
"fmt"
"github.com/jmoiron/sqlx"
v1 "github.com/onepanelio/core/pkg"
)
func getClient() (*v1.Client, error) {
kubeConfig := v1.NewConfig()
client, err := v1.NewClient(kubeConfig, nil)
if err != nil {
return nil, err
}
config, err := client.GetSystemConfig()
if err != nil {
return nil, err
}
databaseDataSourceName := fmt.Sprintf("host=%v user=%v password=%v dbname=%v sslmode=disable",
config["databaseHost"], config["databaseUsername"], config["databasePassword"], config["databaseName"])
client.DB = sqlx.MustConnect(config["databaseDriverName"], databaseDataSourceName)
return client, nil
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"flag"
"fmt"
_ "github.com/onepanelio/core/db"
"net"
"net/http"

View File

@@ -1,14 +1,7 @@
package v1
import (
"encoding/base64"
"errors"
sq "github.com/Masterminds/squirrel"
"github.com/ghodss/yaml"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"regexp"
"strconv"
argoprojv1alpha1 "github.com/argoproj/argo/pkg/client/clientset/versioned/typed/workflow/v1alpha1"
"github.com/jmoiron/sqlx"
"github.com/onepanelio/core/pkg/util/s3"
@@ -18,15 +11,6 @@ import (
"k8s.io/client-go/tools/clientcmd"
)
const (
artifactRepositoryEndpointKey = "artifactRepositoryS3Endpoint"
artifactRepositoryBucketKey = "artifactRepositoryS3Bucket"
artifactRepositoryRegionKey = "artifactRepositoryS3Region"
artifactRepositoryInsecureKey = "artifactRepositoryS3Insecure"
artifactRepositoryAccessKeyValueKey = "artifactRepositoryS3AccessKey"
artifactRepositorySecretKeyValueKey = "artifactRepositoryS3SecretKey"
)
type Config = rest.Config
type DB = sqlx.DB
@@ -75,78 +59,13 @@ func NewClient(config *Config, db *sqlx.DB) (client *Client, err error) {
return &Client{Interface: kubeClient, argoprojV1alpha1: argoClient, DB: db}, nil
}
func (c *Client) GetSystemConfig() (config map[string]string, err error) {
namespace := "onepanel"
configMap, err := c.GetConfigMap(namespace, "onepanel")
if err != nil {
return
}
config = configMap.Data
secret, err := c.GetSecret(namespace, "onepanel")
if err != nil {
return
}
databaseUsername, _ := base64.StdEncoding.DecodeString(secret.Data["databaseUsername"])
config["databaseUsername"] = string(databaseUsername)
databasePassword, _ := base64.StdEncoding.DecodeString(secret.Data["databasePassword"])
config["databasePassword"] = string(databasePassword)
return
}
func (c *Client) GetNamespaceConfig(namespace string) (config map[string]string, err error) {
configMap, err := c.GetConfigMap(namespace, "onepanel")
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"Error": err.Error(),
}).Error("getNamespaceConfig failed getting config map.")
return
}
config = configMap.Data
s3Conf := ArtifactRepositoryS3Config{}
err = yaml.Unmarshal([]byte(configMap.Data["artifactRepository"]), &s3Conf)
config[artifactRepositoryEndpointKey] = s3Conf.S3.Endpoint
config[artifactRepositoryBucketKey] = s3Conf.S3.Bucket
config[artifactRepositoryRegionKey] = s3Conf.S3.Region
config[artifactRepositoryInsecureKey] = s3Conf.S3.Insecure
config[artifactRepositoryAccessKeyValueKey] = s3Conf.S3.AccessKeySecret.Key
config[artifactRepositorySecretKeyValueKey] = s3Conf.S3.SecretKeySecret.Key
secret, err := c.GetSecret(namespace, "onepanel")
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"Error": err.Error(),
}).Error("getNamespaceConfig failed getting secret.")
return
}
accessKey, _ := base64.StdEncoding.DecodeString(secret.Data[artifactRepositoryAccessKeyValueKey])
config[artifactRepositoryAccessKeyValueKey] = string(accessKey)
secretKey, _ := base64.StdEncoding.DecodeString(secret.Data[artifactRepositorySecretKeyValueKey])
config[artifactRepositorySecretKeyValueKey] = string(secretKey)
return
}
func (c *Client) GetS3Client(namespace string, config map[string]string) (s3Client *s3.Client, err error) {
insecure, err := strconv.ParseBool(config[artifactRepositoryInsecureKey])
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"ConfigMap": config,
"Error": err.Error(),
}).Error("getS3Client failed when parsing bool.")
return
}
func (c *Client) GetS3Client(namespace string, config *ArtifactRepositoryS3Config) (s3Client *s3.Client, err error) {
s3Client, err = s3.NewClient(s3.Config{
Endpoint: config[artifactRepositoryEndpointKey],
Region: config[artifactRepositoryRegionKey],
AccessKey: config[artifactRepositoryAccessKeyValueKey],
SecretKey: config[artifactRepositorySecretKeyValueKey],
InSecure: insecure,
Endpoint: config.Endpoint,
Region: config.Region,
AccessKey: config.AccessKey,
SecretKey: config.Secretkey,
InSecure: config.Insecure,
})
if err != nil {
log.WithFields(log.Fields{
@@ -159,27 +78,3 @@ func (c *Client) GetS3Client(namespace string, config map[string]string) (s3Clie
return
}
func GetBearerToken(namespace string) (string, error) {
kubeConfig := NewConfig()
client, err := NewClient(kubeConfig, nil)
if err != nil {
log.Fatalf("Failed to connect to Kubernetes cluster: %v", err)
}
secrets, err := client.CoreV1().Secrets(namespace).List(v1.ListOptions{})
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"Error": err.Error(),
}).Error("Failed to get default service account token.")
return "", err
}
re := regexp.MustCompile(`^default-token-`)
for _, secret := range secrets.Items {
if re.Find([]byte(secret.ObjectMeta.Name)) != nil {
return string(secret.Data["token"]), nil
}
}
return "", errors.New("could not find a token")
}

View File

@@ -1,5 +1,10 @@
package v1
import (
"github.com/onepanelio/core/pkg/util/ptr"
"gopkg.in/yaml.v2"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -11,28 +16,65 @@ type ParameterOption struct {
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" protobuf:"bytes,3,opt,name=type"`
DisplayName *string `json:"displayName" protobuf:"bytes,4,opt,name=displayName"`
Hint *string `json:"hint" protobuf:"bytes,5,opt,name=hint"`
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(paramMap map[interface{}]interface{}) *Parameter {
displayName := paramMap["displayname"].(string)
hint := paramMap["hint"].(string)
required := paramMap["required"].(bool)
typeValue := paramMap["type"].(string)
name := paramMap["name"].(string)
value := paramMap["value"].(string)
workflowParameter := Parameter{
Options: []*ParameterOption{},
}
// TODO choose a consistent way and use that.
if value, ok := paramMap["displayname"]; ok {
if displayName, ok := value.(string); ok {
workflowParameter.DisplayName = &displayName
}
} else if value, ok := paramMap["displayName"]; ok {
if displayName, ok := value.(string); ok {
workflowParameter.DisplayName = &displayName
}
}
if value, ok := paramMap["hint"]; ok {
if hint, ok := value.(string); ok {
workflowParameter.Hint = ptr.String(hint)
}
}
if value, ok := paramMap["required"]; ok {
if required, ok := value.(bool); ok {
workflowParameter.Required = required
}
}
if value, ok := paramMap["type"]; ok {
if typeValue, ok := value.(string); ok {
workflowParameter.Type = typeValue
}
}
if value, ok := paramMap["name"]; ok {
if nameValue, ok := value.(string); ok {
workflowParameter.Name = nameValue
}
}
if value, ok := paramMap["value"]; ok {
if valueValue, ok := value.(string); ok {
workflowParameter.Value = &valueValue
}
}
options := paramMap["options"]
optionsArray, ok := options.([]interface{})
if !ok {
return nil
return &workflowParameter
}
newOptions := make([]ParameterOption, 0)
for _, option := range optionsArray {
optionMap := option.(map[interface{}]interface{})
@@ -41,25 +83,7 @@ func ParameterFromMap(paramMap map[interface{}]interface{}) *Parameter {
Value: optionMap["value"].(string),
}
newOptions = append(newOptions, newOption)
}
workflowParameter := Parameter{
Name: name,
Required: required,
}
if displayName != "" {
workflowParameter.DisplayName = &displayName
}
if hint != "" {
workflowParameter.Hint = &hint
}
if value != "" {
workflowParameter.Value = &value
}
if typeValue != "" {
workflowParameter.Type = typeValue
workflowParameter.Options = append(workflowParameter.Options, &newOption)
}
return &workflowParameter
@@ -68,3 +92,38 @@ func ParameterFromMap(paramMap map[interface{}]interface{}) *Parameter {
type Arguments struct {
Parameters []Parameter `json:"parameters" protobuf:"bytes,1,opt,name=parameters"`
}
func ParseParametersFromManifest(manifest []byte) ([]Parameter, error) {
var parameters []Parameter
mappedData := make(map[string]interface{})
if err := yaml.Unmarshal(manifest, mappedData); err != nil {
return nil, err
}
arguments, ok := mappedData["arguments"]
if !ok {
return parameters, nil
}
argumentsMap := arguments.(map[interface{}]interface{})
parametersRaw, ok := argumentsMap["parameters"]
if !ok {
return parameters, nil
}
parametersArray, ok := parametersRaw.([]interface{})
for _, parameter := range parametersArray {
paramMap, ok := parameter.(map[interface{}]interface{})
if !ok {
continue
}
workflowParameter := ParameterFromMap(paramMap)
parameters = append(parameters, *workflowParameter)
}
return parameters, nil
}

82
pkg/config.go Normal file
View File

@@ -0,0 +1,82 @@
package v1
import (
"encoding/base64"
"github.com/onepanelio/core/pkg/util"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)
func (c *Client) getConfigMap(namespace, name string) (configMap *ConfigMap, err error) {
cm, err := c.CoreV1().ConfigMaps(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return
}
configMap = &ConfigMap{
Name: name,
Data: cm.Data,
}
return
}
func (c *Client) GetSystemConfig() (config map[string]string, err error) {
namespace := "onepanel"
configMap, err := c.getConfigMap(namespace, "onepanel")
if err != nil {
return
}
config = configMap.Data
secret, err := c.GetSecret(namespace, "onepanel")
if err != nil {
return
}
databaseUsername, _ := base64.StdEncoding.DecodeString(secret.Data["databaseUsername"])
config["databaseUsername"] = string(databaseUsername)
databasePassword, _ := base64.StdEncoding.DecodeString(secret.Data["databasePassword"])
config["databasePassword"] = string(databasePassword)
return
}
func (c *Client) GetNamespaceConfig(namespace string) (config *NamespaceConfig, err error) {
configMap, err := c.getConfigMap(namespace, "onepanel")
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"Error": err.Error(),
}).Error("getNamespaceConfig failed getting config map.")
return
}
config = &NamespaceConfig{
ArtifactRepository: ArtifactRepositoryConfig{},
}
err = yaml.Unmarshal([]byte(configMap.Data["artifactRepository"]), &config.ArtifactRepository)
if err != nil || config.ArtifactRepository.S3 == nil {
return nil, util.NewUserError(codes.NotFound, "Artifact repository config not found.")
}
secret, err := c.GetSecret(namespace, "onepanel")
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"Error": err.Error(),
}).Error("getNamespaceConfig failed getting secret.")
return
}
// TODO: replace with switch statement to support additional object storage
if config.ArtifactRepository.S3 == nil {
return nil, util.NewUserError(codes.NotFound, "Artifact repository config not found.")
}
accessKey, _ := base64.StdEncoding.DecodeString(secret.Data[config.ArtifactRepository.S3.AccessKeySecret.Key])
config.ArtifactRepository.S3.AccessKey = string(accessKey)
secretKey, _ := base64.StdEncoding.DecodeString(secret.Data[config.ArtifactRepository.S3.SecretKeySecret.Key])
config.ArtifactRepository.S3.Secretkey = string(secretKey)
return
}

View File

@@ -1,33 +0,0 @@
package v1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (c *Client) CreateConfigMap(namespace string, configMap *ConfigMap) (err error) {
_, err = c.CoreV1().ConfigMaps(namespace).Create(&corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: configMap.Name,
},
Data: configMap.Data,
})
if err != nil {
return
}
return
}
func (c *Client) GetConfigMap(namespace, name string) (configMap *ConfigMap, err error) {
cm, err := c.CoreV1().ConfigMaps(namespace).Get(name, metav1.GetOptions{})
if err != nil {
return
}
configMap = &ConfigMap{
Name: name,
Data: cm.Data,
}
return
}

View File

@@ -1,31 +0,0 @@
package v1
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCreateConfigMap(t *testing.T) {
c := NewTestClient()
err := c.CreateConfigMap("namespace", &ConfigMap{
Name: "name",
})
assert.Nil(t, err)
}
func TestGetConfigMap(t *testing.T) {
c := NewTestClient()
err := c.CreateConfigMap("namespace", &ConfigMap{
Name: "name",
})
assert.Nil(t, err)
s, err := c.GetConfigMap("namespace", "name")
assert.Nil(t, err)
assert.NotNil(t, s)
assert.Equal(t, s.Name, "name")
}

40
pkg/config_types.go Normal file
View File

@@ -0,0 +1,40 @@
package v1
import (
corev1 "k8s.io/api/core/v1"
"strings"
)
type ArtifactRepositoryS3Config struct {
KeyFormat string
Bucket string
Endpoint string
Insecure bool
Region string
AccessKeySecret corev1.SecretKeySelector
SecretKeySecret corev1.SecretKeySelector
AccessKey string
Secretkey string
}
// FormatKey replaces placeholder values with their actual values and returns this string.
// {{workflow.namespace}} -> namespace
// {{workflow.name}} -> workflowName
// {{pod.name}} -> podName
func (a *ArtifactRepositoryS3Config) FormatKey(namespace, workflowName, podName string) string {
keyFormat := a.KeyFormat
keyFormat = strings.Replace(keyFormat, "{{workflow.namespace}}", namespace, -1)
keyFormat = strings.Replace(keyFormat, "{{workflow.name}}", workflowName, -1)
keyFormat = strings.Replace(keyFormat, "{{pod.name}}", podName, -1)
return keyFormat
}
type ArtifactRepositoryConfig struct {
S3 *ArtifactRepositoryS3Config
}
type NamespaceConfig struct {
ArtifactRepository ArtifactRepositoryConfig
}

View File

@@ -8,14 +8,14 @@ import (
"github.com/onepanelio/core/pkg/util"
"github.com/onepanelio/core/pkg/util/label"
"github.com/onepanelio/core/pkg/util/pagination"
uid2 "github.com/onepanelio/core/pkg/util/uid"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"regexp"
"strings"
)
func (c *Client) UpdateCronWorkflow(namespace string, name string, cronWorkflow *CronWorkflow) (*CronWorkflow, error) {
func (c *Client) UpdateCronWorkflow(namespace string, uid string, cronWorkflow *CronWorkflow) (*CronWorkflow, error) {
err := c.cronWorkflowSelectBuilderNoColumns(namespace, cronWorkflow.WorkflowExecution.WorkflowTemplate.UID).
Columns("cw.id").
RunWith(c.DB).
@@ -38,8 +38,11 @@ func (c *Client) UpdateCronWorkflow(namespace string, name string, cronWorkflow
// TODO: Need to pull system parameters from k8s config/secret here, example: HOST
opts := &WorkflowExecutionOptions{}
re, _ := regexp.Compile(`[^a-zA-Z0-9-]{1,}`)
opts.GenerateName = strings.ToLower(re.ReplaceAllString(workflowTemplate.Name, `-`)) + "-"
opts.GenerateName, err = uid2.GenerateUID(workflowTemplate.Name, 63)
if err != nil {
return nil, err
}
opts.GenerateName += "-"
for _, param := range workflow.Parameters {
opts.Parameters = append(opts.Parameters, Parameter{
Name: param.Name,
@@ -89,7 +92,7 @@ func (c *Client) UpdateCronWorkflow(namespace string, name string, cronWorkflow
wf := workflows[0]
argoCronWorkflow.Spec.WorkflowSpec = wf.Spec
_, err = c.updateCronWorkflow(namespace, name, &workflowTemplate.ID, &wf, &argoCronWorkflow, opts)
_, err = c.updateCronWorkflow(namespace, uid, &workflowTemplate.ID, &wf, &argoCronWorkflow, opts)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
@@ -161,8 +164,11 @@ func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow
//// TODO: Need to pull system parameters from k8s config/secret here, example: HOST
opts := &WorkflowExecutionOptions{}
re, _ := regexp.Compile(`[^a-zA-Z0-9-]{1,}`)
opts.GenerateName = strings.ToLower(re.ReplaceAllString(workflowTemplate.Name, `-`)) + "-"
opts.GenerateName, err = uid2.GenerateUID(workflowTemplate.Name, 63)
if err != nil {
return nil, err
}
opts.GenerateName += "-"
for _, param := range workflow.Parameters {
opts.Parameters = append(opts.Parameters, Parameter{
Name: param.Name,
@@ -228,7 +234,11 @@ func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow
cronWorkflow.Name = argoCreatedCronWorkflow.Name
cronWorkflow.CreatedAt = argoCreatedCronWorkflow.CreationTimestamp.UTC()
cronWorkflow.UID = string(argoCreatedCronWorkflow.ObjectMeta.UID)
cronWorkflow.UID, err = uid2.GenerateUID(argoCreatedCronWorkflow.Name, 63)
if err != nil {
return nil, err
}
cronWorkflow.WorkflowExecution.WorkflowTemplate = workflowTemplate
// Manifests could get big, don't return them in this case.
cronWorkflow.WorkflowExecution.WorkflowTemplate.Manifest = ""
@@ -245,6 +255,8 @@ func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow
"name": cronWorkflow.Name,
"workflow_template_version_id": workflowTemplate.WorkflowTemplateVersionId,
"manifest": cronWorkflow.Manifest,
"namespace": namespace,
"is_archived": false,
}).
Suffix("RETURNING id").
RunWith(tx).
@@ -270,10 +282,10 @@ func (c *Client) CreateCronWorkflow(namespace string, cronWorkflow *CronWorkflow
return cronWorkflow, nil
}
func (c *Client) GetCronWorkflow(namespace, name string) (cronWorkflow *CronWorkflow, err error) {
func (c *Client) GetCronWorkflow(namespace, uid string) (cronWorkflow *CronWorkflow, err error) {
cronWorkflow = &CronWorkflow{}
err = c.cronWorkflowSelectBuilderNamespaceName(namespace, name).
err = c.cronWorkflowSelectBuilderNoColumns(namespace, uid).
RunWith(c.DB).
QueryRow().
Scan(cronWorkflow)
@@ -429,11 +441,11 @@ func (c *Client) buildCronWorkflowDefinition(namespace string, workflowTemplateI
cwf.ObjectMeta.Labels = *opts.Labels
}
err = injectExitHandlerWorkflowExecutionStatistic(wf, namespace, workflowTemplateId)
err = injectExitHandlerWorkflowExecutionStatistic(wf, workflowTemplateId)
if err != nil {
return nil, err
}
err = injectInitHandlerWorkflowExecutionStatistic(wf, namespace, workflowTemplateId)
err = injectInitHandlerWorkflowExecutionStatistic(wf, workflowTemplateId)
if err != nil {
return nil, err
}
@@ -457,13 +469,13 @@ func (c *Client) buildCronWorkflowDefinition(namespace string, workflowTemplateI
return cwf, nil
}
func (c *Client) updateCronWorkflow(namespace string, name string, workflowTemplateId *uint64, wf *wfv1.Workflow, cwf *wfv1.CronWorkflow, opts *WorkflowExecutionOptions) (updatedCronWorkflow *wfv1.CronWorkflow, err error) {
func (c *Client) updateCronWorkflow(namespace string, uid string, workflowTemplateId *uint64, wf *wfv1.Workflow, cwf *wfv1.CronWorkflow, opts *WorkflowExecutionOptions) (updatedCronWorkflow *wfv1.CronWorkflow, err error) {
//Make sure the CronWorkflow exists before we edit it
toUpdateCWF, err := c.ArgoprojV1alpha1().CronWorkflows(namespace).Get(name, metav1.GetOptions{})
toUpdateCWF, err := c.ArgoprojV1alpha1().CronWorkflows(namespace).Get(uid, metav1.GetOptions{})
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"Name": name,
"UID": uid,
"Error": err.Error(),
}).Error("CronWorkflow not found.")
return nil, util.NewUserError(codes.NotFound, "CronWorkflow not found.")
@@ -474,7 +486,7 @@ func (c *Client) updateCronWorkflow(namespace string, name string, workflowTempl
return
}
cwf.Name = name
cwf.Name = uid
cwf.ResourceVersion = toUpdateCWF.ResourceVersion
updatedCronWorkflow, err = c.ArgoprojV1alpha1().CronWorkflows(namespace).Update(cwf)
if err != nil {
@@ -498,77 +510,77 @@ func (c *Client) createCronWorkflow(namespace string, workflowTemplateId *uint64
return
}
func (c *Client) TerminateCronWorkflow(namespace, name string) (err error) {
query, args, err := sb.Select(cronWorkflowColumns("wtv.version")...).
From("cron_workflows cw").
Join("workflow_template_versions wtv ON wtv.id = cw.workflow_template_version_id").
Join("workflow_templates wt ON wt.id = wtv.workflow_template_id").
func (c *Client) TerminateCronWorkflow(namespace, uid string) (err error) {
err = c.ArgoprojV1alpha1().CronWorkflows(namespace).Delete(uid, nil)
if err != nil {
if !strings.Contains(err.Error(), "not found") {
return err
}
}
cronWorkflow, err := c.selectCronWorkflowWithWorkflowTemplateVersion(namespace, uid)
if err != nil {
return err
}
//workflow executions
var workflows []*WorkflowExecution
query, args, err := sb.Select().
Columns(getWorkflowExecutionColumns("we", "")...).
From("workflow_executions we").
Where(sq.Eq{
"wt.namespace": namespace,
"cw.name": name,
}).
ToSql()
cronWorkflow := &CronWorkflow{}
if err := c.DB.Get(cronWorkflow, query, args...); err != nil {
"cron_workflow_id": cronWorkflow.ID,
}).ToSql()
if err != nil {
return err
}
if err := c.DB.Select(&workflows, query, args...); err != nil {
return err
}
query = `DELETE FROM workflow_executions
WHERE cron_workflow_id = $1`
if _, err := c.DB.Exec(query, cronWorkflow.ID); err != nil {
return err
for _, wf := range workflows {
err = c.ArchiveWorkflowExecution(namespace, wf.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Archive Workflow Execution Failed.")
return err
}
}
query = `DELETE FROM cron_workflows
USING workflow_template_versions, workflow_templates
WHERE cron_workflows.workflow_template_version_id = workflow_template_versions.id
AND workflow_template_versions.workflow_template_id = workflow_templates.id
AND workflow_templates.namespace = $1
AND cron_workflows.name = $2`
if _, err := c.DB.Exec(query, namespace, name); err != nil {
return err
}
err = c.ArgoprojV1alpha1().CronWorkflows(namespace).Delete(name, nil)
if err != nil && strings.Contains(err.Error(), "not found") {
err = nil
}
_, err = sb.Update("cron_workflows").
Set("is_archived", true).
Where(sq.Eq{
"uid": uid,
"namespace": namespace,
}).RunWith(c.DB).Exec()
return
}
func unmarshalCronWorkflows(cwfBytes []byte, strict bool) (cwfs wfv1.CronWorkflow, err error) {
var cwf wfv1.CronWorkflow
var jsonOpts []argojson.JSONOpt
if strict {
jsonOpts = append(jsonOpts, argojson.DisallowUnknownFields)
}
err = argojson.Unmarshal(cwfBytes, &cwf, jsonOpts...)
if err == nil {
return cwf, nil
func (c *Client) ArchiveCronWorkflow(namespace, uid string) (err error) {
err = c.ArgoprojV1alpha1().CronWorkflows(namespace).Delete(uid, nil)
if err != nil {
if strings.Contains(err.Error(), "not found") {
return nil
}
return err
}
_, err = sb.Update("cron_workflows").
Set("is_archived", true).
Where(sq.Eq{
"uid": uid,
"namespace": namespace,
}).RunWith(c.DB).Exec()
return
}
func (c *Client) cronWorkflowSelectBuilder(namespace string, workflowTemplateUid string) sq.SelectBuilder {
sb := c.cronWorkflowSelectBuilderNoColumns(namespace, workflowTemplateUid).
Columns(cronWorkflowColumns("wtv.version")...)
return sb
}
func (c *Client) cronWorkflowSelectBuilderNamespaceName(namespace string, name string) sq.SelectBuilder {
sb := sb.Select("cw.id", "cw.created_at", "cw.uid", "cw.name", "cw.workflow_template_version_id").
Columns("cw.manifest", "wtv.version").
From("cron_workflows cw").
Join("workflow_template_versions wtv ON wtv.id = cw.workflow_template_version_id").
Join("workflow_templates wt ON wt.id = wtv.workflow_template_id").
Where(sq.Eq{
"wt.namespace": namespace,
"cw.name": name,
})
Columns(getCronWorkflowColumns("wtv.version")...)
return sb
}
@@ -579,8 +591,9 @@ func (c *Client) cronWorkflowSelectBuilderNoColumns(namespace string, workflowTe
Join("workflow_template_versions wtv ON wtv.id = cw.workflow_template_version_id").
Join("workflow_templates wt ON wt.id = wtv.workflow_template_id").
Where(sq.Eq{
"wt.namespace": namespace,
"wt.uid": workflowTemplateUid,
"wt.namespace": namespace,
"wt.uid": workflowTemplateUid,
"cw.is_archived": false,
})
return sb
@@ -649,12 +662,26 @@ func (c *Client) GetCronWorkflowStatisticsForTemplates(workflowTemplates ...*Wor
return
}
func cronWorkflowColumns(extraColumns ...string) []string {
results := []string{"cw.id", "cw.created_at", "cw.uid", "cw.name", "cw.workflow_template_version_id", "cw.manifest"}
func (c *Client) selectCronWorkflowWithWorkflowTemplateVersion(namespace, uid string, extraColumns ...string) (*CronWorkflow, error) {
query, args, err := sb.Select(getCronWorkflowColumns(extraColumns...)...).
From("cron_workflows cw").
Join("workflow_template_versions wtv ON wtv.id = cw.workflow_template_version_id").
Join("workflow_templates wt ON wt.id = wtv.workflow_template_id").
Where(sq.Eq{
"wt.namespace": namespace,
"cw.name": uid,
"cw.is_archived": false,
}).
ToSql()
for _, str := range extraColumns {
results = append(results, str)
if err != nil {
return nil, err
}
return results
cronWorkflow := &CronWorkflow{}
if err = c.DB.Get(cronWorkflow, query, args...); err != nil {
return nil, err
}
return cronWorkflow, nil
}

View File

@@ -1,14 +1,13 @@
package v1
import (
"database/sql"
"fmt"
sq "github.com/Masterminds/squirrel"
"github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/hashicorp/go-uuid"
"github.com/onepanelio/core/pkg/util/label"
"github.com/onepanelio/core/pkg/util/mapping"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"log"
)
func (c *Client) ListLabels(resource string, uid string) (labels []*Label, err error) {
@@ -32,6 +31,14 @@ func (c *Client) ListLabels(resource string, uid string) (labels []*Label, err e
case TypeCronWorkflow:
sb = sb.Join("cron_workflows cw ON cw.id = l.resource_id").
Where(sq.Eq{"cw.uid": uid})
case TypeWorkspace:
sb = sb.Join("workspaces ws ON ws.id = l.resource_id").
Where(sq.And{
sq.Eq{"ws.uid": uid},
sq.NotEq{"ws.phase": "Terminated"},
})
default:
return nil, fmt.Errorf("unsupported label resource %v", resource)
}
query, args, sqlErr := sb.ToSql()
@@ -45,21 +52,6 @@ func (c *Client) ListLabels(resource string, uid string) (labels []*Label, err e
return
}
func GetResourceIdBuilder(resource, uid string) (*sq.SelectBuilder, error) {
tableName := TypeToTableName(resource)
if tableName == "" {
return nil, fmt.Errorf("unknown resources '%v'", resource)
}
sb := sb.Select("id").
From(tableName).
Where(sq.Eq{
"uid": uid,
})
return &sb, nil
}
func (c *Client) AddLabels(namespace, resource, uid string, keyValues map[string]string) error {
tx, err := c.DB.Begin()
if err != nil {
@@ -135,23 +127,45 @@ func (c *Client) ReplaceLabels(namespace, resource, uid string, keyValues map[st
return fmt.Errorf("unknown resources '%v'", resource)
}
resourceId := uint64(0)
var whereCondition interface{} = nil
if resource == TypeWorkspace {
whereCondition = sq.And{
sq.Eq{"uid": uid},
sq.NotEq{"phase": "Terminated"},
}
} else if resource == TypeWorkspaceTemplate || resource == TypeWorkflowExecution {
whereCondition =
sq.Eq{
"uid": uid,
"is_archived": false,
}
}
resourceID := uint64(0)
err = sb.Select("id").
From(tableName).
Where(sq.Eq{
"uid": uid,
}).
Where(whereCondition).
RunWith(tx).
QueryRow().
Scan(&resourceId)
Scan(&resourceID)
if err != nil {
return err
}
return c.ReplaceLabelsUsingKnownID(namespace, resource, resourceID, uid, keyValues)
}
func (c *Client) ReplaceLabelsUsingKnownID(namespace, resource string, resourceID uint64, uid string, keyValues map[string]string) error {
tx, err := c.DB.Begin()
if err != nil {
return err
}
defer tx.Rollback()
_, err = sb.Delete("labels").
Where(sq.Eq{
"resource": resource,
"resource_id": resourceId,
"resource_id": resourceID,
}).RunWith(tx).
Exec()
if err != nil {
@@ -159,7 +173,7 @@ func (c *Client) ReplaceLabels(namespace, resource, uid string, keyValues map[st
}
if len(keyValues) > 0 {
_, err = c.InsertLabelsBuilder(resource, resourceId, keyValues).
_, err = c.InsertLabelsBuilder(resource, resourceID, keyValues).
RunWith(tx).
Exec()
if err != nil {
@@ -175,12 +189,14 @@ func (c *Client) ReplaceLabels(namespace, resource, uid string, keyValues map[st
return err
}
if meta.Labels == nil {
meta.Labels = make(map[string]string)
}
label.MergeLabelsPrefix(meta.Labels, keyValues, label.TagPrefix)
if err := c.UpdateK8sLabelResource(namespace, resource, source); err != nil {
return err
if meta != nil {
if meta.Labels == nil {
meta.Labels = make(map[string]string)
}
label.MergeLabelsPrefix(meta.Labels, keyValues, label.TagPrefix)
if err := c.UpdateK8sLabelResource(namespace, resource, source); err != nil {
return err
}
}
return nil
@@ -248,21 +264,28 @@ func (c *Client) DeleteLabels(namespace, resource, uid string, keyValues map[str
return nil
}
func (c *Client) InsertLabelsBuilder(resource string, resourceId uint64, keyValues map[string]string) sq.InsertBuilder {
func (c *Client) InsertLabelsBuilder(resource string, resourceID uint64, keyValues map[string]string) sq.InsertBuilder {
sb := sb.Insert("labels").
Columns("uid", "resource", "resource_id", "key", "value")
Columns("resource", "resource_id", "key", "value")
for key, value := range keyValues {
uid, err := uuid.GenerateUUID()
if err != nil {
log.Fatal("unable to generate uuid")
}
sb = sb.Values(uid, resource, resourceId, key, value)
sb = sb.Values(resource, resourceID, key, value)
}
return sb
}
// Inserts the labels for the resource. If no labels are provided, does nothing and returns nil, nil.
func (c *Client) InsertLabels(resource string, resourceID uint64, keyValues map[string]string) (sql.Result, error) {
if len(keyValues) == 0 {
return nil, nil
}
return c.InsertLabelsBuilder(resource, resourceID, keyValues).
RunWith(c.DB).
Exec()
}
func (c *Client) GetDbLabels(resource string, ids ...uint64) (labels []*Label, err error) {
if len(ids) == 0 {
return make([]*Label, 0), nil
@@ -296,6 +319,9 @@ func (c *Client) GetDbLabels(resource string, ids ...uint64) (labels []*Label, e
return
}
// TODO rename Db to be DB per go conventions
// Returns a map where the key is the id of the resource
// and the value is the labels as a map[string]string
func (c *Client) GetDbLabelsMapped(resource string, ids ...uint64) (result map[uint64]map[string]string, err error) {
dbLabels, err := c.GetDbLabels(resource, ids...)
if err != nil {
@@ -322,6 +348,8 @@ func (c *Client) GetK8sLabelResource(namespace, resource, uid string) (source in
return c.getK8sLabelResourceWorkflowExecution(namespace, uid)
case TypeCronWorkflow:
return c.getK8sLabelResourceCronWorkflow(namespace, uid)
case TypeWorkspaceTemplateVersion:
return c.getK8sLabelResourceWorkspaceTemplate(namespace, uid)
}
return nil, nil, nil
@@ -347,22 +375,12 @@ func (c *Client) getK8sLabelResourceWorkflowTemplateVersion(namespace, uid strin
}
func (c *Client) getK8sLabelResourceWorkflowExecution(namespace, uid string) (source interface{}, result *v1.ObjectMeta, err error) {
labelSelect := fmt.Sprintf("%v=%v", label.WorkflowUid, uid)
workflows, err := c.ArgoprojV1alpha1().Workflows(namespace).List(v1.ListOptions{
LabelSelector: labelSelect,
})
workflow, err := c.ArgoprojV1alpha1().Workflows(namespace).Get(uid, v1.GetOptions{})
if err != nil {
return nil, nil, err
}
if workflows.Items.Len() != 1 {
return nil, nil, fmt.Errorf("no argo resource found")
}
item := workflows.Items[0]
return item, &item.ObjectMeta, nil
return workflow, &workflow.ObjectMeta, nil
}
func (c *Client) getK8sLabelResourceCronWorkflow(namespace, uid string) (source interface{}, result *v1.ObjectMeta, err error) {
@@ -384,6 +402,25 @@ func (c *Client) getK8sLabelResourceCronWorkflow(namespace, uid string) (source
return item, &item.ObjectMeta, nil
}
func (c *Client) getK8sLabelResourceWorkspaceTemplate(namespace, uid string) (source interface{}, result *v1.ObjectMeta, err error) {
labelSelect := fmt.Sprintf("%v=%v", label.WorkspaceTemplateVersionUid, uid)
workflowTemplates, err := c.ArgoprojV1alpha1().WorkflowTemplates(namespace).List(v1.ListOptions{
LabelSelector: labelSelect,
})
if err != nil {
return nil, nil, err
}
if workflowTemplates.Items.Len() != 1 {
return nil, nil, fmt.Errorf("no argo resource found")
}
item := workflowTemplates.Items[0]
return item, &item.ObjectMeta, nil
}
func (c *Client) UpdateK8sLabelResource(namespace, resource string, obj interface{}) error {
if resource == TypeWorkflowTemplateVersion {
workflowTemplate, ok := obj.(v1alpha1.WorkflowTemplate)
@@ -395,12 +432,12 @@ func (c *Client) UpdateK8sLabelResource(namespace, resource string, obj interfac
return err
}
} else if resource == TypeWorkflowExecution {
workflowExecution, ok := obj.(v1alpha1.Workflow)
workflowExecution, ok := obj.(*v1alpha1.Workflow)
if !ok {
return fmt.Errorf("unable to convert object to workflow")
}
if _, err := c.ArgoprojV1alpha1().Workflows(namespace).Update(&workflowExecution); err != nil {
if _, err := c.ArgoprojV1alpha1().Workflows(namespace).Update(workflowExecution); err != nil {
return err
}
} else if resource == TypeCronWorkflow {
@@ -412,6 +449,15 @@ func (c *Client) UpdateK8sLabelResource(namespace, resource string, obj interfac
if _, err := c.ArgoprojV1alpha1().CronWorkflows(namespace).Update(&cronWorkflow); err != nil {
return err
}
} else if resource == TypeWorkspaceTemplateVersion {
workflowTemplate, ok := obj.(v1alpha1.WorkflowTemplate)
if !ok {
return fmt.Errorf("unable to convert object to WorkflowTemplate")
}
if _, err := c.ArgoprojV1alpha1().WorkflowTemplates(namespace).Update(&workflowTemplate); err != nil {
return err
}
}
return nil

View File

@@ -10,15 +10,17 @@ import (
"time"
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/google/uuid"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
TypeWorkflowTemplate string = "workflow_template"
TypeWorkflowTemplateVersion string = "workflow_template_version"
TypeWorkflowExecution string = "workflow_execution"
TypeCronWorkflow string = "cron_workflow"
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"
)
func TypeToTableName(value string) string {
@@ -31,6 +33,12 @@ func TypeToTableName(value string) string {
return "workflow_executions"
case TypeCronWorkflow:
return "cron_workflows"
case TypeWorkspaceTemplate:
return "workspace_templates"
case TypeWorkspaceTemplateVersion:
return "workspace_template_versions"
case TypeWorkspace:
return "workspaces"
}
return ""
@@ -74,6 +82,7 @@ type CronWorkflow struct {
Version int64
WorkflowTemplateVersionId uint64 `db:"workflow_template_version_id"`
Manifest string
Namespace string `db:"namespace"`
}
func (cw *CronWorkflow) GetParametersFromWorkflowSpec() ([]Parameter, error) {
@@ -166,11 +175,15 @@ type WorkflowTemplate struct {
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.
// todo rename to have ID suffix
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
}
type Label struct {
@@ -189,6 +202,7 @@ type WorkflowExecutionStatisticReport struct {
Running int32
Completed int32
Failed int32
Terminated int32
}
type CronWorkflowStatisticReport struct {
@@ -278,16 +292,6 @@ func (wt *WorkflowTemplate) GetParametersKeyString() (map[string]string, error)
return result, nil
}
func (wt *WorkflowTemplate) GenerateUID() (string, error) {
uid, err := uuid.NewRandom()
if err != nil {
return "", err
}
wt.UID = uid.String()
return wt.UID, nil
}
func (wt *WorkflowTemplate) UpdateManifestParameters(params []Parameter) error {
manifestMap, err := mapping.NewFromYamlString(wt.Manifest)
if err != nil {
@@ -452,6 +456,13 @@ type WorkflowExecution struct {
Labels map[string]string
}
// TODO: reference this in WorkflowExecution
type WorkflowExecutionStatus struct {
Phase wfv1.NodePhase `json:"phase"`
StartedAt *time.Time `db:"started_at" json:"startedAt"`
FinishedAt *time.Time `db:"finished_at" json:"finishedAt"`
}
func (we *WorkflowExecution) LoadParametersFromBytes() ([]Parameter, error) {
loadedParameters := make([]Parameter, 0)
@@ -496,24 +507,6 @@ type File struct {
Directory bool
}
type ArtifactRepositoryS3Config struct {
S3 struct {
Bucket string
Endpoint string
Insecure string
Region string
AccessKeySecret struct {
Name string
Key string
}
SecretKeySecret struct {
Name string
Key string
}
Key string
}
}
// Given a path, returns the parent path, asssuming a '/' delimitor
// Result does not have a trailing slash.
// -> a/b/c/d would return a/b/c
@@ -626,6 +619,21 @@ func CronWorkflowsToIds(resources []*CronWorkflow) (ids []uint64) {
return
}
func WorkspacesToIds(resources []*Workspace) (ids []uint64) {
mappedIds := make(map[uint64]bool)
// This is to make sure we don't have duplicates
for _, resource := range resources {
mappedIds[resource.ID] = true
}
for id := range mappedIds {
ids = append(ids, id)
}
return
}
// Returns a list of column names prefixed with alias, and named to destination. Extra columns are added to the end of the list.
// Setting destination to empty string will not apply any destination.
// Example - with destination
@@ -659,20 +667,32 @@ func getWorkflowTemplateColumns(alias string, destination string, extraColumns .
return formatColumnSelect(columns, alias, destination, extraColumns...)
}
// returns all of the columns for workflowExecution modified by alias, destination.
// returns all of the columns for workflow template versions modified by alias, destination.
// see formatColumnSelect
func getWorkflowExecutionColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"id", "created_at", "uid", "name", "parameters"}
func getWorkflowTemplateVersionColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"id", "uid", "created_at", "version", "is_latest", "manifest"}
return formatColumnSelect(columns, alias, destination, extraColumns...)
}
// returns all of the columns for workspace modified by alias, destination.
// returns all of the columns for workflowExecution modified by alias, destination.
// see formatColumnSelect
func getWorkspaceColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"id", "created_at", "modified_at", "uid", "name", "namespace", "phase", "parameters", "workspace_template_id", "workspace_template_version", "started_at", "paused_at", "terminated_at"}
func getWorkflowExecutionColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"id", "created_at", "uid", "name", "parameters", "phase", "started_at", "finished_at"}
return formatColumnSelect(columns, alias, destination, extraColumns...)
}
// returns all of the columns for cronWorkflow modified by alias, destination.
// see formatColumnSelect
func getCronWorkflowColumns(extraColumns ...string) []string {
results := []string{"cw.id", "cw.created_at", "cw.uid", "cw.name", "cw.workflow_template_version_id", "cw.manifest", "cw.namespace"}
for _, str := range extraColumns {
results = append(results, str)
}
return results
}
func LabelsToMapping(labels ...*Label) map[string]string {
result := make(map[string]string)

35
pkg/util/env/env.go vendored
View File

@@ -1,6 +1,14 @@
package env
import "os"
import (
"github.com/onepanelio/core/pkg/util/ptr"
corev1 "k8s.io/api/core/v1"
"os"
)
const (
DefaultEnvironmentVariableSecret = "onepanel-default-env"
)
func GetEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
@@ -8,3 +16,28 @@ func GetEnv(key, fallback string) string {
}
return fallback
}
func PrependEnvVarToContainer(container *corev1.Container, name, value string) {
for _, e := range container.Env {
if e.Name == name {
return
}
}
container.Env = append([]corev1.EnvVar{
{
Name: name,
Value: value,
},
}, container.Env...)
}
func AddDefaultEnvVarsToContainer(container *corev1.Container) {
container.EnvFrom = append(container.EnvFrom, corev1.EnvFromSource{
SecretRef: &corev1.SecretEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: DefaultEnvironmentVariableSecret,
},
Optional: ptr.Bool(true),
},
})
}

View File

@@ -5,15 +5,16 @@ import (
)
const (
OnepanelPrefix = "onepanel.io/"
TagPrefix = "tags.onepanel.io/"
WorkflowTemplate = OnepanelPrefix + "workflow-template"
WorkflowTemplateUid = OnepanelPrefix + "workflow-template-uid"
WorkflowTemplateVersionUid = OnepanelPrefix + "workflow-template-version-uid"
WorkflowUid = OnepanelPrefix + "workflow-uid"
CronWorkflowUid = OnepanelPrefix + "cron-workflow-uid"
Version = OnepanelPrefix + "version"
VersionLatest = OnepanelPrefix + "version-latest"
OnepanelPrefix = "onepanel.io/"
TagPrefix = "tags.onepanel.io/"
WorkflowTemplate = OnepanelPrefix + "workflow-template"
WorkflowTemplateUid = OnepanelPrefix + "workflow-template-uid"
WorkflowTemplateVersionUid = OnepanelPrefix + "workflow-template-version-uid"
WorkspaceTemplateVersionUid = OnepanelPrefix + "workspace-template-version-uid"
WorkflowUid = OnepanelPrefix + "workflow-uid"
CronWorkflowUid = OnepanelPrefix + "cron-workflow-uid"
Version = OnepanelPrefix + "version"
VersionLatest = OnepanelPrefix + "version-latest"
)
// Function that modifies an input string

17
pkg/util/uid/uid.go Normal file
View File

@@ -0,0 +1,17 @@
package uid
import (
"errors"
"fmt"
"regexp"
"strings"
)
func GenerateUID(input string, max int) (string, error) {
re, _ := regexp.Compile(`[^a-zA-Z0-9-]{1,}`)
cleanUp := strings.ToLower(re.ReplaceAllString(input, `-`))
if len(cleanUp) > max {
return "", errors.New(fmt.Sprintf("Length of string exceeds %d", max))
}
return strings.ToLower(re.ReplaceAllString(input, `-`)), nil
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,9 +4,8 @@ import (
"database/sql"
"errors"
"fmt"
"github.com/hashicorp/go-uuid"
"github.com/onepanelio/core/pkg/util/pagination"
"regexp"
uid2 "github.com/onepanelio/core/pkg/util/uid"
"strconv"
"strings"
"time"
@@ -22,15 +21,15 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, error) {
uid, err := workflowTemplate.GenerateUID()
func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (*WorkflowTemplate, *WorkflowTemplateVersion, error) {
uid, err := uid2.GenerateUID(workflowTemplate.Name, 30)
if err != nil {
return nil, err
return nil, nil, err
}
workflowTemplate.UID = uid
tx, err := c.DB.Begin()
if err != nil {
return nil, err
return nil, nil, err
}
defer tx.Rollback()
@@ -41,23 +40,21 @@ func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *Work
"uid": uid,
"name": workflowTemplate.Name,
"namespace": namespace,
"is_system": workflowTemplate.IsSystem,
}).
Suffix("RETURNING id").
RunWith(tx).
QueryRow().Scan(&workflowTemplate.ID)
if err != nil {
return nil, err
return nil, nil, err
}
versionUid, err := uuid.GenerateUUID()
if err != nil {
return nil, err
}
versionUID := strconv.FormatInt(versionUnix, 10)
workflowTemplateVersion := WorkflowTemplateVersion{}
workflowTemplateVersion := &WorkflowTemplateVersion{}
err = sb.Insert("workflow_template_versions").
SetMap(sq.Eq{
"uid": versionUid,
"uid": versionUID,
"workflow_template_id": workflowTemplate.ID,
"version": versionUnix,
"is_latest": true,
@@ -65,9 +62,10 @@ func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *Work
}).
Suffix("RETURNING id").
RunWith(tx).
QueryRow().Scan(&workflowTemplateVersion.ID)
QueryRow().
Scan(&workflowTemplateVersion.ID)
if err != nil {
return nil, err
return nil, nil, err
}
if len(workflowTemplate.Labels) > 0 {
@@ -76,31 +74,38 @@ func (c *Client) createWorkflowTemplate(namespace string, workflowTemplate *Work
Exec()
if err != nil {
return nil, err
return nil, nil, err
}
}
argoWft, err := createArgoWorkflowTemplate(workflowTemplate, versionUnix)
if err != nil {
return nil, err
return nil, nil, err
}
argoWft.Labels[label.WorkflowTemplateVersionUid] = versionUID
if workflowTemplate.Resource != nil && workflowTemplate.ResourceUID != nil {
if *workflowTemplate.Resource == TypeWorkspaceTemplate {
argoWft.Labels[label.WorkspaceTemplateVersionUid] = *workflowTemplate.ResourceUID
}
}
argoWft.Labels[label.WorkflowTemplateVersionUid] = versionUid
argoWft, err = c.ArgoprojV1alpha1().WorkflowTemplates(namespace).Create(argoWft)
if err != nil {
return nil, err
return nil, nil, err
}
if err = tx.Commit(); err != nil {
if err := c.ArgoprojV1alpha1().WorkflowTemplates(namespace).Delete(argoWft.Name, &v1.DeleteOptions{}); err != nil {
log.Printf("Unable to delete argo workflow template")
}
return nil, err
return nil, nil, err
}
workflowTemplate.Version = versionUnix
return workflowTemplate, nil
return workflowTemplate, workflowTemplateVersion, nil
}
func (c *Client) workflowTemplatesSelectBuilder(namespace string) sq.SelectBuilder {
@@ -187,15 +192,21 @@ func (c *Client) getWorkflowTemplateById(id uint64) (workflowTemplate *WorkflowT
}
// @todo remove argoworkflow template here
// If version is 0, the latest workflow template is fetched.
func (c *Client) getWorkflowTemplate(namespace, uid string, version int64) (workflowTemplate *WorkflowTemplate, err error) {
workflowTemplate = &WorkflowTemplate{
WorkflowExecutionStatisticReport: &WorkflowExecutionStatisticReport{},
}
// A new workflow template version is created upon a change, so we use it's createdAt
// as a modified_at for the workflow template.
sb := c.workflowTemplatesSelectBuilder(namespace).
Columns("wtv.manifest", "wtv.version", "wtv.id workflow_template_version_id").
Columns("wtv.manifest", "wtv.version", "wtv.id workflow_template_version_id", "wtv.created_at modified_at").
Join("workflow_template_versions wtv ON wt.id = wtv.workflow_template_id").
Where(sq.Eq{"wt.uid": uid})
Where(sq.Eq{
"wt.uid": uid,
"wt.is_archived": false,
})
if version == 0 {
sb = sb.Where(sq.Eq{"wtv.is_latest": true})
@@ -264,7 +275,7 @@ func (c *Client) getWorkflowTemplateByName(namespace, name string, version int64
}
func (c *Client) listWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*WorkflowTemplate, err error) {
dbVersions, err := c.listDbWorkflowTemplateVersions(namespace, uid)
dbVersions, err := c.listDBWorkflowTemplateVersions(namespace, uid)
if err != nil {
return nil, err
}
@@ -308,6 +319,7 @@ func (c *Client) listWorkflowTemplates(namespace string, paginator *pagination.P
GroupBy("wt.id", "wt.created_at", "wt.uid", "wt.name", "wt.is_archived").
Where(sq.Eq{
"wt.is_archived": false,
"wt.is_system": false,
}).
OrderBy("wt.created_at DESC")
@@ -329,6 +341,7 @@ func (c *Client) CountWorkflowTemplates(namespace string) (count int, err error)
Where(sq.Eq{
"wt.namespace": namespace,
"wt.is_archived": false,
"wt.is_system": false,
}).
RunWith(c.DB.DB).
QueryRow().
@@ -337,26 +350,6 @@ func (c *Client) CountWorkflowTemplates(namespace string) (count int, err error)
return
}
func (c *Client) archiveWorkflowTemplate(namespace, uid string) (bool, error) {
query, args, err := sb.Update("workflow_templates").
Set("is_archived", true).
Where(sq.Eq{
"uid": uid,
"namespace": namespace,
}).
ToSql()
if err != nil {
return false, err
}
if _, err := c.DB.Exec(query, args...); err != nil {
return false, err
}
return true, nil
}
func (c *Client) validateWorkflowTemplate(namespace string, workflowTemplate *WorkflowTemplate) (err error) {
// validate workflow template
finalBytes, err := workflowTemplate.WrapSpec()
@@ -381,7 +374,7 @@ func (c *Client) CreateWorkflowTemplate(namespace string, workflowTemplate *Work
return nil, util.NewUserError(codes.InvalidArgument, err.Error())
}
workflowTemplate, err := c.createWorkflowTemplate(namespace, workflowTemplate)
workflowTemplate, _, err := c.createWorkflowTemplate(namespace, workflowTemplate)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
@@ -412,7 +405,11 @@ func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplat
}
defer tx.Rollback()
wftSb := c.workflowTemplatesSelectBuilder(namespace).Where(sq.Eq{"wt.uid": workflowTemplate.UID})
wftSb := c.workflowTemplatesSelectBuilder(namespace).
Where(sq.Eq{
"wt.uid": workflowTemplate.UID,
"wt.is_archived": false,
})
query, args, err := wftSb.ToSql()
if err != nil {
return nil, err
@@ -433,10 +430,7 @@ func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplat
return nil, err
}
uid, err := uuid.GenerateUUID()
if err != nil {
return nil, err
}
uid := strconv.FormatInt(versionUnix, 10)
workflowTemplateVersionId := uint64(0)
err = sb.Insert("workflow_template_versions").
SetMap(sq.Eq{
@@ -448,20 +442,13 @@ func (c *Client) CreateWorkflowTemplateVersion(namespace string, workflowTemplat
}).
Suffix("RETURNING id").
RunWith(tx).
QueryRow().Scan(&workflowTemplateVersionId)
QueryRow().
Scan(&workflowTemplateVersionId)
if err != nil {
return nil, err
}
if len(workflowTemplate.Labels) != 0 {
_, err = c.InsertLabelsBuilder(TypeWorkflowTemplateVersion, workflowTemplateVersionId, workflowTemplate.Labels).
RunWith(tx).
Exec()
if err != nil {
return nil, err
}
}
workflowTemplate.WorkflowTemplateVersionId = workflowTemplateVersionId
latest, err := c.getArgoWorkflowTemplate(namespace, workflowTemplate.UID, "latest")
if err != nil {
log.WithFields(log.Fields{
@@ -555,6 +542,25 @@ func (c *Client) GetWorkflowTemplateByName(namespace, name string, version int64
return
}
// CountWorkflowTemplateVersions returns the number of versions a non-archived WorkflowTemplate has.
func (c *Client) CountWorkflowTemplateVersions(namespace, uid string) (count uint64, err error) {
count = 0
err = sb.Select("COUNT(*)").
From("workflow_templates wt").
Join("workflow_template_versions wtv ON wtv.workflow_template_id = wt.id").
Where(sq.Eq{
"wt.namespace": namespace,
"wt.uid": uid,
"wt.is_archived": false,
}).
RunWith(c.DB).
QueryRow().
Scan(&count)
return
}
func (c *Client) ListWorkflowTemplateVersions(namespace, uid string) (workflowTemplateVersions []*WorkflowTemplate, err error) {
workflowTemplateVersions, err = c.listWorkflowTemplateVersions(namespace, uid)
if err != nil {
@@ -613,8 +619,12 @@ func (c *Client) ListWorkflowTemplates(namespace string, paginator *pagination.P
return
}
func (c *Client) getLatestWorkflowTemplate(namespace, uid string) (*WorkflowTemplate, error) {
return c.getWorkflowTemplate(namespace, uid, 0) //version=0 means latest
}
func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool, err error) {
workflowTemplate, err := c.getWorkflowTemplate(namespace, uid, 0)
workflowTemplate, err := c.getLatestWorkflowTemplate(namespace, uid)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
@@ -627,19 +637,109 @@ func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool,
return false, util.NewUserError(codes.NotFound, "Workflow template not found.")
}
archived, err = c.archiveWorkflowTemplate(namespace, uid)
if !archived || err != nil {
wftVersions, err := c.listWorkflowTemplateVersions(namespace, uid)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Get Workflow Template Versions failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
//cron workflows
cronWorkflows := []*CronWorkflow{}
cwfSB := c.cronWorkflowSelectBuilder(namespace, uid).
OrderBy("cw.created_at DESC")
query, args, err := cwfSB.ToSql()
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Get Cron Workflows SQL failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
if err := c.DB.Select(&cronWorkflows, query, args...); err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Get Cron Workflows failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
for _, cwf := range cronWorkflows {
err = c.ArchiveCronWorkflow(namespace, cwf.Name)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Archive Workflow Template failed.")
}).Error("Archive Cron Workflow failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
}
//workflow executions
paginator := pagination.NewRequest(0, 100)
for _, wftVer := range wftVersions {
wfTempVer := strconv.FormatInt(wftVer.Version, 10)
workflowTemplateName := uid + "-v" + wfTempVer
for {
wfs, err := c.ListWorkflowExecutions(namespace, uid, wfTempVer, &paginator)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Get Workflow Executions failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
if len(wfs) == 0 {
break
}
for _, wf := range wfs {
err = c.ArchiveWorkflowExecution(namespace, wf.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Archive Workflow Execution Failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
}
}
err = c.ArgoprojV1alpha1().WorkflowTemplates(namespace).Delete(workflowTemplateName, nil)
if err != nil {
if strings.Contains(err.Error(), "not found") {
return true, nil
}
return false, err
}
}
_, err = sb.Update("workflow_templates").
Set("is_archived", true).
Where(sq.Eq{
"uid": uid,
"namespace": namespace,
}).RunWith(c.DB).Exec()
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Archive Workflow Template DB failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
return
return true, nil
}
func createArgoWorkflowTemplate(workflowTemplate *WorkflowTemplate, version int64) (*v1alpha1.WorkflowTemplate, error) {
@@ -657,8 +757,10 @@ func createArgoWorkflowTemplate(workflowTemplate *WorkflowTemplate, version int6
return nil, err
}
re, _ := regexp.Compile(`[^a-zA-Z0-9-]{1,}`)
worfklowTemplateName := strings.ToLower(re.ReplaceAllString(workflowTemplate.Name, `-`))
worfklowTemplateName, err := uid2.GenerateUID(workflowTemplate.Name, 30)
if err != nil {
return nil, err
}
argoWft.Name = fmt.Sprintf("%v-v%v", worfklowTemplateName, version)
@@ -717,13 +819,16 @@ func (c *Client) listArgoWorkflowTemplates(namespace, workflowTemplateUid string
return &templates, nil
}
func (c *Client) listDbWorkflowTemplateVersions(namespace, workflowTemplateUid string) ([]*WorkflowTemplateVersion, error) {
func (c *Client) listDBWorkflowTemplateVersions(namespace, workflowTemplateUID string) ([]*WorkflowTemplateVersion, error) {
versions := make([]*WorkflowTemplateVersion, 0)
sb := c.workflowTemplatesVersionSelectBuilder(namespace).
Columns(`wt.id "workflow_template.id"`, `wt.created_at "workflow_template.created_at"`).
Columns(`wt.name "workflow_template.name"`, `wt.is_archived "workflow_template.is_archived"`).
Where(sq.Eq{"wt.uid": workflowTemplateUid}).
Where(sq.Eq{
"wt.uid": workflowTemplateUID,
"wt.is_archived": false,
}).
OrderBy("wtv.created_at DESC")
query, args, err := sb.ToSql()

View File

@@ -1,6 +1,7 @@
package v1
import (
"database/sql"
"encoding/json"
"fmt"
sq "github.com/Masterminds/squirrel"
@@ -9,15 +10,21 @@ import (
"github.com/onepanelio/core/pkg/util"
"github.com/onepanelio/core/pkg/util/pagination"
"github.com/onepanelio/core/pkg/util/ptr"
uid2 "github.com/onepanelio/core/pkg/util/uid"
"google.golang.org/grpc/codes"
"time"
)
func (c *Client) workspacesSelectBuilder(namespace string) sq.SelectBuilder {
sb := sb.Select("w.id", "w.uid", "w.name", "wt.id \"workspace_template.id\"", "wt.uid \"workspace_template.uid\"", "wtv.version \"workspace_template.version\"").
sb := sb.Select(getWorkspaceColumns("w", "")...).
Columns(getWorkspaceStatusColumns("w", "status")...).
Columns(getWorkspaceTemplateColumns("wt", "workspace_template")...).
Columns(getWorkflowTemplateVersionColumns("wftv", "workflow_template_version")...).
Columns("wtv.version \"workspace_template.version\"").
From("workspaces w").
Join("workspace_templates wt ON wt.id = w.workspace_template_id").
Join("workspace_template_versions wtv ON wtv.workspace_template_id = wt.id").
Join("workspace_template_versions wtv ON wtv.workspace_template_id = wt.id AND wtv.version = w.workspace_template_version").
Join("workflow_template_versions wftv ON wftv.workflow_template_id = wt.workflow_template_id AND wftv.version = w.workspace_template_version").
Where(sq.Eq{
"w.namespace": namespace,
})
@@ -25,29 +32,73 @@ func (c *Client) workspacesSelectBuilder(namespace string) sq.SelectBuilder {
return sb
}
func getWorkspaceParameterValue(parameters []Parameter, name string) *string {
for _, p := range parameters {
if p.Name == name {
return p.Value
}
}
return nil
}
func mergeWorkspaceParameters(existingParameters, newParameters []Parameter) (parameters []Parameter) {
parameterMap := make(map[string]*string, 0)
for _, p := range newParameters {
parameterMap[p.Name] = p.Value
parameters = append(parameters, Parameter{
Name: p.Name,
Value: p.Value,
})
}
for _, p := range existingParameters {
_, ok := parameterMap[p.Name]
if !ok {
parameters = append(parameters, Parameter{
Name: p.Name,
Value: p.Value,
})
}
}
return parameters
}
// Injects parameters into the workspace.Parameters.
// If the parameter already exists, it's value is updated.
// The parameters injected are:
// sys-name
// sys-workspace-action
// sys-resource-action
// sys-host
func injectWorkspaceSystemParameters(namespace string, workspace *Workspace, workspaceAction, resourceAction string, config map[string]string) (err error) {
host := fmt.Sprintf("%v--%v.%v", workspace.Name, namespace, config["ONEPANEL_DOMAIN"])
workspace.Parameters = append(workspace.Parameters,
Parameter{
Name: "sys-name",
Value: ptr.String(workspace.Name),
},
Parameter{
workspace.UID, err = uid2.GenerateUID(workspace.Name, 30)
if err != nil {
return
}
host := fmt.Sprintf("%v--%v.%v", workspace.UID, namespace, config["ONEPANEL_DOMAIN"])
systemParameters := []Parameter{
{
Name: "sys-workspace-action",
Value: ptr.String(workspaceAction),
}, Parameter{
},
{
Name: "sys-resource-action",
Value: ptr.String(resourceAction),
}, Parameter{
},
{
Name: "sys-host",
Value: ptr.String(host),
})
},
}
workspace.Parameters = mergeWorkspaceParameters(workspace.Parameters, systemParameters)
return
}
func (c *Client) createWorkspace(namespace string, parameters []byte, workspace *Workspace) (*Workspace, error) {
workflowExecution, err := c.CreateWorkflowExecution(namespace, &WorkflowExecution{
_, err := c.CreateWorkflowExecution(namespace, &WorkflowExecution{
Parameters: workspace.Parameters,
WorkflowTemplate: workspace.WorkspaceTemplate.WorkflowTemplate,
})
@@ -55,24 +106,24 @@ func (c *Client) createWorkspace(namespace string, parameters []byte, workspace
return nil, err
}
workspace.UID = workflowExecution.UID
err = sb.Insert("workspaces").
SetMap(sq.Eq{
"uid": workspace.UID,
"name": workspace.Name,
"namespace": namespace,
"parameters": parameters,
"phase": WorkspaceStarted,
"phase": WorkspaceLaunching,
"started_at": time.Now().UTC(),
"workspace_template_id": workspace.WorkspaceTemplate.ID,
"workspace_template_version": workspace.WorkspaceTemplate.Version,
"url": workspace.URL,
}).
Suffix("RETURNING id, created_at").
RunWith(c.DB).
QueryRow().Scan(&workspace.ID, &workspace.CreatedAt)
QueryRow().
Scan(&workspace.ID, &workspace.CreatedAt)
if err != nil {
return nil, err
return nil, util.NewUserErrorWrap(err, "Workspace")
}
return workspace, nil
@@ -80,11 +131,6 @@ func (c *Client) createWorkspace(namespace string, parameters []byte, workspace
// CreateWorkspace creates a workspace by triggering the corresponding workflow
func (c *Client) CreateWorkspace(namespace string, workspace *Workspace) (*Workspace, error) {
valid, err := govalidator.ValidateStruct(workspace)
if err != nil || !valid {
return nil, util.NewUserError(codes.InvalidArgument, err.Error())
}
config, err := c.GetSystemConfig()
if err != nil {
return nil, err
@@ -99,9 +145,32 @@ func (c *Client) CreateWorkspace(namespace string, workspace *Workspace) (*Works
if err != nil {
return nil, err
}
workspace.Parameters = append(workspace.Parameters, Parameter{
Name: "sys-uid",
Value: ptr.String(workspace.UID),
})
workspaceTemplate, err := c.GetWorkspaceTemplate(namespace,
workspace.WorkspaceTemplate.UID, workspace.WorkspaceTemplate.Version)
sysHost := getWorkspaceParameterValue(workspace.Parameters, "sys-host")
if sysHost == nil {
return nil, fmt.Errorf("sys-host parameter not found")
}
workspace.URL = *sysHost
existingWorkspace, err := c.GetWorkspace(namespace, workspace.UID)
if err != nil {
return nil, err
}
if existingWorkspace != nil {
return nil, util.NewUserError(codes.AlreadyExists, "Workspace already exists.")
}
// Validate workspace fields
valid, err := govalidator.ValidateStruct(workspace)
if err != nil || !valid {
return nil, util.NewUserError(codes.InvalidArgument, err.Error())
}
workspaceTemplate, err := c.GetWorkspaceTemplate(namespace, workspace.WorkspaceTemplate.UID, workspace.WorkspaceTemplate.Version)
if err != nil {
return nil, util.NewUserError(codes.NotFound, "Workspace template not found.")
}
@@ -109,7 +178,11 @@ func (c *Client) CreateWorkspace(namespace string, workspace *Workspace) (*Works
workspace, err = c.createWorkspace(namespace, parameters, workspace)
if err != nil {
return nil, util.NewUserError(codes.Unknown, "Could not create workspace.")
return nil, err
}
if _, err := c.InsertLabels(TypeWorkspace, workspace.ID, workspace.Labels); err != nil {
return nil, err
}
return workspace, nil
@@ -117,14 +190,35 @@ func (c *Client) CreateWorkspace(namespace string, workspace *Workspace) (*Works
func (c *Client) GetWorkspace(namespace, uid string) (workspace *Workspace, err error) {
query, args, err := c.workspacesSelectBuilder(namespace).
Where(sq.Eq{
"w.uid": uid,
Where(sq.And{
sq.Eq{"w.uid": uid},
sq.NotEq{"w.phase": WorkspaceTerminated},
}).ToSql()
if err != nil {
return
}
workspace = &Workspace{}
err = c.DB.Get(workspace, query, args...)
if err = c.DB.Get(workspace, query, args...); err == sql.ErrNoRows {
err = nil
workspace = nil
return
}
if err != nil {
return nil, err
}
if err = json.Unmarshal(workspace.ParametersBytes, &workspace.Parameters); err != nil {
return
}
labelsMap, err := c.GetDbLabelsMapped(TypeWorkspace, workspace.ID)
if err != nil {
return nil, err
}
workspace.Labels = labelsMap[workspace.ID]
return
}
@@ -132,10 +226,11 @@ func (c *Client) GetWorkspace(namespace, uid string) (workspace *Workspace, err
// UpdateWorkspaceStatus updates workspace status and times based on phase
func (c *Client) UpdateWorkspaceStatus(namespace, uid string, status *WorkspaceStatus) (err error) {
fieldMap := sq.Eq{
"phase": status.Phase,
"phase": status.Phase,
"modified_at": time.Now().UTC(),
}
switch status.Phase {
case WorkspaceStarted:
case WorkspaceLaunching:
fieldMap["paused_at"] = pq.NullTime{}
fieldMap["started_at"] = time.Now().UTC()
break
@@ -143,6 +238,10 @@ func (c *Client) UpdateWorkspaceStatus(namespace, uid string, status *WorkspaceS
fieldMap["started_at"] = pq.NullTime{}
fieldMap["paused_at"] = time.Now().UTC()
break
case WorkspaceUpdating:
fieldMap["paused_at"] = pq.NullTime{}
fieldMap["updated_at"] = time.Now().UTC()
break
case WorkspaceTerminating:
fieldMap["started_at"] = pq.NullTime{}
fieldMap["paused_at"] = pq.NullTime{}
@@ -151,9 +250,13 @@ func (c *Client) UpdateWorkspaceStatus(namespace, uid string, status *WorkspaceS
}
_, err = sb.Update("workspaces").
SetMap(fieldMap).
Where(sq.Eq{
"namespace": namespace,
"uid": uid,
Where(sq.And{
sq.Eq{
"namespace": namespace,
"uid": uid,
}, sq.NotEq{
"phase": WorkspaceTerminated,
},
}).
RunWith(c.DB).Exec()
if err != nil {
@@ -163,14 +266,56 @@ func (c *Client) UpdateWorkspaceStatus(namespace, uid string, status *WorkspaceS
return
}
func (c *Client) ListWorkspaces(namespace string, paginator *pagination.PaginationRequest) (workspaces []*Workspace, err error) {
// ListWorkspacesByTemplateID will return all the workspaces for a given workspace template id.
// Sourced from database.
func (c *Client) ListWorkspacesByTemplateID(namespace string, templateID uint64) (workspaces []*Workspace, err error) {
sb := sb.Select(getWorkspaceColumns("w", "")...).
From("workspaces w").
OrderBy("w.created_at DESC").
Where(sq.Eq{
"w.namespace": namespace,
Where(sq.And{
sq.Eq{
"w.namespace": namespace,
"w.workspace_template_id": templateID,
},
sq.NotEq{
"phase": WorkspaceTerminated,
},
})
paginator.ApplyToSelect(&sb)
query, args, err := sb.ToSql()
if err != nil {
return nil, err
}
if err := c.DB.Select(&workspaces, query, args...); err != nil {
return nil, err
}
labelMap, err := c.GetDbLabelsMapped(TypeWorkspace, WorkspacesToIds(workspaces)...)
if err != nil {
return nil, err
}
for _, workspace := range workspaces {
workspace.Labels = labelMap[workspace.ID]
}
return
}
func (c *Client) ListWorkspaces(namespace string, paginator *pagination.PaginationRequest) (workspaces []*Workspace, err error) {
sb := sb.Select(getWorkspaceColumns("w", "")...).
Columns(getWorkspaceStatusColumns("w", "status")...).
Columns(getWorkspaceTemplateColumns("wt", "workspace_template")...).
From("workspaces w").
Join("workspace_templates wt ON wt.id = w.workspace_template_id").
OrderBy("w.created_at DESC").
Where(sq.And{
sq.Eq{
"w.namespace": namespace,
},
sq.NotEq{
"phase": WorkspaceTerminated,
},
})
sb = *paginator.ApplyToSelect(&sb)
query, args, err := sb.ToSql()
if err != nil {
@@ -181,20 +326,55 @@ func (c *Client) ListWorkspaces(namespace string, paginator *pagination.Paginati
return nil, err
}
labelMap, err := c.GetDbLabelsMapped(TypeWorkspace, WorkspacesToIds(workspaces)...)
if err != nil {
return nil, err
}
for _, workspace := range workspaces {
workspace.Labels = labelMap[workspace.ID]
}
return
}
func (c *Client) updateWorkspace(namespace, uid, workspaceAction, resourceAction string, status *WorkspaceStatus) (err error) {
func (c *Client) CountWorkspaces(namespace string) (count int, err error) {
err = sb.Select("COUNT( DISTINCT( w.id ))").
From("workspaces w").
Join("workspace_templates wt ON w.workspace_template_id = wt.id").
Where(sq.And{
sq.Eq{
"w.namespace": namespace,
},
sq.NotEq{
"phase": WorkspaceTerminated,
},
}).
RunWith(c.DB.DB).
QueryRow().
Scan(&count)
return
}
func (c *Client) updateWorkspace(namespace, uid, workspaceAction, resourceAction string, status *WorkspaceStatus, parameters ...Parameter) (err error) {
workspace, err := c.GetWorkspace(namespace, uid)
if err != nil {
return util.NewUserError(codes.NotFound, "Workspace not found.")
}
if workspace == nil {
return nil
}
config, err := c.GetSystemConfig()
if err != nil {
return
}
workspace.Parameters = mergeWorkspaceParameters(workspace.Parameters, parameters)
parametersJSON, err := json.Marshal(workspace.Parameters)
if err != nil {
return
}
workspace.Parameters = append(workspace.Parameters, Parameter{
Name: "sys-uid",
Value: ptr.String(uid),
@@ -204,10 +384,6 @@ func (c *Client) updateWorkspace(namespace, uid, workspaceAction, resourceAction
return
}
if err = c.UpdateWorkspaceStatus(namespace, uid, status); err != nil {
return
}
workspaceTemplate, err := c.GetWorkspaceTemplate(namespace,
workspace.WorkspaceTemplate.UID, workspace.WorkspaceTemplate.Version)
if err != nil {
@@ -223,13 +399,53 @@ func (c *Client) updateWorkspace(namespace, uid, workspaceAction, resourceAction
return
}
if err = c.UpdateWorkspaceStatus(namespace, uid, status); err != nil {
return
}
// Update parameters if they are passed
if len(parameters) == 0 {
return
}
_, err = sb.Update("workspaces").
SetMap(sq.Eq{
"parameters": parametersJSON,
}).
Where(sq.And{
sq.Eq{
"namespace": namespace,
"uid": uid,
}, sq.NotEq{
"phase": WorkspaceTerminated,
},
}).
RunWith(c.DB).Exec()
if err != nil {
return util.NewUserError(codes.NotFound, "Workspace not found.")
}
return
}
func (c *Client) UpdateWorkspace(namespace, uid string, parameters []Parameter) (err error) {
return c.updateWorkspace(namespace, uid, "update", "apply", &WorkspaceStatus{Phase: WorkspaceUpdating}, parameters...)
}
func (c *Client) PauseWorkspace(namespace, uid string) (err error) {
return c.updateWorkspace(namespace, uid, "pause", "delete", &WorkspaceStatus{Phase: WorkspacePausing})
}
func (c *Client) ResumeWorkspace(namespace, uid string) (err error) {
return c.updateWorkspace(namespace, uid, "create", "apply", &WorkspaceStatus{Phase: WorkspaceLaunching})
}
func (c *Client) DeleteWorkspace(namespace, uid string) (err error) {
return c.updateWorkspace(namespace, uid, "delete", "delete", &WorkspaceStatus{Phase: WorkspaceTerminating})
}
// ArchiveWorkspace archives by setting the workspace to delete or terminate.
// Kicks off DB archiving and k8s cleaning.
func (c *Client) ArchiveWorkspace(namespace, uid string) (err error) {
return c.updateWorkspace(namespace, uid, "delete", "delete", &WorkspaceStatus{Phase: WorkspaceTerminating})
}

View File

@@ -8,8 +8,11 @@ import (
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/asaskevich/govalidator"
"github.com/onepanelio/core/pkg/util"
"github.com/onepanelio/core/pkg/util/env"
"github.com/onepanelio/core/pkg/util/pagination"
"github.com/onepanelio/core/pkg/util/ptr"
uid2 "github.com/onepanelio/core/pkg/util/uid"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
networking "istio.io/api/networking/v1alpha3"
corev1 "k8s.io/api/core/v1"
@@ -25,48 +28,49 @@ func parseWorkspaceSpec(template string) (spec *WorkspaceSpec, err error) {
}
func generateArguments(spec *WorkspaceSpec, config map[string]string) (err error) {
if spec.Arguments == nil {
spec.Arguments = &Arguments{
Parameters: []Parameter{},
}
}
systemParameters := make([]Parameter, 0)
// Resource action parameter
spec.Arguments.Parameters = append(spec.Arguments.Parameters, Parameter{
systemParameters = append(systemParameters, Parameter{
Name: "sys-name",
Type: "input.text",
Value: ptr.String("name"),
DisplayName: ptr.String("Workspace name"),
Hint: ptr.String("Must be less than 63 characters, contain only alphanumeric or `-` characters"),
Hint: ptr.String("Must be between 3-30 characters, contain only alphanumeric or `-` characters"),
Required: true,
})
// TODO: These can be removed when lint validation of workflows work
// Resource action parameter
spec.Arguments.Parameters = append(spec.Arguments.Parameters, Parameter{
systemParameters = append(systemParameters, Parameter{
Name: "sys-resource-action",
Value: ptr.String("apply"),
Type: "input.hidden",
})
// Workspace action
spec.Arguments.Parameters = append(spec.Arguments.Parameters, Parameter{
systemParameters = append(systemParameters, Parameter{
Name: "sys-workspace-action",
Value: ptr.String("create"),
Type: "input.hidden",
})
// Host
spec.Arguments.Parameters = append(spec.Arguments.Parameters, Parameter{
systemParameters = append(systemParameters, Parameter{
Name: "sys-host",
Value: ptr.String(config["ONEPANEL_DOMAIN"]),
Type: "input.hidden",
})
// UID placeholder
systemParameters = append(systemParameters, Parameter{
Name: "sys-uid",
Value: ptr.String("uid"),
Type: "input.hidden",
})
// Node pool parameter and options
var options []*ParameterOption
if err = yaml.Unmarshal([]byte(config["applicationNodePoolOptions"]), &options); err != nil {
return
}
spec.Arguments.Parameters = append(spec.Arguments.Parameters, Parameter{
systemParameters = append(systemParameters, Parameter{
Name: "sys-node-pool",
Value: ptr.String(options[0].Value),
Type: "select.select",
@@ -84,7 +88,7 @@ func generateArguments(spec *WorkspaceSpec, config map[string]string) (err error
continue
}
spec.Arguments.Parameters = append(spec.Arguments.Parameters, Parameter{
systemParameters = append(systemParameters, Parameter{
Name: fmt.Sprintf("sys-%v-volume-size", v.Name),
Type: "input.number",
Value: ptr.String("20480"),
@@ -97,6 +101,13 @@ func generateArguments(spec *WorkspaceSpec, config map[string]string) (err error
}
}
if spec.Arguments == nil {
spec.Arguments = &Arguments{
Parameters: []Parameter{},
}
}
spec.Arguments.Parameters = append(systemParameters, spec.Arguments.Parameters...)
return
}
@@ -107,12 +118,12 @@ func createServiceManifest(spec *WorkspaceSpec) (serviceManifest string, err err
Kind: "Service",
},
ObjectMeta: metav1.ObjectMeta{
Name: "{{workflow.parameters.sys-name}}",
Name: "{{workflow.parameters.sys-uid}}",
},
Spec: corev1.ServiceSpec{
Ports: spec.Ports,
Selector: map[string]string{
"app": "{{workflow.parameters.sys-name}}",
"app": "{{workflow.parameters.sys-uid}}",
},
},
}
@@ -128,14 +139,14 @@ func createServiceManifest(spec *WorkspaceSpec) (serviceManifest string, err err
func createVirtualServiceManifest(spec *WorkspaceSpec) (virtualServiceManifest string, err error) {
for _, h := range spec.Routes {
for _, r := range h.Route {
r.Destination.Host = "{{workflow.parameters.sys-name}}"
r.Destination.Host = "{{workflow.parameters.sys-uid}}"
}
}
virtualService := map[string]interface{}{
"apiVersion": "networking.istio.io/v1alpha3",
"kind": "VirtualService",
"metadata": metav1.ObjectMeta{
Name: "{{workflow.parameters.sys-name}}",
Name: "{{workflow.parameters.sys-uid}}",
},
"spec": networking.VirtualService{
Http: spec.Routes,
@@ -155,7 +166,16 @@ func createVirtualServiceManifest(spec *WorkspaceSpec) (virtualServiceManifest s
func createStatefulSetManifest(workspaceSpec *WorkspaceSpec, config map[string]string) (statefulSetManifest string, err error) {
var volumeClaims []map[string]interface{}
volumeClaimsMapped := make(map[string]bool)
for _, c := range workspaceSpec.Containers {
for i, c := range workspaceSpec.Containers {
container := &workspaceSpec.Containers[i]
env.AddDefaultEnvVarsToContainer(container)
env.PrependEnvVarToContainer(container, "ONEPANEL_API_URL", config["ONEPANEL_API_URL"])
env.PrependEnvVarToContainer(container, "ONEPANEL_FQDN", config["ONEPANEL_FQDN"])
env.PrependEnvVarToContainer(container, "ONEPANEL_DOMAIN", config["ONEPANEL_DOMAIN"])
env.PrependEnvVarToContainer(container, "ONEPANEL_PROVIDER_TYPE", config["PROVIDER_TYPE"])
env.PrependEnvVarToContainer(container, "ONEPANEL_RESOURCE_NAMESPACE", "{{workflow.namespace}}")
env.PrependEnvVarToContainer(container, "ONEPANEL_RESOURCE_UID", "{{workflow.parameters.sys-name}}")
for _, v := range c.VolumeMounts {
if volumeClaimsMapped[v.Name] {
continue
@@ -186,20 +206,20 @@ func createStatefulSetManifest(workspaceSpec *WorkspaceSpec, config map[string]s
"apiVersion": "apps/v1",
"kind": "StatefulSet",
"metadata": metav1.ObjectMeta{
Name: "{{workflow.parameters.sys-name}}",
Name: "{{workflow.parameters.sys-uid}}",
},
"spec": map[string]interface{}{
"replicas": 1,
"serviceName": "{{workflow.parameters.sys-name}}",
"serviceName": "{{workflow.parameters.sys-uid}}",
"selector": &metav1.LabelSelector{
MatchLabels: map[string]string{
"app": "{{workflow.parameters.sys-name}}",
"app": "{{workflow.parameters.sys-uid}}",
},
},
"template": corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"app": "{{workflow.parameters.sys-name}}",
"app": "{{workflow.parameters.sys-uid}}",
},
},
Spec: corev1.PodSpec{
@@ -236,15 +256,21 @@ func unmarshalWorkflowTemplate(spec *WorkspaceSpec, serviceManifest, virtualServ
}
}
getStatefulSetManifest := `apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{workflow.parameters.sys-uid}}
`
deletePVCManifest := `apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{inputs.parameters.sys-pvc-name}}-{{workflow.parameters.sys-name}}-0
name: {{inputs.parameters.sys-pvc-name}}-{{workflow.parameters.sys-uid}}-0
`
templates := []wfv1.Template{
{
Name: "workspace",
DAG: &wfv1.DAGTemplate{
FailFast: ptr.Bool(false),
Tasks: []wfv1.DAGTask{
{
Name: "service",
@@ -261,6 +287,20 @@ metadata:
Dependencies: []string{"virtual-service"},
When: "{{workflow.parameters.sys-workspace-action}} == create || {{workflow.parameters.sys-workspace-action}} == update",
},
{
Name: "get-stateful-set",
Template: "get-stateful-set-resource",
Dependencies: []string{"stateful-set"},
When: "{{workflow.parameters.sys-workspace-action}} == create || {{workflow.parameters.sys-workspace-action}} == update",
Arguments: wfv1.Arguments{
Parameters: []wfv1.Parameter{
{
Name: "update-revision",
Value: ptr.String("{{tasks.stateful-set.outputs.parameters.update-revision}}"),
},
},
},
},
{
Name: "delete-stateful-set",
Template: "delete-stateful-set-resource",
@@ -285,7 +325,7 @@ metadata:
{
Name: "sys-set-phase-running",
Template: "sys-update-status",
Dependencies: []string{"stateful-set"},
Dependencies: []string{"get-stateful-set"},
Arguments: wfv1.Arguments{
Parameters: []wfv1.Parameter{
{
@@ -294,7 +334,7 @@ metadata:
},
},
},
When: "{{workflow.parameters.sys-workspace-action}} == create",
When: "{{workflow.parameters.sys-workspace-action}} == create || {{workflow.parameters.sys-workspace-action}} == update",
},
{
Name: "sys-set-phase-paused",
@@ -324,11 +364,6 @@ metadata:
},
When: "{{workflow.parameters.sys-workspace-action}} == delete",
},
{
Name: spec.PostExecutionWorkflow.Entrypoint,
Template: spec.PostExecutionWorkflow.Entrypoint,
Dependencies: []string{"stateful-set", "delete-stateful-set"},
},
},
},
},
@@ -353,6 +388,27 @@ metadata:
Manifest: containersManifest,
SuccessCondition: "status.readyReplicas > 0",
},
Outputs: wfv1.Outputs{
Parameters: []wfv1.Parameter{
{
Name: "update-revision",
ValueFrom: &wfv1.ValueFrom{
JSONPath: "{.status.updateRevision}",
},
},
},
},
},
{
Name: "get-stateful-set-resource",
Inputs: wfv1.Inputs{
Parameters: []wfv1.Parameter{{Name: "update-revision"}},
},
Resource: &wfv1.ResourceTemplate{
Action: "get",
Manifest: getStatefulSetManifest,
SuccessCondition: "status.readyReplicas > 0, status.currentRevision == {{inputs.parameters.update-revision}}",
},
},
{
Name: "delete-stateful-set-resource",
@@ -393,6 +449,14 @@ metadata:
templates = append(templates, *curlNodeTemplate)
// Add postExecutionWorkflow if it exists
if spec.PostExecutionWorkflow != nil {
dag := wfv1.DAGTask{
Name: spec.PostExecutionWorkflow.Entrypoint,
Template: spec.PostExecutionWorkflow.Entrypoint,
Dependencies: []string{"sys-set-phase-running", "sys-set-phase-paused", "sys-set-phase-terminated"},
}
templates[0].DAG.Tasks = append(templates[0].DAG.Tasks, dag)
templates = append(templates, spec.PostExecutionWorkflow.Templates...)
}
@@ -412,10 +476,11 @@ metadata:
}
func (c *Client) createWorkspaceTemplate(namespace string, workspaceTemplate *WorkspaceTemplate) (*WorkspaceTemplate, error) {
uid, err := workspaceTemplate.GenerateUID()
uid, err := uid2.GenerateUID(workspaceTemplate.Name, 30)
if err != nil {
return nil, err
}
workspaceTemplate.UID = uid
tx, err := c.DB.Begin()
if err != nil {
@@ -423,11 +488,13 @@ func (c *Client) createWorkspaceTemplate(namespace string, workspaceTemplate *Wo
}
defer tx.Rollback()
workspaceTemplate.WorkflowTemplate.IsSystem = true
workspaceTemplate.WorkflowTemplate.Resource = ptr.String(TypeWorkspaceTemplate)
workspaceTemplate.WorkflowTemplate.ResourceUID = ptr.String(uid)
workspaceTemplate.WorkflowTemplate, err = c.CreateWorkflowTemplate(namespace, workspaceTemplate.WorkflowTemplate)
if err != nil {
return nil, err
}
workspaceTemplate.Version = workspaceTemplate.WorkflowTemplate.Version
workspaceTemplate.IsLatest = true
@@ -442,22 +509,44 @@ func (c *Client) createWorkspaceTemplate(namespace string, workspaceTemplate *Wo
RunWith(tx).
QueryRow().Scan(&workspaceTemplate.ID, &workspaceTemplate.CreatedAt)
if err != nil {
_, err := c.ArchiveWorkflowTemplate(namespace, workspaceTemplate.WorkflowTemplate.UID)
return nil, err
_, errCleanUp := c.ArchiveWorkflowTemplate(namespace, workspaceTemplate.WorkflowTemplate.UID)
errorMsg := "Error with insert into workspace_templates. "
if errCleanUp != nil {
errorMsg += "Error with clean-up: ArchiveWorkflowTemplate. "
errorMsg += errCleanUp.Error()
}
return nil, util.NewUserErrorWrap(err, errorMsg) //return the source error
}
_, err = sb.Insert("workspace_template_versions").
workspaceTemplateVersionID := uint64(0)
err = sb.Insert("workspace_template_versions").
SetMap(sq.Eq{
"version": workspaceTemplate.Version,
"is_latest": workspaceTemplate.IsLatest,
"manifest": workspaceTemplate.Manifest,
"workspace_template_id": workspaceTemplate.ID,
}).
Suffix("RETURNING id").
RunWith(tx).
Exec()
QueryRow().
Scan(&workspaceTemplateVersionID)
if err != nil {
_, err := c.ArchiveWorkflowTemplate(namespace, workspaceTemplate.WorkflowTemplate.UID)
return nil, err
_, errCleanUp := c.ArchiveWorkflowTemplate(namespace, workspaceTemplate.WorkflowTemplate.UID)
errorMsg := "Error with insert into workspace_templates_versions. "
if errCleanUp != nil {
errorMsg += "Error with clean-up: ArchiveWorkflowTemplate. "
errorMsg += errCleanUp.Error()
}
return nil, util.NewUserErrorWrap(err, errorMsg) //return the source error
}
if len(workspaceTemplate.Labels) != 0 {
_, err = c.InsertLabelsBuilder(TypeWorkspaceTemplateVersion, workspaceTemplateVersionID, workspaceTemplate.Labels).
RunWith(tx).
Exec()
if err != nil {
return nil, err
}
}
if err = tx.Commit(); err != nil {
@@ -469,7 +558,7 @@ func (c *Client) createWorkspaceTemplate(namespace string, workspaceTemplate *Wo
}
func (c *Client) workspaceTemplatesSelectBuilder(namespace string) sq.SelectBuilder {
sb := sb.Select("wt.id", "wt.created_at", "wt.uid", "wt.name", `wt.workflow_template_id "workflow_template.id"`).
sb := sb.Select(getWorkspaceTemplateColumns("wt", "")...).
From("workspace_templates wt").
Where(sq.Eq{
"wt.namespace": namespace,
@@ -480,7 +569,7 @@ func (c *Client) workspaceTemplatesSelectBuilder(namespace string) sq.SelectBuil
func (c *Client) workspaceTemplateVersionsSelectBuilder(namespace, uid string) sq.SelectBuilder {
sb := c.workspaceTemplatesSelectBuilder(namespace).
Columns("wtv.created_at \"created_at\"", "wtv.version", "wtv.manifest", "wft.uid \"workflow_template.uid\"", "wftv.version \"workflow_template.version\"", "wftv.manifest \"workflow_template.manifest\"").
Columns("wtv.id \"workspace_template_version_id\"", "wtv.created_at \"created_at\"", "wtv.version", "wtv.manifest", "wft.id \"workflow_template.id\"", "wft.uid \"workflow_template.uid\"", "wftv.version \"workflow_template.version\"", "wftv.manifest \"workflow_template.manifest\"").
Join("workspace_template_versions wtv ON wtv.workspace_template_id = wt.id").
Join("workflow_templates wft ON wft.id = wt.workflow_template_id").
Join("workflow_template_versions wftv ON wftv.workflow_template_id = wft.id").
@@ -493,7 +582,10 @@ func (c *Client) getWorkspaceTemplateByName(namespace, name string) (workspaceTe
workspaceTemplate = &WorkspaceTemplate{}
sb := c.workspaceTemplatesSelectBuilder(namespace).
Where(sq.Eq{"wt.name": name}).
Where(sq.Eq{
"wt.name": name,
"is_archived": false,
}).
Limit(1)
query, args, err := sb.ToSql()
if err != nil {
@@ -577,7 +669,11 @@ func (c *Client) CreateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
return nil, err
}
if existingWorkspaceTemplate != nil {
return nil, util.NewUserError(codes.AlreadyExists, "Workspace template already exists.")
message := fmt.Sprintf("Workspace template with the name '%v' already exists", workspaceTemplate.Name)
if existingWorkspaceTemplate.IsArchived {
message = fmt.Sprintf("An archived workspace template with the name '%v' already exists", workspaceTemplate.Name)
}
return nil, util.NewUserError(codes.AlreadyExists, message)
}
workspaceTemplate.WorkflowTemplate, err = c.generateWorkspaceTemplateWorkflowTemplate(workspaceTemplate)
@@ -594,10 +690,14 @@ func (c *Client) CreateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
}
// GetWorkspaceTemplate return a workspaceTemplate and its corresponding workflowTemplate
// if version is 0, the latest version is returned.
func (c *Client) GetWorkspaceTemplate(namespace, uid string, version int64) (workspaceTemplate *WorkspaceTemplate, err error) {
workspaceTemplate = &WorkspaceTemplate{}
sb := c.workspaceTemplateVersionsSelectBuilder(namespace, uid).
Limit(1)
sb = sb.Where(sq.Eq{"wt.is_archived": false})
if version == 0 {
sb = sb.Where(sq.Eq{
"wtv.is_latest": true,
@@ -622,15 +722,7 @@ func (c *Client) GetWorkspaceTemplate(namespace, uid string, version int64) (wor
// UpdateWorkspaceTemplate adds a new workspace template version
func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *WorkspaceTemplate) (*WorkspaceTemplate, error) {
valid, err := govalidator.ValidateStruct(workspaceTemplate)
if err != nil || !valid {
if err == nil {
err = fmt.Errorf("invalid Workspace Template")
}
return nil, util.NewUserError(codes.InvalidArgument, err.Error())
}
existingWorkspaceTemplate, err := c.getWorkspaceTemplateByName(namespace, workspaceTemplate.Name)
existingWorkspaceTemplate, err := c.GetWorkspaceTemplate(namespace, workspaceTemplate.UID, workspaceTemplate.Version)
if err != nil {
return nil, err
}
@@ -638,18 +730,14 @@ func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
return nil, util.NewUserError(codes.NotFound, "Workspace template not found.")
}
workspaceTemplate.ID = existingWorkspaceTemplate.ID
existingWorkflowTemplate, err := c.getWorkflowTemplateById(existingWorkspaceTemplate.WorkflowTemplate.ID)
if err != nil {
return nil, err
}
workspaceTemplate.Name = existingWorkspaceTemplate.UID
updatedWorkflowTemplate, err := c.generateWorkspaceTemplateWorkflowTemplate(workspaceTemplate)
if err != nil {
return nil, err
}
updatedWorkflowTemplate.ID = existingWorkflowTemplate.ID
updatedWorkflowTemplate.UID = existingWorkflowTemplate.UID
updatedWorkflowTemplate.ID = existingWorkspaceTemplate.WorkflowTemplate.ID
updatedWorkflowTemplate.UID = existingWorkspaceTemplate.WorkflowTemplate.UID
tx, err := c.DB.Begin()
if err != nil {
@@ -657,6 +745,7 @@ func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
}
defer tx.Rollback()
updatedWorkflowTemplate.Labels = workspaceTemplate.Labels
workflowTemplateVersion, err := c.CreateWorkflowTemplateVersion(namespace, updatedWorkflowTemplate)
if err != nil {
return nil, err
@@ -665,11 +754,9 @@ func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
workspaceTemplate.Version = workflowTemplateVersion.Version
workspaceTemplate.IsLatest = true
_, err = sb.Insert("workspace_template_versions").
SetMap(sq.Eq{
"version": workspaceTemplate.Version,
"is_latest": workspaceTemplate.IsLatest,
"manifest": workspaceTemplate.Manifest,
_, err = sb.Update("workspace_template_versions").
SetMap(sq.Eq{"is_latest": false}).
Where(sq.Eq{
"workspace_template_id": workspaceTemplate.ID,
}).
RunWith(tx).
@@ -678,6 +765,31 @@ func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
return nil, err
}
workspaceTemplateVersionID := uint64(0)
err = sb.Insert("workspace_template_versions").
SetMap(sq.Eq{
"version": workspaceTemplate.Version,
"is_latest": workspaceTemplate.IsLatest,
"manifest": workspaceTemplate.Manifest,
"workspace_template_id": workspaceTemplate.ID,
}).
Suffix("RETURNING id").
RunWith(tx).
QueryRow().
Scan(&workspaceTemplateVersionID)
if err != nil {
return nil, err
}
if len(workspaceTemplate.Labels) != 0 {
_, err = c.InsertLabelsBuilder(TypeWorkspaceTemplateVersion, workspaceTemplateVersionID, workspaceTemplate.Labels).
RunWith(tx).
Exec()
if err != nil {
return nil, err
}
}
if err := tx.Commit(); err != nil {
return nil, err
}
@@ -687,8 +799,11 @@ func (c *Client) UpdateWorkspaceTemplate(namespace string, workspaceTemplate *Wo
func (c *Client) ListWorkspaceTemplates(namespace string, paginator *pagination.PaginationRequest) (workspaceTemplates []*WorkspaceTemplate, err error) {
sb := c.workspaceTemplatesSelectBuilder(namespace).
Where(sq.Eq{
"wt.is_archived": false,
}).
OrderBy("wt.created_at DESC")
paginator.ApplyToSelect(&sb)
sb = *paginator.ApplyToSelect(&sb)
query, args, err := sb.ToSql()
if err != nil {
@@ -718,6 +833,19 @@ func (c *Client) ListWorkspaceTemplateVersions(namespace, uid string) (workspace
return
}
ids := WorkspaceTemplatesToVersionIds(workspaceTemplates)
labelsMap, err := c.GetDbLabelsMapped(TypeWorkspaceTemplateVersion, ids...)
if err != nil {
return nil, err
}
for _, workspaceTemplate := range workspaceTemplates {
if labels, ok := labelsMap[workspaceTemplate.WorkspaceTemplateVersionID]; ok {
workspaceTemplate.Labels = labels
}
}
return
}
@@ -725,10 +853,137 @@ func (c *Client) CountWorkspaceTemplates(namespace string) (count int, err error
err = sb.Select("count(*)").
From("workspace_templates wt").
Where(sq.Eq{
"wt.namespace": namespace,
}).RunWith(c.DB).
"wt.namespace": namespace,
"wt.is_archived": false,
}).
RunWith(c.DB).
QueryRow().
Scan(&count)
return
}
// archiveWorkspaceTemplateDB marks the Workspace template identified by (namespace, uid) and is_archived=false, as archived.
//
// This method returns (true, nil) when the database record was successfully archived.
// If there was no record to archive, (false, nil) is returned.
func (c *Client) archiveWorkspaceTemplateDB(namespace, uid string) (archived bool, err error) {
result, err := sb.Update("workspace_templates").
Set("is_archived", true).
Where(sq.Eq{
"uid": uid,
"namespace": namespace,
"is_archived": false,
}).
RunWith(c.DB).
Exec()
if err != nil {
return false, err
}
rowsAffected, err := result.RowsAffected()
if err != nil {
return false, err
}
if rowsAffected == 0 {
return false, nil
}
return true, nil
}
// WorkspaceTemplateHasRunningWorkspaces returns true if there are non-terminated (or terminating) workspaces that are
// based of this template. False otherwise.
func (c *Client) WorkspaceTemplateHasRunningWorkspaces(namespace string, uid string) (bool, error) {
runningCount := 0
err := sb.Select("COUNT(*)").
From("workspaces w").
Join("workspace_templates wt ON wt.id = w.workspace_template_id").
Where(sq.And{
sq.Eq{
"wt.namespace": namespace,
"wt.uid": uid,
}, sq.NotEq{
"w.phase": []string{"Terminated"},
}}).
RunWith(c.DB).
QueryRow().
Scan(&runningCount)
if err != nil {
return false, err
}
return runningCount > 0, nil
}
// ArchiveWorkspaceTemplate archives and deletes resources associated with the workspace template.
//
// In particular, this action
//
// * Code retrieves all un-archived workspace template versions.
//
// * Iterates through each version, grabbing all related workspaces.
// - Each workspace is archived (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 (c *Client) ArchiveWorkspaceTemplate(namespace string, uid string) (archived bool, err error) {
wsTemps, err := c.ListWorkspaceTemplateVersions(namespace, uid)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("ListWorkspaceTemplateVersions failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workspace template.")
}
for _, wsTemp := range wsTemps {
wsList, err := c.ListWorkspacesByTemplateID(namespace, wsTemp.WorkspaceTemplateVersionID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("ListWorkspacesByTemplateId failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workspace template.")
}
for _, ws := range wsList {
err = c.ArchiveWorkspace(namespace, ws.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("ArchiveWorkspace failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workspace template.")
}
}
_, err = c.archiveWorkspaceTemplateDB(namespace, wsTemp.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Archive Workspace Template DB Failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workspace template.")
}
_, err = c.ArchiveWorkflowTemplate(namespace, wsTemp.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
"UID": uid,
"Error": err.Error(),
}).Error("Archive Workflow Template Failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workspace template.")
}
}
return true, nil
}

View File

@@ -1,27 +1,44 @@
package v1
import (
"github.com/google/uuid"
"time"
)
type WorkspaceTemplate struct {
ID uint64
UID string
Name string `valid:"stringlength(3|63)~Name should be between 3 to 63 characters,required"`
Version int64
Manifest string
IsLatest bool
CreatedAt time.Time `db:"created_at"`
WorkflowTemplate *WorkflowTemplate `db:"workflow_template"`
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 (wt *WorkspaceTemplate) GenerateUID() (string, error) {
uid, err := uuid.NewRandom()
if err != nil {
return "", err
func WorkspaceTemplatesToVersionIds(resources []*WorkspaceTemplate) (ids []uint64) {
mappedIds := make(map[uint64]bool)
// This is to make sure we don't have duplicates
for _, resource := range resources {
mappedIds[resource.WorkspaceTemplateVersionID] = true
}
wt.UID = uid.String()
return wt.UID, nil
for id := range mappedIds {
ids = append(ids, id)
}
return
}
// returns all of the columns for workspace template modified by alias, destination.
// see formatColumnSelect
func getWorkspaceTemplateColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"id", "uid", "created_at", "modified_at", "name", "namespace", "is_archived", "workflow_template_id"}
return formatColumnSelect(columns, alias, destination, extraColumns...)
}

View File

@@ -11,8 +11,9 @@ type WorkspacePhase string
// Workspace phases
const (
WorkspaceStarted WorkspacePhase = "Started"
WorkspaceLaunching WorkspacePhase = "Launching"
WorkspaceRunning WorkspacePhase = "Running"
WorkspaceUpdating WorkspacePhase = "Updating"
WorkspacePausing WorkspacePhase = "Pausing"
WorkspacePaused WorkspacePhase = "Paused"
WorkspaceTerminating WorkspacePhase = "Terminating"
@@ -20,30 +21,29 @@ const (
)
type WorkspaceStatus struct {
Phase WorkspacePhase
StartedAt *time.Time `db:"started_at"`
PausedAt *time.Time `db:"paused_at"`
TerminatedAt *time.Time `db:"terminated_at"`
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 Workspace struct {
ID uint64
Namespace string
UID string
Name string `valid:"stringlength(3|63)~Name should be between 3 to 63 characters,dns,required"`
UID string `valid:"stringlength(3|30)~UID should be between 3 to 30 characters,dns,required"`
Name string `valid:"stringlength(3|30)~Name should be between 3 to 30 characters,required"`
Labels map[string]string
Phase string
Parameters []Parameter
ParametersBytes []byte `db:"parameters"` // to load from database
Status WorkspaceStatus
CreatedAt time.Time `db:"created_at"`
ModifiedAt *time.Time `db:"modified_at"`
StartedAt *time.Time `db:"started_at"`
PausedAt *time.Time `db:"paused_at"`
TerminatedAt *time.Time `db:"terminated_at"`
WorkspaceTemplate *WorkspaceTemplate `db:"workspace_template" valid:"-"`
WorkspaceTemplateID uint64 `db:"workspace_template_id"`
WorkspaceTemplateVersion uint64 `db:"workspace_template_version"`
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"`
URL string `db:"url"` // the path to the workspace, a url that you can access via http
WorkflowTemplateVersion *WorkflowTemplateVersion `db:"workflow_template_version"` // helper to store data from workflow template version
}
type WorkspaceSpec struct {
@@ -53,3 +53,17 @@ type WorkspaceSpec struct {
Routes []*networking.HTTPRoute `json:"routes" protobuf:"bytes,5,opt,name=routes"`
PostExecutionWorkflow *wfv1.WorkflowTemplateSpec `json:"postExecutionWorkflow" protobuf:"bytes,6,opt,name=postExecutionWorkflow"`
}
// returns all of the columns for workspace modified by alias, destination.
// see formatColumnSelect
func getWorkspaceColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"id", "created_at", "modified_at", "uid", "name", "namespace", "parameters", "workspace_template_id", "workspace_template_version", "url"}
return formatColumnSelect(columns, alias, destination, extraColumns...)
}
// returns all of the columns for WorkspaceStatus modified by alias, destination.
// see formatColumnSelect
func getWorkspaceStatusColumns(alias string, destination string, extraColumns ...string) []string {
columns := []string{"phase", "started_at", "paused_at", "terminated_at"}
return formatColumnSelect(columns, alias, destination, extraColumns...)
}

View File

@@ -3,7 +3,6 @@ package auth
import (
"context"
"errors"
"fmt"
"github.com/onepanelio/core/api"
"net/http"
"strings"
@@ -111,20 +110,16 @@ func UnaryInterceptor(kubeConfig *v1.Config, db *v1.DB) grpc.UnaryServerIntercep
// if you don't need the token,
if info.FullMethod == "/api.AuthService/IsWorkspaceAuthenticated" {
md, ok := metadata.FromIncomingContext(ctx)
fmt.Printf("%+v\n", md) //todo remove
if !ok {
ctx = nil
return handler(ctx, req)
}
xOriginalAuthority := md.Get("x-original-authority")[0]
authToken := md.Get("authorization")
fqdn := md.Get("fqdn")[0]
//expected format: https://nginx-0--default.test-0.onepanel.site/
if xOriginalAuthority != fqdn { //Ignore fully qualified domain uris
ctx, err = getClient(ctx, kubeConfig, db)
if err != nil {
return
}
//len = 0 when user logged out or hasn't logged in yet
if len(authToken) == 0 && xOriginalAuthority == fqdn {
ctx = nil
return handler(ctx, req)
}
}

View File

@@ -19,6 +19,10 @@ func NewAuthServer() *AuthServer {
return &AuthServer{}
}
func (a *AuthServer) IsWorkspaceAuthenticated(ctx context.Context, request *api.IsWorkspaceAuthenticatedRequest) (*empty.Empty, error) {
if ctx == nil {
return &empty.Empty{}, nil
}
client := ctx.Value("kubeClient").(*v1.Client)
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return &empty.Empty{}, errors.New("Error parsing headers.")
@@ -35,14 +39,36 @@ func (a *AuthServer) IsWorkspaceAuthenticated(ctx context.Context, request *api.
}
workspaceAndNamespace := xOriginalAuth[0:pos]
pieces := strings.Split(workspaceAndNamespace, "--")
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, pieces[1], "create", "apps/v1", "statefulsets", pieces[0])
if err != nil || !allowed {
_, err := auth.IsAuthorized(client, pieces[1], "create", "apps", "statefulsets", pieces[0])
if err != nil {
return &empty.Empty{}, err
}
return &empty.Empty{}, nil
}
func (a *AuthServer) IsAuthorized(ctx context.Context, request *api.IsAuthorizedRequest) (res *api.IsAuthorizedResponse, err error) {
res = &api.IsAuthorizedResponse{}
if ctx == nil {
res.Authorized = false
return res, status.Error(codes.Unauthenticated, "Unauthenticated.")
}
//User auth check
client := ctx.Value("kubeClient").(*v1.Client)
err = a.isValidToken(err, client)
if err != nil {
return nil, err
}
//Check the request
allowed, err := auth.IsAuthorized(client, request.Namespace, request.Verb, request.Group, request.Resource, request.ResourceName)
if err != nil {
res.Authorized = false
return res, err
}
res.Authorized = allowed
return res, nil
}
func (a *AuthServer) IsValidToken(ctx context.Context, req *api.IsValidTokenRequest) (res *api.IsValidTokenResponse, err error) {
if ctx == nil {
return nil, status.Error(codes.Unauthenticated, "Unauthenticated.")
@@ -50,27 +76,11 @@ func (a *AuthServer) IsValidToken(ctx context.Context, req *api.IsValidTokenRequ
client := ctx.Value("kubeClient").(*v1.Client)
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
if err.Error() == "Unauthorized" {
return nil, status.Error(codes.Unauthenticated, "Unauthenticated.")
}
return nil, err
}
if len(namespaces) == 0 {
return nil, errors.New("No namespaces for onepanel setup.")
}
namespace := namespaces[0]
allowed, err := auth.IsAuthorized(client, "", "get", "", "namespaces", namespace.Name)
err = a.isValidToken(err, client)
if err != nil {
return nil, err
}
if !allowed {
return nil, status.Error(codes.Unauthenticated, "Unauthenticated.")
}
config, err := client.GetSystemConfig()
if err != nil {
return
@@ -80,3 +90,27 @@ func (a *AuthServer) IsValidToken(ctx context.Context, req *api.IsValidTokenRequ
return res, nil
}
func (a *AuthServer) isValidToken(err error, client *v1.Client) error {
namespaces, err := client.ListOnepanelEnabledNamespaces()
if err != nil {
if err.Error() == "Unauthorized" {
return status.Error(codes.Unauthenticated, "Unauthenticated.")
}
return err
}
if len(namespaces) == 0 {
return errors.New("No namespaces for onepanel setup.")
}
namespace := namespaces[0]
allowed, err := auth.IsAuthorized(client, "", "get", "", "namespaces", namespace.Name)
if err != nil {
return err
}
if !allowed {
return status.Error(codes.Unauthenticated, "Unauthenticated.")
}
return nil
}

View File

@@ -3,6 +3,7 @@ package converter
import (
"github.com/onepanelio/core/api"
v1 "github.com/onepanelio/core/pkg"
"sort"
)
func APIKeyValueToLabel(apiKeyValues []*api.KeyValue) map[string]string {
@@ -28,10 +29,14 @@ func MappingToKeyValue(mapping map[string]string) []*api.KeyValue {
})
}
sort.Slice(keyValues, func(i, j int) bool {
return keyValues[i].Key < keyValues[j].Key
})
return keyValues
}
func ParameterOptionToAPI(option v1.ParameterOption) *api.ParameterOption {
func ParameterOptionToAPI(option *v1.ParameterOption) *api.ParameterOption {
apiOption := &api.ParameterOption{
Name: option.Name,
Value: option.Value,
@@ -40,11 +45,31 @@ func ParameterOptionToAPI(option v1.ParameterOption) *api.ParameterOption {
return apiOption
}
func APIParameterOptionToInternal(option *api.ParameterOption) *v1.ParameterOption {
result := &v1.ParameterOption{
Name: option.Name,
Value: option.Value,
}
return result
}
func ParameterOptionsToAPI(options []*v1.ParameterOption) []*api.ParameterOption {
result := make([]*api.ParameterOption, len(options))
for i := range options {
newItem := ParameterOptionToAPI(*options[i])
newItem := ParameterOptionToAPI(options[i])
result[i] = newItem
}
return result
}
func APIParameterOptionsToInternal(options []*api.ParameterOption) []*v1.ParameterOption {
result := make([]*v1.ParameterOption, len(options))
for i := range options {
newItem := APIParameterOptionToInternal(options[i])
result[i] = newItem
}
@@ -85,3 +110,27 @@ func ParametersToAPI(params []v1.Parameter) []*api.Parameter {
return result
}
func APIParameterToInternal(param *api.Parameter) *v1.Parameter {
result := &v1.Parameter{
Name: param.Name,
Type: param.Type,
Required: param.Required,
}
if param.Value != "" {
result.Value = &param.Value
}
if param.DisplayName != "" {
result.DisplayName = &param.DisplayName
}
if param.Hint != "" {
result.Hint = &param.Hint
}
if param.Options != nil {
result.Options = APIParameterOptionsToInternal(param.Options)
}
return result
}

View File

@@ -23,9 +23,11 @@ func apiCronWorkflow(cwf *v1.CronWorkflow) (cronWorkflow *api.CronWorkflow) {
}
cronWorkflow = &api.CronWorkflow{
Name: cwf.Name,
Labels: converter.MappingToKeyValue(cwf.Labels),
Manifest: cwf.Manifest,
Name: cwf.Name,
Uid: cwf.UID,
Labels: converter.MappingToKeyValue(cwf.Labels),
Manifest: cwf.Manifest,
Namespace: cwf.Namespace,
}
if cwf.WorkflowExecution != nil {
@@ -79,6 +81,7 @@ func (c *CronWorkflowServer) CreateCronWorkflow(ctx context.Context, req *api.Cr
WorkflowExecution: workflow,
Manifest: req.CronWorkflow.Manifest,
Labels: converter.APIKeyValueToLabel(req.CronWorkflow.Labels),
Namespace: req.Namespace,
}
cwf, err := client.CreateCronWorkflow(req.Namespace, &cronWorkflow)
@@ -125,9 +128,10 @@ func (c *CronWorkflowServer) UpdateCronWorkflow(ctx context.Context, req *api.Up
WorkflowExecution: workflow,
Manifest: req.CronWorkflow.Manifest,
Labels: converter.APIKeyValueToLabel(req.CronWorkflow.Labels),
Namespace: req.Namespace,
}
cwf, err := client.UpdateCronWorkflow(req.Namespace, req.Name, &cronWorkflow)
cwf, err := client.UpdateCronWorkflow(req.Namespace, req.Uid, &cronWorkflow)
if err != nil {
return nil, err
}
@@ -139,11 +143,11 @@ func (c *CronWorkflowServer) UpdateCronWorkflow(ctx context.Context, req *api.Up
func (c *CronWorkflowServer) GetCronWorkflow(ctx context.Context, req *api.GetCronWorkflowRequest) (*api.CronWorkflow, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "cronworkflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "cronworkflows", req.Uid)
if err != nil || !allowed {
return nil, err
}
cwf, err := client.GetCronWorkflow(req.Namespace, req.Name)
cwf, err := client.GetCronWorkflow(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
@@ -181,14 +185,14 @@ func (c *CronWorkflowServer) ListCronWorkflows(ctx context.Context, req *api.Lis
}, nil
}
func (c *CronWorkflowServer) TerminateCronWorkflow(ctx context.Context, req *api.TerminateCronWorkflowRequest) (*empty.Empty, error) {
func (c *CronWorkflowServer) DeleteCronWorkflow(ctx context.Context, req *api.DeleteCronWorkflowRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "delete", "argoproj.io", "cronworkflows", "")
if err != nil || !allowed {
return nil, err
}
err = client.TerminateCronWorkflow(req.Namespace, req.Name)
err = client.TerminateCronWorkflow(req.Namespace, req.Uid)
if err != nil {
return nil, err
}

View File

@@ -17,6 +17,8 @@ func resourceIdentifierToArgoResource(identifier string) string {
return "workflows"
case v1.TypeCronWorkflow:
return "cronworkflows"
case v1.TypeWorkspace:
return "statefulset"
}
return ""

View File

@@ -3,11 +3,12 @@ package server
import (
"context"
"github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
"github.com/onepanelio/core/pkg/util"
"github.com/onepanelio/core/pkg/util/pagination"
"github.com/onepanelio/core/server/converter"
"google.golang.org/grpc/codes"
argov1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sort"
"strings"
"time"
@@ -32,10 +33,11 @@ func GenApiWorkflowExecution(wf *v1.WorkflowExecution) (workflow *api.WorkflowEx
func apiWorkflowExecution(wf *v1.WorkflowExecution) (workflow *api.WorkflowExecution) {
workflow = &api.WorkflowExecution{
CreatedAt: wf.CreatedAt.Format(time.RFC3339),
Name: wf.Name,
Uid: wf.UID,
Name: wf.Name,
Phase: string(wf.Phase),
Manifest: wf.Manifest,
Labels: converter.MappingToKeyValue(wf.Labels),
}
if wf.StartedAt != nil && !wf.StartedAt.IsZero() {
@@ -69,13 +71,13 @@ func (s *WorkflowServer) CreateWorkflowExecution(ctx context.Context, req *api.C
}
workflow := &v1.WorkflowExecution{
Labels: converter.APIKeyValueToLabel(req.WorkflowExecution.Labels),
Labels: converter.APIKeyValueToLabel(req.Body.Labels),
WorkflowTemplate: &v1.WorkflowTemplate{
UID: req.WorkflowExecution.WorkflowTemplate.Uid,
Version: req.WorkflowExecution.WorkflowTemplate.Version,
UID: req.Body.WorkflowTemplateUid,
Version: req.Body.WorkflowTemplateVersion,
},
}
for _, param := range req.WorkflowExecution.Parameters {
for _, param := range req.Body.Parameters {
workflow.Parameters = append(workflow.Parameters, v1.Parameter{
Name: param.Name,
Value: ptr.String(param.Value),
@@ -97,7 +99,7 @@ func (s *WorkflowServer) CloneWorkflowExecution(ctx context.Context, req *api.Cl
return nil, err
}
wf, err := client.CloneWorkflowExecution(req.Namespace, req.Name)
wf, err := client.CloneWorkflowExecution(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
@@ -112,12 +114,13 @@ func (s *WorkflowServer) AddWorkflowExecutionStatistics(ctx context.Context, req
phase = v1alpha1.NodeSucceeded
}
workflow, err := client.ArgoprojV1alpha1().Workflows(req.Namespace).Get(req.Name, argov1.GetOptions{})
// TODO: This needs to be moved to pkg
workflow, err := client.ArgoprojV1alpha1().Workflows(req.Namespace).Get(req.Uid, metav1.GetOptions{})
if err != nil {
return &empty.Empty{}, err
}
err = client.FinishWorkflowExecutionStatisticViaExitHandler(req.Namespace, req.Name,
err = client.FinishWorkflowExecutionStatisticViaExitHandler(req.Namespace, req.Uid,
req.Statistics.WorkflowTemplateId, phase, workflow.Status.StartedAt.UTC())
if err != nil {
@@ -131,12 +134,12 @@ func (s *WorkflowServer) AddWorkflowExecutionStatistics(ctx context.Context, req
// all required data.
func (s *WorkflowServer) CronStartWorkflowExecutionStatistic(ctx context.Context, req *api.CronStartWorkflowExecutionStatisticRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}
err = client.CronStartWorkflowExecutionStatisticInsert(req.Namespace, req.Name, req.Statistics.WorkflowTemplateId)
err = client.CronStartWorkflowExecutionStatisticInsert(req.Namespace, req.Uid, req.Statistics.WorkflowTemplateId)
if err != nil {
return &empty.Empty{}, err
}
@@ -146,39 +149,40 @@ func (s *WorkflowServer) CronStartWorkflowExecutionStatistic(ctx context.Context
func (s *WorkflowServer) GetWorkflowExecution(ctx context.Context, req *api.GetWorkflowExecutionRequest) (*api.WorkflowExecution, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return nil, err
}
wf, err := client.GetWorkflowExecution(req.Namespace, req.Name)
wf, err := client.GetWorkflowExecution(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
mappedLabels, err := client.GetDbLabelsMapped(v1.TypeWorkflowExecution, wf.ID)
if err != nil {
return nil, err
}
if labels, ok := mappedLabels[wf.ID]; ok {
wf.Labels = labels
}
return apiWorkflowExecution(wf), nil
}
func (s *WorkflowServer) WatchWorkflowExecution(req *api.WatchWorkflowExecutionRequest, stream api.WorkflowService_WatchWorkflowExecutionServer) error {
client := stream.Context().Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return err
}
watcher, err := client.WatchWorkflowExecution(req.Namespace, req.Name)
watcher, err := client.WatchWorkflowExecution(req.Namespace, req.Uid)
if err != nil {
return err
}
wf := &v1.WorkflowExecution{}
ticker := time.NewTicker(time.Second)
for {
select {
case wf = <-watcher:
case <-ticker.C:
}
for wf := range watcher {
if wf == nil {
break
}
@@ -192,12 +196,12 @@ func (s *WorkflowServer) WatchWorkflowExecution(req *api.WatchWorkflowExecutionR
func (s *WorkflowServer) GetWorkflowExecutionLogs(req *api.GetWorkflowExecutionLogsRequest, stream api.WorkflowService_GetWorkflowExecutionLogsServer) error {
client := stream.Context().Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return err
}
watcher, err := client.GetWorkflowExecutionLogs(req.Namespace, req.Name, req.PodName, req.ContainerName)
watcher, err := client.GetWorkflowExecutionLogs(req.Namespace, req.Uid, req.PodName, req.ContainerName)
if err != nil {
return err
}
@@ -222,12 +226,12 @@ func (s *WorkflowServer) GetWorkflowExecutionLogs(req *api.GetWorkflowExecutionL
func (s *WorkflowServer) GetWorkflowExecutionMetrics(ctx context.Context, req *api.GetWorkflowExecutionMetricsRequest) (*api.GetWorkflowExecutionMetricsResponse, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return nil, err
}
metrics, err := client.GetWorkflowExecutionMetrics(req.Namespace, req.Name, req.PodName)
metrics, err := client.GetWorkflowExecutionMetrics(req.Namespace, req.Uid, req.PodName)
if err != nil {
return nil, err
}
@@ -281,12 +285,12 @@ func (s *WorkflowServer) ListWorkflowExecutions(ctx context.Context, req *api.Li
func (s *WorkflowServer) ResubmitWorkflowExecution(ctx context.Context, req *api.ResubmitWorkflowExecutionRequest) (*api.WorkflowExecution, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "create", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "create", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return nil, err
}
wf, err := client.ResubmitWorkflowExecution(req.Namespace, req.Name)
wf, err := client.ResubmitWorkflowExecution(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
@@ -301,7 +305,7 @@ func (s *WorkflowServer) TerminateWorkflowExecution(ctx context.Context, req *ap
return nil, err
}
err = client.TerminateWorkflowExecution(req.Namespace, req.Name)
err = client.TerminateWorkflowExecution(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
@@ -311,12 +315,12 @@ func (s *WorkflowServer) TerminateWorkflowExecution(ctx context.Context, req *ap
func (s *WorkflowServer) GetArtifact(ctx context.Context, req *api.GetArtifactRequest) (*api.ArtifactResponse, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return nil, err
}
data, err := client.GetArtifact(req.Namespace, req.Name, req.Key)
data, err := client.GetArtifact(req.Namespace, req.Uid, req.Key)
if err != nil {
return nil, err
}
@@ -328,7 +332,7 @@ func (s *WorkflowServer) GetArtifact(ctx context.Context, req *api.GetArtifactRe
func (s *WorkflowServer) ListFiles(ctx context.Context, req *api.ListFilesRequest) (*api.ListFilesResponse, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return nil, err
}
@@ -369,3 +373,18 @@ func (s *WorkflowServer) ListFiles(ctx context.Context, req *api.ListFilesReques
ParentPath: parentPath,
}, nil
}
func (s *WorkflowServer) UpdateWorkflowExecutionStatus(ctx context.Context, req *api.UpdateWorkflowExecutionStatusRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "argoproj.io", "workflows", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}
status := &v1.WorkflowExecutionStatus{
Phase: wfv1.NodePhase(req.Status.Phase),
}
err = client.UpdateWorkflowExecutionStatus(req.Namespace, req.Uid, status)
return &empty.Empty{}, err
}

View File

@@ -31,6 +31,10 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate {
Labels: converter.MappingToKeyValue(wft.Labels),
}
if wft.ModifiedAt != nil {
res.ModifiedAt = wft.ModifiedAt.UTC().Format(time.RFC3339)
}
if wft.WorkflowExecutionStatisticReport != nil {
res.Stats = &api.WorkflowExecutionStatisticReport{
Total: wft.WorkflowExecutionStatisticReport.Total,
@@ -38,6 +42,7 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate {
Running: wft.WorkflowExecutionStatisticReport.Running,
Completed: wft.WorkflowExecutionStatisticReport.Completed,
Failed: wft.WorkflowExecutionStatisticReport.Failed,
Terminated: wft.WorkflowExecutionStatisticReport.Terminated,
}
}
@@ -50,20 +55,6 @@ func apiWorkflowTemplate(wft *v1.WorkflowTemplate) *api.WorkflowTemplate {
return res
}
func mapToKeyValue(input map[string]string) []*api.KeyValue {
var result []*api.KeyValue
for key, value := range input {
keyValue := &api.KeyValue{
Key: key,
Value: value,
}
result = append(result, keyValue)
}
return result
}
func (s *WorkflowTemplateServer) CreateWorkflowTemplate(ctx context.Context, req *api.CreateWorkflowTemplateRequest) (*api.WorkflowTemplate, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "create", "argoproj.io", "workflowtemplates", "")
@@ -103,6 +94,11 @@ func (s *WorkflowTemplateServer) CreateWorkflowTemplateVersion(ctx context.Conte
if err != nil {
return nil, err
}
if _, err := client.InsertLabels(v1.TypeWorkflowTemplateVersion, workflowTemplate.WorkflowTemplateVersionId, workflowTemplate.Labels); err != nil {
return nil, err
}
req.WorkflowTemplate.Uid = workflowTemplate.UID
req.WorkflowTemplate.Name = workflowTemplate.Name
req.WorkflowTemplate.Version = workflowTemplate.Version
@@ -143,6 +139,12 @@ func (s *WorkflowTemplateServer) GetWorkflowTemplate(ctx context.Context, req *a
return nil, err
}
versionsCount, err := client.CountWorkflowTemplateVersions(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
workflowTemplate.Versions = int64(versionsCount)
return apiWorkflowTemplate(workflowTemplate), nil
}

View File

@@ -8,16 +8,46 @@ import (
"github.com/onepanelio/core/pkg/util/pagination"
"github.com/onepanelio/core/pkg/util/ptr"
"github.com/onepanelio/core/server/auth"
"github.com/onepanelio/core/server/converter"
"strings"
"time"
)
type WorkspaceServer struct{}
func apiWorkspace(wt *v1.Workspace) *api.Workspace {
func apiWorkspace(wt *v1.Workspace, config map[string]string) *api.Workspace {
protocol := "http://"
onepanelApiUrl := config["ONEPANEL_API_URL"]
if strings.HasPrefix(onepanelApiUrl, "https://") {
protocol = "https://"
}
res := &api.Workspace{
Uid: wt.UID,
Name: wt.Name,
CreatedAt: wt.CreatedAt.UTC().Format(time.RFC3339),
Url: protocol + wt.URL,
}
res.Parameters = converter.ParametersToAPI(wt.Parameters)
res.Status = &api.WorkspaceStatus{
Phase: string(wt.Status.Phase),
}
if wt.Status.StartedAt != nil {
res.Status.StartedAt = wt.Status.StartedAt.UTC().Format(time.RFC3339)
}
if wt.Status.PausedAt != nil {
res.Status.PausedAt = wt.Status.PausedAt.UTC().Format(time.RFC3339)
}
if wt.Status.TerminatedAt != nil {
res.Status.TerminatedAt = wt.Status.TerminatedAt.UTC().Format(time.RFC3339)
}
if len(wt.Labels) > 0 {
res.Labels = converter.MappingToKeyValue(wt.Labels)
}
if wt.WorkspaceTemplate != nil {
@@ -39,31 +69,77 @@ func (s *WorkspaceServer) CreateWorkspace(ctx context.Context, req *api.CreateWo
}
workspace := &v1.Workspace{
Name: req.Workspace.Name,
WorkspaceTemplate: &v1.WorkspaceTemplate{
UID: req.Workspace.WorkspaceTemplate.Uid,
Version: req.Workspace.WorkspaceTemplate.Version,
UID: req.Body.WorkspaceTemplateUid,
Version: req.Body.WorkspaceTemplateVersion,
},
Labels: converter.APIKeyValueToLabel(req.Body.Labels),
}
for _, param := range req.Workspace.Parameters {
for _, param := range req.Body.Parameters {
if param.Type == "input.hidden" {
continue
}
if param.Name == "sys-name" {
workspace.Name = param.Value
}
workspace.Parameters = append(workspace.Parameters, v1.Parameter{
Name: param.Name,
Value: ptr.String(param.Value),
})
}
workspace, err = client.CreateWorkspace(req.Namespace, workspace)
if err != nil {
return nil, err
}
req.Workspace = apiWorkspace(workspace)
sysConfig, err := client.GetSystemConfig()
if err != nil {
return nil, err
}
return req.Workspace, nil
apiWorkspace := apiWorkspace(workspace, sysConfig)
return apiWorkspace, nil
}
func (s *WorkspaceServer) GetWorkspace(ctx context.Context, req *api.GetWorkspaceRequest) (*api.Workspace, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "get", "apps", "statefulsets", "")
if err != nil || !allowed {
return nil, err
}
workspace, err := client.GetWorkspace(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
sysConfig, err := client.GetSystemConfig()
if err != nil {
return nil, err
}
apiWorkspace := apiWorkspace(workspace, sysConfig)
// We add the template parameters because they have additional information on the options for certain parameters.
// e.g. select types need to know the options so they can display them, and the selected option properly.
templateParameters, err := v1.ParseParametersFromManifest([]byte(workspace.WorkflowTemplateVersion.Manifest))
if err != nil {
return nil, err
}
apiWorkspace.TemplateParameters = converter.ParametersToAPI(templateParameters)
return apiWorkspace, nil
}
func (s *WorkspaceServer) UpdateWorkspaceStatus(ctx context.Context, req *api.UpdateWorkspaceStatusRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "apps", "statefulsets", "")
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "apps", "statefulsets", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}
@@ -76,6 +152,29 @@ func (s *WorkspaceServer) UpdateWorkspaceStatus(ctx context.Context, req *api.Up
return &empty.Empty{}, err
}
func (s *WorkspaceServer) UpdateWorkspace(ctx context.Context, req *api.UpdateWorkspaceRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "apps", "statefulsets", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}
var parameters []v1.Parameter
for _, param := range req.Body.Parameters {
if param.Type == "input.hidden" {
continue
}
parameters = append(parameters, v1.Parameter{
Name: param.Name,
Value: ptr.String(param.Value),
})
}
err = client.UpdateWorkspace(req.Namespace, req.Uid, parameters)
return &empty.Empty{}, err
}
func (s *WorkspaceServer) ListWorkspaces(ctx context.Context, req *api.ListWorkspaceRequest) (*api.ListWorkspaceResponse, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "list", "argoproj.io", "statefulsets", "")
@@ -89,20 +188,32 @@ func (s *WorkspaceServer) ListWorkspaces(ctx context.Context, req *api.ListWorks
return nil, err
}
sysConfig, err := client.GetSystemConfig()
if err != nil {
return nil, err
}
var apiWorkspaces []*api.Workspace
for _, w := range workspaces {
apiWorkspaces = append(apiWorkspaces, apiWorkspace(w))
apiWorkspaces = append(apiWorkspaces, apiWorkspace(w, sysConfig))
}
count, err := client.CountWorkspaces(req.Namespace)
if err != nil {
return nil, err
}
return &api.ListWorkspaceResponse{
Count: int32(len(apiWorkspaces)),
Workspaces: apiWorkspaces,
Page: int32(paginator.Page),
Pages: paginator.CalculatePages(count),
TotalCount: int32(count),
}, nil
}
func (s *WorkspaceServer) PauseWorkspace(ctx context.Context, req *api.PauseWorkspaceRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "apps", "statefulsets", "")
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "apps", "statefulsets", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}
@@ -112,9 +223,21 @@ func (s *WorkspaceServer) PauseWorkspace(ctx context.Context, req *api.PauseWork
return &empty.Empty{}, err
}
func (s *WorkspaceServer) ResumeWorkspace(ctx context.Context, req *api.ResumeWorkspaceRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "apps", "statefulsets", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}
err = client.ResumeWorkspace(req.Namespace, req.Uid)
return &empty.Empty{}, err
}
func (s *WorkspaceServer) DeleteWorkspace(ctx context.Context, req *api.DeleteWorkspaceRequest) (*empty.Empty, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "delete", "apps", "statefulsets", "")
allowed, err := auth.IsAuthorized(client, req.Namespace, "delete", "apps", "statefulsets", req.Uid)
if err != nil || !allowed {
return &empty.Empty{}, err
}

View File

@@ -4,8 +4,11 @@ import (
"context"
"github.com/onepanelio/core/api"
v1 "github.com/onepanelio/core/pkg"
"github.com/onepanelio/core/pkg/util"
"github.com/onepanelio/core/pkg/util/pagination"
"github.com/onepanelio/core/server/auth"
"github.com/onepanelio/core/server/converter"
"google.golang.org/grpc/codes"
"time"
)
@@ -19,6 +22,7 @@ func apiWorkspaceTemplate(wt *v1.WorkspaceTemplate) *api.WorkspaceTemplate {
Manifest: wt.Manifest,
IsLatest: wt.IsLatest,
CreatedAt: wt.CreatedAt.UTC().Format(time.RFC3339),
Labels: converter.MappingToKeyValue(wt.Labels),
}
if wt.WorkflowTemplate != nil {
@@ -69,6 +73,7 @@ func (s *WorkspaceTemplateServer) CreateWorkspaceTemplate(ctx context.Context, r
workspaceTemplate := &v1.WorkspaceTemplate{
Name: req.WorkspaceTemplate.Name,
Manifest: req.WorkspaceTemplate.Manifest,
Labels: converter.APIKeyValueToLabel(req.WorkspaceTemplate.Labels),
}
workspaceTemplate, err = client.CreateWorkspaceTemplate(req.Namespace, workspaceTemplate)
if err != nil {
@@ -82,14 +87,15 @@ func (s *WorkspaceTemplateServer) CreateWorkspaceTemplate(ctx context.Context, r
func (s *WorkspaceTemplateServer) UpdateWorkspaceTemplate(ctx context.Context, req *api.UpdateWorkspaceTemplateRequest) (*api.WorkspaceTemplate, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "argoproj.io", "workflowtemplates", req.Name)
allowed, err := auth.IsAuthorized(client, req.Namespace, "update", "argoproj.io", "workflowtemplates", req.Uid)
if err != nil || !allowed {
return nil, err
}
workspaceTemplate := &v1.WorkspaceTemplate{
Name: req.Name,
UID: req.Uid,
Manifest: req.WorkspaceTemplate.Manifest,
Labels: converter.APIKeyValueToLabel(req.WorkspaceTemplate.Labels),
}
workspaceTemplate, err = client.UpdateWorkspaceTemplate(req.Namespace, workspaceTemplate)
if err != nil {
@@ -170,3 +176,28 @@ func (s *WorkspaceTemplateServer) ListWorkspaceTemplateVersions(ctx context.Cont
WorkspaceTemplates: workspaceTemplates,
}, nil
}
func (s *WorkspaceTemplateServer) ArchiveWorkspaceTemplate(ctx context.Context, req *api.ArchiveWorkspaceTemplateRequest) (*api.WorkspaceTemplate, error) {
client := ctx.Value("kubeClient").(*v1.Client)
allowed, err := auth.IsAuthorized(client, req.Namespace, "delete", "argoproj.io", "workflowtemplates", "")
if err != nil || !allowed {
return nil, err
}
hasRunning, err := client.WorkspaceTemplateHasRunningWorkspaces(req.Namespace, req.Uid)
if err != nil {
return nil, util.NewUserError(codes.Unknown, "Unable to get check running workspaces")
}
if hasRunning {
return nil, util.NewUserError(codes.FailedPrecondition, "Unable to archive workspace template. There are running workspaces that use it.")
}
archived, err := client.ArchiveWorkspaceTemplate(req.Namespace, req.Uid)
if err != nil {
return nil, err
}
return &api.WorkspaceTemplate{
IsArchived: archived,
}, nil
}