-
Notifications
You must be signed in to change notification settings - Fork 55
Fix: Updates the addon-operation WFS to newer image and corrects wait… #210
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,79 +15,86 @@ spec: | |
cue: | ||
template: | | ||
import ( | ||
"vela/op" | ||
"vela/op" | ||
) | ||
|
||
job: op.#Apply & { | ||
value: { | ||
apiVersion: "batch/v1" | ||
kind: "Job" | ||
metadata: { | ||
name: context.name + "-" + context.stepSessionID | ||
namespace: "vela-system" | ||
labels: "enable-addon.oam.dev": context.name | ||
annotations: "workflow.oam.dev/step": context.stepName | ||
} | ||
spec: { | ||
backoffLimit: 3 | ||
template: { | ||
metadata: { | ||
labels: { | ||
"workflow.oam.dev/name": context.name | ||
"workflow.oam.dev/session": context.stepSessionID | ||
} | ||
annotations: "workflow.oam.dev/step": context.stepName | ||
} | ||
spec: { | ||
containers: [ | ||
{ | ||
name: parameter.addonName + "-enable-job" | ||
image: parameter.image | ||
value: { | ||
apiVersion: "batch/v1" | ||
kind: "Job" | ||
metadata: { | ||
name: context.name + "-" + context.stepSessionID | ||
namespace: "vela-system" | ||
labels: { | ||
"enable-addon.oam.dev": context.name | ||
"workflow.oam.dev/name": context.name | ||
"workflow.oam.dev/session": context.stepSessionID | ||
} | ||
annotations: "workflowrun.oam.dev/step": context.stepName | ||
} | ||
spec: { | ||
backoffLimit: 3 | ||
template: { | ||
metadata: { | ||
labels: { | ||
"workflow.oam.dev/name": context.name | ||
"workflow.oam.dev/session": context.stepSessionID | ||
} | ||
annotations: "workflow.oam.dev/step": context.stepName | ||
} | ||
spec: { | ||
containers: [ | ||
{ | ||
name: parameter.addonName + "-enable-job" | ||
image: parameter.image | ||
|
||
if parameter.args == _|_ { | ||
command: ["vela", "addon", parameter.operation, parameter.addonName] | ||
} | ||
if parameter.args == _|_ { | ||
args: ["addon", parameter.operation, parameter.addonName] | ||
} | ||
|
||
if parameter.args != _|_ { | ||
command: ["vela", "addon", parameter.operation, parameter.addonName] + parameter.args | ||
} | ||
}, | ||
] | ||
restartPolicy: "Never" | ||
serviceAccount: parameter.serviceAccountName | ||
} | ||
} | ||
} | ||
} | ||
if parameter.args != _|_ { | ||
args: ["addon", parameter.operation, parameter.addonName] + parameter.args | ||
} | ||
}, | ||
] | ||
restartPolicy: "Never" | ||
serviceAccount: parameter.serviceAccountName | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
log: op.#Log & { | ||
source: resources: [{labelSelector: { | ||
"workflow.oam.dev/name": context.name | ||
"workflow.oam.dev/session": context.stepSessionID | ||
}}] | ||
} | ||
fail: op.#Steps & { | ||
if job.value.status.failed != _|_ { | ||
if job.value.status.failed > 2 { | ||
breakWorkflow: op.#Fail & { | ||
message: "enable addon failed" | ||
} | ||
} | ||
} | ||
source: resources: [{labelSelector: { | ||
"workflow.oam.dev/name": context.name | ||
"workflow.oam.dev/session": context.stepSessionID | ||
}}] | ||
} | ||
|
||
wait: op.#ConditionalWait & { | ||
continue: job.value.status.succeeded != _|_ && job.value.status.succeeded > 0 | ||
continue: job.value.status.succeeded != _|_ || job.value.status.failed != _|_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a workflow with several steps, turning on continue on fail lets the next steps start even if the current step hasn’t finished or succeeded yet. This way, the workflow doesn’t wait for all retry attempts to be used up before moving on. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ended up using the new providers with if statements to check the status.succeeded is set. This snippet working for me.
|
||
} | ||
parameter: { | ||
// +usage=Specify the name of the addon. | ||
addonName: string | ||
// +usage=Specify addon enable args. | ||
args?: [...string] | ||
// +usage=Specify the image | ||
image: *"oamdev/vela-cli:v1.6.4" | string | ||
// +usage=operation for the addon | ||
operation: *"enable" | "upgrade" | "disable" | ||
// +usage=specify serviceAccountName want to use | ||
serviceAccountName: *"kubevela-vela-core" | string | ||
|
||
fail: op.#Steps & { | ||
if job.value.status.failed != _|_ { | ||
if job.value.status.failed > 2 { | ||
breakWorkflow: op.#Fail & { | ||
message: "enable addon failed" | ||
} | ||
} | ||
} | ||
} | ||
|
||
parameter: { | ||
// +usage=Specify the name of the addon. | ||
addonName: string | ||
// +usage=Specify addon enable args. | ||
args?: [...string] | ||
// +usage=Specify the image | ||
image: *"oamdev/vela-cli:v1.10.3" | string | ||
// +usage=operation for the addon | ||
operation: *"enable" | "upgrade" | "disable" | ||
// +usage=specify serviceAccountName want to use | ||
serviceAccountName: *"kubevela-vela-core" | string | ||
} |
Uh oh!
There was an error while loading. Please reload this page.