Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
141 changes: 74 additions & 67 deletions charts/vela-workflow/templates/definitions/addon-operation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 != _|_ {
args: ["addon", parameter.operation, parameter.addonName] + parameter.args
}
},
]
restartPolicy: "Never"
serviceAccount: parameter.serviceAccountName
}
}
}
}
} @step(1)

if parameter.args != _|_ {
command: ["vela", "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
}}]
} @step(2)

wait: op.#ConditionalWait & {
continue: job.value.status.succeeded != _|_ && job.value.status.succeeded > 0
}
continue: job.value.status.succeeded != _|_ || job.value.status.failed != _|_
} @step(3)

fail: op.#Steps & {
if job.value.status.failed != _|_ {
if job.value.status.failed > 2 {
breakWorkflow: op.#Fail & {
message: "enable addon failed"
}
}
}
} @step(4)

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
// +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
}

Loading