github.com/oam-dev/kubevela@v1.9.11/docs/examples/traits/control-plane-only-usecase/control-plane-only-usecase.cue (about) 1 hubcpuscaler: { 2 type: "trait" 3 annotations: {} 4 labels: { 5 "ui-hidden": "true" 6 } 7 description: "Automatically scale the component based on CPU usage." 8 attributes: { 9 appliesToWorkloads: ["deployments.apps"] 10 controlPlaneOnly: true 11 } 12 } 13 14 template: { 15 outputs: hubcpuscaler: { 16 apiVersion: "autoscaling/v1" 17 kind: "HorizontalPodAutoscaler" 18 metadata: name: context.name 19 spec: { 20 scaleTargetRef: { 21 apiVersion: parameter.targetAPIVersion 22 kind: parameter.targetKind 23 name: context.name 24 } 25 minReplicas: parameter.min 26 maxReplicas: parameter.max 27 targetCPUUtilizationPercentage: parameter.cpuUtil 28 } 29 } 30 31 parameter: { 32 // +usage=Specify the minimal number of replicas to which the autoscaler can scale down 33 min: *1 | int 34 // +usage=Specify the maximum number of of replicas to which the autoscaler can scale up 35 max: *10 | int 36 // +usage=Specify the average CPU utilization, for example, 50 means the CPU usage is 50% 37 cpuUtil: *50 | int 38 // +usage=Specify the apiVersion of scale target 39 targetAPIVersion: *"apps/v1" | string 40 // +usage=Specify the kind of scale target 41 targetKind: *"Deployment" | string 42 } 43 }