github.com/solo-io/cue@v0.4.7/doc/tutorial/kubernetes/manual/services/cloud.cue (about) 1 package kube 2 3 // _base defines settings that apply to all cloud objects 4 _base: { 5 name: string 6 7 label: [string]: string 8 9 // k8s is a set of Kubernetes-specific settings that will be merged in at 10 // the top-level. The allowed fields are type specfic. 11 kubernetes: {} 12 } 13 14 deployment: [Name=_]: _base & { 15 // Allow any string, but take Name by default. 16 name: string | *Name 17 kind: *"deployment" | "stateful" | "daemon" 18 replicas: int | *1 19 20 image: string 21 22 // expose port defines named ports that is exposed in the service 23 expose: port: [string]: int 24 25 // port defines named ports that is not exposed in the service. 26 port: [string]: int 27 28 arg: [string]: string 29 args: *[ for k, v in arg {"-\(k)=\(v)"}] | [...string] 30 31 // Environment variables 32 env: [string]: string 33 34 envSpec: [string]: {} 35 envSpec: { 36 for k, v in env { 37 "\(k)": value: v 38 } 39 } 40 41 volume: [Name=_]: { 42 name: string | *Name 43 mountPath: string 44 subPath: string | *null 45 readOnly: *false | true 46 kubernetes: {} 47 } 48 } 49 50 service: [Name=_]: _base & { 51 name: *Name | string 52 53 port: [Name=_]: { 54 name: string | *Name 55 56 port: int 57 protocol: *"TCP" | "UDP" 58 } 59 60 kubernetes: {} 61 } 62 63 configMap: [string]: { 64 } 65 66 // define services implied by deployments 67 for k, spec in deployment if len(spec.expose.port) > 0 { 68 service: "\(k)": { 69 70 // Copy over all ports exposed from containers. 71 for Name, Port in spec.expose.port { 72 port: "\(Name)": { 73 // Set default external port to Port. targetPort must be 74 // the respective containerPort (Port) if it differs from port. 75 port: int | *Port 76 if port != Port { 77 targetPort: Port 78 } 79 } 80 } 81 82 // Copy over the labels 83 label: spec.label 84 } 85 }