github.com/oam-dev/kubevela@v1.9.11/pkg/appfile/dryrun/testdata/diff-apprevision.yaml (about) 1 apiVersion: core.oam.dev/v1beta1 2 kind: ApplicationRevision 3 metadata: 4 generation: 1 5 labels: 6 app.oam.dev/app-revision-hash: c2207054644744d 7 app.oam.dev/name: livediff-demo 8 name: livediff-demo-v1 9 namespace: default 10 spec: 11 application: 12 apiVersion: core.oam.dev/v1beta1 13 kind: Application 14 metadata: {} 15 spec: 16 components: 17 - name: myweb-1 18 properties: 19 cmd: 20 - sleep 21 - "1000" 22 enemies: alien 23 image: busybox 24 lives: "3" 25 traits: 26 - properties: 27 domain: www.example.com 28 http: 29 /: 80 30 type: myingress 31 type: myworker 32 - name: myweb-2 33 properties: 34 cmd: 35 - sleep 36 - "1000" 37 enemies: alien 38 image: busybox 39 lives: "3" 40 type: myworker 41 status: {} 42 applicationConfiguration: 43 apiVersion: core.oam.dev/v1alpha2 44 kind: ApplicationConfiguration 45 metadata: {} 46 spec: 47 components: 48 - componentName: myweb-1 49 revisionName: myweb-1-v1 50 traits: 51 - trait: 52 apiVersion: v1 53 kind: Service 54 metadata: 55 labels: 56 app.oam.dev/appRevision: livediff-demo-v1 57 app.oam.dev/component: myweb-1 58 app.oam.dev/name: livediff-demo 59 trait.oam.dev/resource: service 60 trait.oam.dev/type: myingress 61 name: myweb-1 62 namespace: default 63 spec: 64 ports: 65 - port: 80 66 targetPort: 80 67 selector: 68 app.oam.dev/component: myweb-1 69 - trait: 70 apiVersion: networking.k8s.io/v1beta1 71 kind: Ingress 72 metadata: 73 labels: 74 app.oam.dev/appRevision: livediff-demo-v1 75 app.oam.dev/component: myweb-1 76 app.oam.dev/name: livediff-demo 77 trait.oam.dev/resource: ingress 78 trait.oam.dev/type: myingress 79 name: myweb-1 80 namespace: default 81 spec: 82 rules: 83 - host: www.example.com 84 http: 85 paths: 86 - backend: 87 serviceName: myweb-1 88 servicePort: 80 89 path: / 90 - componentName: myweb-2 91 revisionName: myweb-2-v1 92 status: 93 dependency: {} 94 observedGeneration: 0 95 componentDefinitions: 96 myworker: 97 apiVersion: core.oam.dev/v1beta1 98 kind: ComponentDefinition 99 metadata: {} 100 spec: 101 schematic: 102 cue: 103 template: "output: {\n apiVersion: \"apps/v1\"\n kind: \"Deployment\"\n}\noutput: 104 {\n\tspec: {\n\t\tselector: matchLabels: {\n\t\t\t\"app.oam.dev/component\": 105 context.name\n\t\t}\n\n\t\ttemplate: {\n\t\t\tmetadata: labels: {\n\t\t\t\t\"app.oam.dev/component\": 106 context.name\n\t\t\t}\n\n\t\t\tspec: {\n\t\t\t\tcontainers: [{\n\t\t\t\t\tname: 107 \ context.name\n\t\t\t\t\timage: parameter.image\n\n\t\t\t\t\tif parameter[\"cmd\"] 108 != _|_ {\n\t\t\t\t\t\tcommand: parameter.cmd\n\t\t\t\t\t}\n\t\t\t\t}]\n\t\t\t}\n\t\t}\n\t}\n}\n\nparameter: 109 {\n\t// +usage=Which image would you like to use for your service\n\t// +short=i\n\timage: 110 string\n\t// +usage=Commands to run in the container\n\tcmd?: [...string]\n}\n" 111 workload: 112 definition: 113 apiVersion: apps/v1 114 kind: Deployment 115 type: deployments.apps 116 status: {} 117 resourcesConfigMap: 118 name: livediff-demo-v1 119 traitDefinitions: 120 myingress: 121 apiVersion: core.oam.dev/v1beta1 122 kind: TraitDefinition 123 metadata: {} 124 spec: 125 appliesToWorkloads: 126 - '*' 127 definitionRef: 128 name: "" 129 schematic: 130 cue: 131 template: "parameter: {\n\tdomain: string\n\thttp: [string]: int\n}\n\noutputs: 132 {\n service: {\n apiVersion: \"v1\"\n kind: \"Service\"\n }\n ingress: 133 {\n apiVersion: \"networking.k8s.io/v1beta1\"\n kind: \"Ingress\"\n 134 \ }\n}\n\n// trait template can have multiple outputs in one trait\noutputs: 135 service: {\n\tmetadata:\n\t\tname: context.name\n\tspec: {\n\t\tselector:\n\t\t\t\"app.oam.dev/component\": 136 context.name\n\t\tports: [\n\t\t\tfor k, v in parameter.http {\n\t\t\t\tport: 137 \ v\n\t\t\t\ttargetPort: v\n\t\t\t},\n\t\t]\n\t}\n}\n\noutputs: ingress: 138 {\n\tmetadata:\n\t\tname: context.name\n\tspec: {\n\t\trules: [{\n\t\t\thost: 139 parameter.domain\n\t\t\thttp: {\n\t\t\t\tpaths: [\n\t\t\t\t\tfor k, v in parameter.http 140 {\n\t\t\t\t\t\tpath: k\n\t\t\t\t\t\tbackend: {\n\t\t\t\t\t\t\tserviceName: 141 context.name\n\t\t\t\t\t\t\tservicePort: v\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t}\n\t\t}]\n\t}\n}\n" 142 status: {}