github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/registry/expose.cue (about)

     1  expose: {
     2  	type: "trait"
     3  	annotations: {}
     4  	labels: {}
     5  	description: "Expose a service."
     6  	attributes: podDisruptive: false
     7  }
     8  template: {
     9  	parameter: {
    10  		domain: string
    11  		http: [string]: int
    12  	}
    13  	outputs: {
    14  		for k, v in parameter.http {
    15  			(k): {
    16  				apiVersion: "v1"
    17  				kind:       "Service"
    18  				spec: {
    19  					selector: app: context.name
    20  					ports: [{
    21  						port:       v
    22  						targetPort: v
    23  					}]
    24  				}
    25  			}
    26  		}
    27  	}
    28  }