mirror of
https://github.com/kubevela/kubevela.git
synced 2026-04-22 02:26:56 +00:00
* open op.#Steps * export * fmt code * fix bug & upgrade workflow doc * fmt * upgrade test coverage * upgrade test coverage
69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
apiVersion: core.oam.dev/v1beta1
|
|
kind: WorkflowStepDefinition
|
|
metadata:
|
|
name: apply
|
|
spec:
|
|
schematic:
|
|
cue:
|
|
template: |
|
|
import ("vela/op")
|
|
parameter: {
|
|
component: string
|
|
name: string
|
|
prefixIP?: string
|
|
}
|
|
|
|
// load component from application
|
|
component: op.#Load & {
|
|
component: parameter.component
|
|
}
|
|
|
|
// apply workload to kubernetes cluster
|
|
apply: op.#Apply & {
|
|
component.workload
|
|
metadata: name: parameter.name
|
|
if parameter.prefixIP!=_|_{
|
|
spec: containers: [{env: [{name: "PrefixIP",value: parameter.prefixIP}]}]
|
|
}
|
|
}
|
|
|
|
// wait until workload.status equal "Running"
|
|
wait: op.#ConditionalWait & {
|
|
continue: apply.status.phase =="Running"
|
|
}
|
|
|
|
// export podIP
|
|
myIP: apply.status.podIP
|
|
---
|
|
apiVersion: core.oam.dev/v1beta1
|
|
kind: ComponentDefinition
|
|
metadata:
|
|
name: singletonServer
|
|
annotations:
|
|
definition.oam.dev/description: "singletonServer is Pod"
|
|
spec:
|
|
workload:
|
|
definition:
|
|
apiVersion: v1
|
|
kind: Pod
|
|
schematic:
|
|
cue:
|
|
template: |
|
|
parameter: {
|
|
version: *"1.14.2" | string
|
|
}
|
|
output: {
|
|
apiVersion: "v1"
|
|
kind: "Pod"
|
|
metadata: {
|
|
labels: app: "nginx"
|
|
}
|
|
spec:{
|
|
containers:[{
|
|
name: "nginx"
|
|
image: "nginx:"+parameter.version
|
|
ports: [{containerPort: 80}]
|
|
}]
|
|
}
|
|
}
|