applicaiton supports specifying different versions of Definition (#1597)

* app support specify the version of definition

* add e2e-test

* add docs

* add helm related test

* fix doc

* add more test

* fix docs
This commit is contained in:
yangsoon
2021-05-17 10:53:31 +08:00
parent a05a983a9a
commit 01dfedfac2
13 changed files with 1392 additions and 23 deletions
@@ -0,0 +1,48 @@
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
name: worker
namespace: default
annotations:
definition.oam.dev/description: "Describes long-running, scalable, containerized services that running at backend. They do NOT have network endpoint to receive external network traffic."
spec:
workload:
definition:
apiVersion: apps/v1
kind: Deployment
schematic:
cue:
template: |
output: {
apiVersion: "apps/v1"
kind: "Deployment"
spec: {
selector: matchLabels: {
"app.oam.dev/component": context.name
}
template: {
metadata: labels: {
"app.oam.dev/component": context.name
}
spec: {
containers: [{
name: context.name
image: parameter.image
if parameter["cmd"] != _|_ {
command: parameter.cmd
}
ports: [{
containerPort: 8000
}]
}]
}
}
}
}
parameter: {
// +usage=Which image would you like to use for your service
image: string
// +usage=Commands to run in the container
cmd?: [...string]
}
@@ -0,0 +1,50 @@
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
name: worker
namespace: default
annotations:
definition.oam.dev/description: "Describes long-running, scalable, containerized services that running at backend. They do NOT have network endpoint to receive external network traffic."
spec:
workload:
definition:
apiVersion: apps/v1
kind: Deployment
schematic:
cue:
template: |
output: {
apiVersion: "apps/v1"
kind: "Deployment"
spec: {
selector: matchLabels: {
"app.oam.dev/component": context.name
}
template: {
metadata: labels: {
"app.oam.dev/component": context.name
}
spec: {
containers: [{
name: context.name
image: parameter.image
if parameter["cmd"] != _|_ {
command: parameter.cmd
}
ports: [{
containerPort: parameter.port
}]
}]
}
}
}
}
parameter: {
// +usage=Which image would you like to use for your service
image: string
// +usage=Commands to run in the container
cmd?: [...string]
// +usage=Which port do you want customer traffic sent to
port: int
}