45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
version: 0.1
|
|
component: command
|
|
timeoutInSeconds: 600
|
|
shell: bash
|
|
failImmediatelyOnError: true
|
|
|
|
env:
|
|
variables:
|
|
APP_NAMESPACE: kagent-demo
|
|
HPA_NAME: order-service
|
|
MIN_REPLICAS: "3"
|
|
MAX_REPLICAS: "8"
|
|
CPU_TARGET: "65"
|
|
|
|
steps:
|
|
- type: Command
|
|
name: Patch order HPA capacity
|
|
command: |
|
|
kubectl patch hpa "${HPA_NAME}" -n "${APP_NAMESPACE}" \
|
|
--type merge \
|
|
-p "{
|
|
\"spec\": {
|
|
\"minReplicas\": ${MIN_REPLICAS},
|
|
\"maxReplicas\": ${MAX_REPLICAS},
|
|
\"metrics\": [
|
|
{
|
|
\"type\": \"Resource\",
|
|
\"resource\": {
|
|
\"name\": \"cpu\",
|
|
\"target\": {
|
|
\"type\": \"Utilization\",
|
|
\"averageUtilization\": ${CPU_TARGET}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}"
|
|
|
|
- type: Command
|
|
name: Show HPA state
|
|
command: |
|
|
kubectl get hpa "${HPA_NAME}" -n "${APP_NAMESPACE}" -o wide
|
|
kubectl describe hpa "${HPA_NAME}" -n "${APP_NAMESPACE}"
|