Files
kagent-oci-devops-demo/k8s/fix-order-hpa-command-spec.yaml
Oracle Public Cloud User 8b3cc8dd10 adding files 2
2026-09-04 13:54:16 +00:00

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}"