# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/expose.cue
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:
  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
        			},
        		]
        		type: parameter.type
        	}
        }
        parameter: {
        	// +usage=Specify the exposion ports
        	port: [...int]
        	// +usage=Specify what kind of Service you want. options: "ClusterIP","NodePort","LoadBalancer","ExternalName"
        	type: *"ClusterIP" | "NodePort" | "LoadBalancer" | "ExternalName"
        }

