Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TestExceptApp = &Appfile{ name: "test", services: []*Workload{ { name: "myweb", typ: "worker", params: map[string]interface{}{ "image": "busybox", "cmd": []interface{}{"sleep", "1000"}, }, 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 } }] } } selector: matchLabels: "app.oam.dev/component": context.name } } parameter: { // +usage=Which image would you like to use for your service // +short=i image: string cmd?: [...string] }`, traits: []*Trait{ { name: "scaler", params: map[string]interface{}{ "replicas": 10, }, template: ` output: { apiVersion: "core.oam.dev/v1alpha2" kind: "ManualScalerTrait" spec: { replicaCount: parameter.replicas } } parameter: { //+short=r replicas: *1 | int } `, }, }, }, }, }
TestExceptApp is test data
Functions ¶
Types ¶
type Appfile ¶
type Appfile struct {
// contains filtered or unexported fields
}
Appfile describle application
func (*Appfile) TemplateValidate ¶
TemplateValidate validate Template format
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is appfile parser
type Render ¶
type Render interface {
// WithContext(ctx interface{}) Render
WithParams(params interface{}) Render
WithTemplate(raw string) Render
Complete() (*cue.Instance, error)
}
Render is cue render
type Trait ¶
type Trait struct {
// contains filtered or unexported fields
}
Trait is ComponentTrait
Click to show internal directories.
Click to hide internal directories.