github.com/oam-dev/kubevela@v1.9.11/vela-templates/registry/auto-gen/hpa.yaml (about) 1 # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. 2 # Definition source cue file: vela-templates/definitions/registry/hpa.cue 3 apiVersion: core.oam.dev/v1beta1 4 kind: TraitDefinition 5 metadata: 6 annotations: 7 definition.oam.dev/description: configure k8s HPA for Deployment 8 name: hpa 9 namespace: vela-system 10 spec: 11 appliesToWorkloads: 12 - deployments.apps 13 podDisruptive: true 14 schematic: 15 cue: 16 template: | 17 outputs: hpa: { 18 apiVersion: "autoscaling/v2beta2" 19 kind: "HorizontalPodAutoscaler" 20 metadata: name: context.name 21 spec: { 22 scaleTargetRef: { 23 apiVersion: "apps/v1" 24 kind: "Deployment" 25 name: context.name 26 } 27 minReplicas: parameter.min 28 maxReplicas: parameter.max 29 metrics: [{ 30 type: "Resource" 31 resource: { 32 name: "cpu" 33 target: { 34 type: "Utilization" 35 averageUtilization: parameter.cpuUtil 36 } 37 } 38 }] 39 } 40 } 41 parameter: { 42 min: *1 | int 43 max: *10 | int 44 cpuUtil: *50 | int 45 } 46