github.com/oam-dev/kubevela@v1.9.11/docs/examples/cloneset-rollout/clonesetDefinition.yaml (about) 1 # Code generated by KubeVela templates. DO NOT EDIT. 2 apiVersion: core.oam.dev/v1beta1 3 kind: ComponentDefinition 4 metadata: 5 name: clonesetservice 6 namespace: vela-system 7 annotations: 8 definition.oam.dev/description: "Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers. 9 If workload type is skipped for any service defined in Appfile, it will be defaulted to `webservice` type." 10 spec: 11 workload: 12 definition: 13 apiVersion: apps.kruise.io/v1alpha1 14 kind: CloneSet 15 schematic: 16 cue: 17 template: | 18 output: { 19 apiVersion: "apps.kruise.io/v1alpha1" 20 kind: "CloneSet" 21 metadata: labels: { 22 "app.oam.dev/component": context.name 23 } 24 spec: { 25 if parameter["replicas"] != _|_ { 26 replicas: parameter.replicas 27 } 28 selector: matchLabels: { 29 "app.oam.dev/component": context.name 30 } 31 32 template: { 33 metadata: labels: { 34 "app.oam.dev/component": context.name 35 } 36 37 spec: { 38 containers: [{ 39 name: context.name 40 image: parameter.image 41 42 if parameter["cmd"] != _|_ { 43 command: parameter.cmd 44 } 45 46 if parameter["env"] != _|_ { 47 env: parameter.env 48 } 49 50 if context["config"] != _|_ { 51 env: context.config 52 } 53 54 ports: [{ 55 containerPort: parameter.port 56 }] 57 58 if parameter["cpu"] != _|_ { 59 resources: { 60 limits: 61 cpu: parameter.cpu 62 requests: 63 cpu: parameter.cpu 64 } 65 } 66 }] 67 } 68 } 69 if parameter["updateStrategyType"] != _|_ { 70 updateStrategy: { 71 type: parameter.updateStrategyType 72 } 73 } 74 } 75 } 76 parameter: { 77 // +usage=Which image would you like to use for your service 78 // +short=i 79 image: string 80 81 // +usage=Commands to run in the container 82 cmd?: [...string] 83 84 // +usage=Which port do you want customer traffic sent to 85 // +short=p 86 port: *80 | int 87 // +usage=Define arguments by using environment variables 88 env?: [...{ 89 // +usage=Environment variable name 90 name: string 91 // +usage=The value of the environment variable 92 value?: string 93 // +usage=Specifies a source the value of this var should come from 94 valueFrom?: { 95 // +usage=Selects a key of a secret in the pod's namespace 96 secretKeyRef: { 97 // +usage=The name of the secret in the pod's namespace to select from 98 name: string 99 // +usage=The key of the secret to select from. Must be a valid secret key 100 key: string 101 } 102 } 103 }] 104 // +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) 105 cpu?: string 106 // +usage=Cloneset updateStrategy, candidates are `ReCreate`/`InPlaceIfPossible`/`InPlaceOnly` 107 updateStrategyType?: string 108 // +usage=Number of pods in the cloneset 109 replicas?: int 110 }