Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add retry API for archived workflows. Fixes #7906 #7988

Merged
merged 30 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
40475a1
feat: add retry API for archived workflows
dpadhiar Feb 23, 2022
4d74854
chore: fixed lint errors and removed comments
dpadhiar Feb 24, 2022
95a88c0
fix: retryArchive flag check was set incorrectly
dpadhiar Feb 24, 2022
bbb1465
test: added test cases for retry wfarchive and wfarchiveserver
dpadhiar Feb 26, 2022
949ab6c
fix: changed method signature and removed comments
dpadhiar Feb 26, 2022
e419499
Merge branch 'master' into issue-5405
dpadhiar Feb 26, 2022
b46324c
fix: removed validateWorkflow() from WorkflowArchive
dpadhiar Feb 28, 2022
fe493ac
feat: refactored retryWorkflow into prepareWorkflowForRetry
dpadhiar Mar 1, 2022
15a2f77
refactor: remove RetryArchiveWorkflow and move wfClient update/create…
dpadhiar Mar 2, 2022
be9b1d9
chore: remove comments
dpadhiar Mar 2, 2022
cee8d76
fix: ignored AlreadyExists err for idempotence
dpadhiar Mar 2, 2022
aede75e
fix: dehydrate workflow in RetryWorkflow
dpadhiar Mar 2, 2022
a8d10b7
test: add e2e test for RetryArchiveWorkflow
dpadhiar Mar 3, 2022
7f41a18
test: fix syntax error for RetryArchiveWorkflow test
dpadhiar Mar 3, 2022
1eff8ed
test: update test for RetryArchivedWorkflow
dpadhiar Mar 3, 2022
3eb2c94
fix: change request for RetryArchivedWorkflow
dpadhiar Mar 3, 2022
0efff12
test: edited RetryArchivedWorkflow test
dpadhiar Mar 3, 2022
349aa9a
test: moved retry test before delete
dpadhiar Mar 4, 2022
bc29411
test: added failed workflow for testing RetryWorkflowArchive
dpadhiar Mar 5, 2022
0611e74
test: delete workflow before retrying from archive
dpadhiar Mar 7, 2022
4cf79b0
fix: resourceVersion must be set to nil to retry archivedWf
dpadhiar Mar 8, 2022
19b48ef
refactor: set resourceVersion to nil in util/RetryArchivedWorkflow
dpadhiar Mar 8, 2022
3fc7eaf
chore: merge master to resolve conflicts with resubmit commit
dpadhiar Mar 9, 2022
4a4493e
test: added RetryArchivedWorkflow test
dpadhiar Mar 10, 2022
51c4b5d
chore: remove wfClient from RetryWorkflow/RetryArchivedWorkflow methods
dpadhiar Mar 10, 2022
7fba704
chore: rerun codegen -B
dpadhiar Mar 10, 2022
8add77e
refactor: move pod deletion to server side and rename prepareWorkflow…
dpadhiar Mar 16, 2022
d619ebb
test: clean up
dpadhiar Mar 16, 2022
9cd4ab7
refactor: added structured logging and changed error check
dpadhiar Mar 17, 2022
68caea6
refactor: remove RetryWorkflow
dpadhiar Mar 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6584,6 +6584,26 @@
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest": {
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"nodeFieldSelector": {
"type": "string"
},
"restartSuccessful": {
"type": "boolean"
},
"uid": {
"type": "string"
}
},
"type": "object"
},
"io.argoproj.workflow.v1alpha1.RetryNodeAntiAffinity": {
"description": "RetryNodeAntiAffinity is a placeholder for future expansion, only empty nodeAntiAffinity is allowed. In order to prevent running steps on the same host, it uses \"kubernetes.io/hostname\".",
"type": "object"
Expand Down
64 changes: 64 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,50 @@
}
}
},
"/api/v1/archived-workflows/{namespace}/{uid}/retry": {
"put": {
"tags": [
"ArchivedWorkflowService"
],
"operationId": "ArchivedWorkflowService_RetryArchivedWorkflow",
"parameters": [
{
"type": "string",
"name": "namespace",
"in": "path",
"required": true
},
{
"type": "string",
"name": "uid",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest"
}
}
],
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.Workflow"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/grpc.gateway.runtime.Error"
}
}
}
}
},
"/api/v1/archived-workflows/{uid}": {
"get": {
"tags": [
Expand Down Expand Up @@ -10846,6 +10890,26 @@
}
}
},
"io.argoproj.workflow.v1alpha1.RetryArchivedWorkflowRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"nodeFieldSelector": {
"type": "string"
},
"restartSuccessful": {
"type": "boolean"
},
"uid": {
"type": "string"
}
}
},
"io.argoproj.workflow.v1alpha1.RetryNodeAntiAffinity": {
"description": "RetryNodeAntiAffinity is a placeholder for future expansion, only empty nodeAntiAffinity is allowed. In order to prevent running steps on the same host, it uses \"kubernetes.io/hostname\".",
"type": "object"
Expand Down
14 changes: 14 additions & 0 deletions persist/sqldb/mocks/WorkflowArchive.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions persist/sqldb/null_workflow_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ func (r *nullWorkflowArchive) IsEnabled() bool {
return false
}

func (r *nullWorkflowArchive) ValidateWorkflow(wf *wfv1.Workflow) error {
return nil
}

func (r *nullWorkflowArchive) ArchiveWorkflow(*wfv1.Workflow) error {
return nil
}
Expand Down
5 changes: 5 additions & 0 deletions persist/sqldb/workflow_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type WorkflowArchive interface {
IsEnabled() bool
ListWorkflowsLabelKeys() (*wfv1.LabelKeys, error)
ListWorkflowsLabelValues(key string) (*wfv1.LabelValues, error)
ValidateWorkflow(wf *wfv1.Workflow) error
}

type workflowArchive struct {
Expand All @@ -72,6 +73,10 @@ func (r *workflowArchive) IsEnabled() bool {
return true
}

func (r *workflowArchive) ValidateWorkflow(wf *wfv1.Workflow) error {
dpadhiar marked this conversation as resolved.
Show resolved Hide resolved
return r.instanceIDService.Validate(wf)
}

// NewWorkflowArchive returns a new workflowArchive
func NewWorkflowArchive(session sqlbuilder.Database, clusterName, managedNamespace string, instanceIDService instanceid.Service) WorkflowArchive {
return &workflowArchive{session: session, clusterName: clusterName, managedNamespace: managedNamespace, instanceIDService: instanceIDService, dbType: dbTypeFor(session)}
Expand Down
5 changes: 5 additions & 0 deletions pkg/apiclient/http1/archived-workflows-service-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ func (h ArchivedWorkflowsServiceClient) ListArchivedWorkflowLabelValues(_ contex
out := &wfv1.LabelValues{}
return out, h.Get(in, out, "/api/v1/archived-workflows-label-values")
}

func (h ArchivedWorkflowsServiceClient) RetryArchivedWorkflow(_ context.Context, in *workflowarchivepkg.RetryArchivedWorkflowRequest, _ ...grpc.CallOption) (*wfv1.Workflow, error) {
out := &wfv1.Workflow{}
return out, h.Get(in, out, "/api/v1/archived-workflows/{namespace}/{uid}/retry")
}
Loading