diff --git a/charts/vela-core/templates/defwithtemplate/expose.yaml b/charts/vela-core/templates/defwithtemplate/expose.yaml new file mode 100644 index 000000000..04b21980a --- /dev/null +++ b/charts/vela-core/templates/defwithtemplate/expose.yaml @@ -0,0 +1,36 @@ +# Code generated by KubeVela templates. DO NOT EDIT. +apiVersion: core.oam.dev/v1beta1 +kind: TraitDefinition +metadata: + annotations: + definition.oam.dev/description: "Expose port to enable web traffic for your component." + name: expose + namespace: {{.Values.systemDefinitionNamespace}} +spec: + appliesToWorkloads: + - deployments.apps + podDisruptive: false + schematic: + cue: + template: | + outputs: service: { + apiVersion: "v1" + kind: "Service" + metadata: + name: context.name + spec: { + selector: + "app.oam.dev/component": context.name + ports: [ + for p in parameter.port { + port: p + targetPort: p + }, + ] + } + } + parameter: { + // +usage=Specify the exposion ports + port: [...int] + } + diff --git a/hack/vela-templates/cue/expose.cue b/hack/vela-templates/cue/expose.cue new file mode 100644 index 000000000..37831602c --- /dev/null +++ b/hack/vela-templates/cue/expose.cue @@ -0,0 +1,20 @@ +outputs: service: { + apiVersion: "v1" + kind: "Service" + metadata: + name: context.name + spec: { + selector: + "app.oam.dev/component": context.name + ports: [ + for p in parameter.port { + port: p + targetPort: p + }, + ] + } +} +parameter: { + // +usage=Specify the exposion ports + port: [...int] +} diff --git a/hack/vela-templates/definitions/expose.yaml b/hack/vela-templates/definitions/expose.yaml new file mode 100644 index 000000000..852a3020f --- /dev/null +++ b/hack/vela-templates/definitions/expose.yaml @@ -0,0 +1,14 @@ +apiVersion: core.oam.dev/v1beta1 +kind: TraitDefinition +metadata: + annotations: + definition.oam.dev/description: "Expose port to enable web traffic for your component." + name: expose + namespace: {{.Values.systemDefinitionNamespace}} +spec: + appliesToWorkloads: + - deployments.apps + podDisruptive: false + schematic: + cue: + template: |