mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-15 22:07:13 +00:00
* add podDisruptive to traitdefinition * fix docs & example * fix diff and add docs * use bool type for podDisruptive Co-authored-by: 天元 <jianbo.sjb@alibaba-inc.com>
45 lines
1.0 KiB
YAML
45 lines
1.0 KiB
YAML
apiVersion: core.oam.dev/v1beta1
|
|
kind: TraitDefinition
|
|
metadata:
|
|
annotations:
|
|
definition.oam.dev/description: "configure k8s HPA for Deployment"
|
|
name: hpa
|
|
spec:
|
|
appliesToWorkloads:
|
|
- webservice
|
|
- worker
|
|
podDisruptive: true
|
|
schematic:
|
|
cue:
|
|
template: |
|
|
outputs: hpa: {
|
|
apiVersion: "autoscaling/v2beta2"
|
|
kind: "HorizontalPodAutoscaler"
|
|
metadata: name: context.name
|
|
spec: {
|
|
scaleTargetRef: {
|
|
apiVersion: "apps/v1"
|
|
kind: "Deployment"
|
|
name: context.name
|
|
}
|
|
minReplicas: parameter.min
|
|
maxReplicas: parameter.max
|
|
metrics: [{
|
|
type: "Resource"
|
|
resource: {
|
|
name: "cpu"
|
|
target: {
|
|
type: "Utilization"
|
|
averageUtilization: parameter.cpuUtil
|
|
}
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
parameter: {
|
|
min: *1 | int
|
|
max: *10 | int
|
|
cpuUtil: *50 | int
|
|
}
|
|
|