github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/export-service.yaml (about) 1 # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. 2 # Definition source cue file: vela-templates/definitions/internal/export-service.cue 3 apiVersion: core.oam.dev/v1beta1 4 kind: WorkflowStepDefinition 5 metadata: 6 annotations: 7 custom.definition.oam.dev/category: Application Delivery 8 definition.oam.dev/description: Export service to clusters specified by topology. 9 labels: 10 custom.definition.oam.dev/scope: Application 11 name: export-service 12 namespace: {{ include "systemDefinitionNamespace" . }} 13 spec: 14 schematic: 15 cue: 16 template: | 17 import ( 18 "vela/op" 19 ) 20 21 meta: { 22 name: *context.name | string 23 namespace: *context.namespace | string 24 if parameter.name != _|_ { 25 name: parameter.name 26 } 27 if parameter.namespace != _|_ { 28 namespace: parameter.namespace 29 } 30 } 31 objects: [{ 32 apiVersion: "v1" 33 kind: "Service" 34 metadata: meta 35 spec: { 36 type: "ClusterIP" 37 ports: [{ 38 protocol: "TCP" 39 port: parameter.port 40 targetPort: parameter.targetPort 41 }] 42 } 43 }, { 44 apiVersion: "v1" 45 kind: "Endpoints" 46 metadata: meta 47 subsets: [{ 48 addresses: [{ip: parameter.ip}] 49 ports: [{port: parameter.targetPort}] 50 }] 51 }] @step(1) 52 53 getPlacements: op.#GetPlacementsFromTopologyPolicies & { 54 policies: *[] | [...string] 55 if parameter.topology != _|_ { 56 policies: [parameter.topology] 57 } 58 } @step(2) 59 60 apply: op.#Steps & { 61 for p in getPlacements.placements { 62 for o in objects { 63 "\(p.cluster)-\(o.kind)": op.#Apply & { 64 value: o 65 cluster: p.cluster 66 } 67 } 68 } 69 } @step(3) 70 71 parameter: { 72 // +usage=Specify the name of the export destination 73 name?: string 74 // +usage=Specify the namespace of the export destination 75 namespace?: string 76 // +usage=Specify the ip to be export 77 ip: string 78 // +usage=Specify the port to be used in service 79 port: int 80 // +usage=Specify the port to be export 81 targetPort: int 82 // +usage=Specify the topology to export 83 topology?: string 84 } 85