mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
fix def init bug (#2056)
This commit is contained in:
@@ -96,7 +96,10 @@ The first part `labels: {...}` expresses the basic information of the definition
|
||||
labels: {}
|
||||
type: "trait"
|
||||
}
|
||||
template: patch: {}
|
||||
template: {
|
||||
patch: {}
|
||||
parameter: {}
|
||||
}
|
||||
```
|
||||
|
||||
Or you can use `vela def init my-comp --interactive` to initiate definitions interactively.
|
||||
@@ -203,7 +206,7 @@ template: {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
}
|
||||
parameters: {}
|
||||
parameter: {}
|
||||
|
||||
}
|
||||
```
|
||||
@@ -272,7 +275,7 @@ spec:
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
}
|
||||
parameters: {}
|
||||
parameter: {}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps/v1
|
||||
|
||||
@@ -96,7 +96,10 @@ template: {
|
||||
labels: {}
|
||||
type: "trait"
|
||||
}
|
||||
template: patch: {}
|
||||
template: {
|
||||
patch: {}
|
||||
parameter: {}
|
||||
}
|
||||
```
|
||||
|
||||
或者是采用 `vela def init my-comp --interactive` 来交互式地创建新的 Definition 。
|
||||
@@ -203,7 +206,7 @@ template: {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
}
|
||||
parameters: {}
|
||||
parameter: {}
|
||||
|
||||
}
|
||||
```
|
||||
@@ -272,7 +275,7 @@ spec:
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
}
|
||||
parameters: {}
|
||||
parameter: {}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps/v1
|
||||
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
velacue "github.com/oam-dev/kubevela/pkg/cue"
|
||||
"github.com/oam-dev/kubevela/pkg/cue/model/sets"
|
||||
)
|
||||
|
||||
@@ -285,7 +286,7 @@ func (def *Definition) FromCUEString(cueString string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = r.Compile("-", templateString+"\ncontext: [string]: string"); err != nil {
|
||||
if _, err = r.Compile("-", templateString+"\n"+velacue.BaseTemplate); err != nil {
|
||||
return err
|
||||
}
|
||||
val := inst.Value()
|
||||
@@ -353,7 +354,7 @@ func GetDefinitionDefaultSpec(kind string) map[string]interface{} {
|
||||
},
|
||||
"schematic": map[string]interface{}{
|
||||
"cue": map[string]interface{}{
|
||||
"template": "output: {}\nparameters: {}\n",
|
||||
"template": "output: {}\nparameter: {}\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -366,7 +367,7 @@ func GetDefinitionDefaultSpec(kind string) map[string]interface{} {
|
||||
"podDisruptive": false,
|
||||
"schematic": map[string]interface{}{
|
||||
"cue": map[string]interface{}{
|
||||
"template": "patch: {}\n",
|
||||
"template": "patch: {}\nparameter: {}\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user