Huawei Cloud Cce Capacity Trend Forecaster
/install huawei-cloud-cce-capacity-trend-forecaster
\r \r
Huawei Cloud CCE Capacity Trend Forecaster\r
\r
⚠️ Execution Method (Must Read): This skill executes queries via the local Python dispatcher script. Using hcloud, openstack, or other CLI tools or direct API calls is prohibited.\r \r
- The dispatcher script is located at
scripts/huawei-cloud.pywithin the skill directory\r- All scripts and environment check scripts are inside the skill package. You must use
skill action=execto execute them. Do not run them directly in a shell.\r- Do not attempt hcloud, openstack, curl IAM, or any other CLI/API methods. This skill does not depend on those tools.\r
- All paths are relative to the skill directory, which is the directory where this SKILL.md is located.\r \r
Overview\r
\r
This skill analyzes CCE capacity trends over a user-selected period (1 hour to 1 month), forecasts resource bottlenecks, simulates elasticity policies, generates curve charts and reports, and compares recurring history records. The core principle is to treat capacity as a time-series problem: rising trends with high p95 signal risk, low utilization with conservative simulation signals cost optimization opportunity.\r
\r
This skill has read-only tools (collection, analysis, simulation, report generation) and preview tools for HPA and autoscaler configuration. Applying configuration changes requires a two-step confirmation workflow with confirm=true and explicit user approval.\r
\r
Related Skills\r
\r
| Skill | Purpose |\r
|-------|---------|\r
| huawei-cloud-cce-metric-analyzer | Query Pod/Node CPU/memory/disk metrics and anomaly detection |\r
| huawei-cloud-cce-node-failure-diagnoser | Node failure diagnosis (NotReady, resource pressure, NPD events) |\r
| huawei-cloud-cce-pod-failure-diagnoser | Pod-level failure diagnosis (CrashLoopBackOff, ImagePullBackOff, etc.) |\r
| huawei-cloud-cce-workload-failure-diagnoser | Workload-level failure diagnosis |\r
| huawei-cloud-cce-auto-remediation-runner | Execute remediation actions (scale, reboot, drain) |\r
| huawei-cloud-cce-cost-optimization-advisor | Cost optimization recommendations |\r
| huawei-cloud-cce-observability-context-builder | Observability context enrichment |\r
\r
Capabilities\r
\r
- Collect node metrics, HPA status, nodepool autoscaling status, and business Deployment inventory\r
- Calculate trend statistics (avg, min, max, p95, slope, trend direction) for CPU, memory, and disk\r
- Predict bottleneck arrival time against configurable thresholds\r
- Simulate recommended node counts and reducible nodes with headroom\r
- Generate JSON/Markdown/HTML reports with embedded SVG curve charts\r
- Store and compare recurring history records to track before-and-after effects\r
- Preview and apply HPA configuration with two-step confirmation workflow\r
- Recommend node autoscaler min/max bounds adjustments\r \r
Typical Use Cases\r
\r
- Run a 6-hour capacity trend analysis and identify rising CPU trends approaching bottleneck threshold\r
- Compare weekly capacity records to validate that a previous optimization reduced utilization\r
- Simulate node requirements with 60% CPU target and 15% headroom, then preview HPA adjustments\r
- Forecast when memory will reach 80% bottleneck threshold based on current slope\r
- Generate a monthly capacity report with curve charts for stakeholder review\r
- Check HPA coverage percentage and preview HPA manifest for uncovered Deployments\r \r ---\r \r
Prerequisites\r
\r
Python Dependencies\r
\r The dispatcher script requires Python >= 3.6 and the following packages:\r \r
huaweicloudsdkcore\rhuaweicloudsdkaom\rhuaweicloudsdkcce\rhuaweicloudsdkiam\r \r
Credential Configuration\r
\r
| Variable | Required | Description |\r
|----------|----------|-------------|\r
| HUAWEI_AK | Yes | Huawei Cloud Access Key |\r
| HUAWEI_SK | Yes | Huawei Cloud Secret Key |\r
| HUAWEI_REGION | No | Default region (overrides region param if set) |\r
| HUAWEI_PROJECT_ID | No | Project ID (auto-obtained via IAM API when not set) |\r
| HUAWEI_SECURITY_TOKEN | No | Required when using temporary AK/SK |\r
\r
🚫 Never expose or log AK/SK values. Credentials exist only in the current request call stack and are released after each invocation. Do not write credentials to files, logs, or responses.\r
\r
✅ Use environment variables HUAWEI_AK / HUAWEI_SK for authentication. The dispatcher reads them automatically.\r
\r
Security rules for credentials:\r
\r
- No persistent storage — never write AK/SK, tokens, or certificates to disk files\r
- No long-term memory cache — AK/SK exists only during the current API call and is released afterward\r
- Project ID memory cache only — only non-sensitive project IDs may be cached in process memory (never written to disk)\r
- No log leakage — never include AK/SK in logs, response output, or error messages\r
- Output desensitization — output only capacity, trend, and simulation information; never expose authentication credentials\r \r AK/SK may be provided in two ways:\r
- Via environment variables
HUAWEI_AK/HUAWEI_SK(recommended)\r - Via per-call parameters
akandsk(not recommended for production)\r \r
IAM Permissions\r
\r
| Permission | Description |\r
|------------|-------------|\r
| cce:cluster:list | Query CCE cluster metadata |\r
| cce:node:list | Query Kubernetes node inventory |\r
| cce:nodepool:list | Query CCE nodepool autoscaling status |\r
| cce:deployment:list | Query business Deployment inventory |\r
| aom:metric:get | Query AOM Prometheus metrics (CPU, memory, disk time series) |\r
| cce:hpa:list | Query HPA inventory and target references |\r
| cce:hpa:configure | Configure HPA (preview + confirm workflow) |\r
\r
---\r
\r
Core Tools\r
\r All actions are invoked via the dispatcher script:\r \r
python3 scripts/huawei-cloud.py \x3Caction> region=\x3Cregion> [key=value ...]\r
```\r
\r
### Two-Step Confirmation Workflow for Mutation Operations\r
\r
> **Mutation operations (apply HPA configuration with `confirm=true`, change nodepool autoscaling bounds, resize node pools) require `confirm=true` to execute. Without `confirm`, the tool returns a preview and confirmation prompt only.**\r
\r
**Step 1: Preview** — call without `confirm`:\r
```bash\r
python3 scripts/huawei-cloud.py huawei_configure_cce_hpa \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> \\r
namespace=default deployment_name=\x3Cname> \\r
min_replicas=2 max_replicas=10 target_cpu_percent=60\r
```\r
\r
Returns: operation preview, target HPA, configuration fields, and confirmation example. No real modification is performed.\r
\r
**Step 2: Confirm execution** — call again with `confirm=true`:\r
```bash\r
python3 scripts/huawei-cloud.py huawei_configure_cce_hpa \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> \\r
namespace=default deployment_name=\x3Cname> \\r
min_replicas=2 max_replicas=10 target_cpu_percent=60 \\r
confirm=true\r
```\r
\r
#### Operations Requiring Confirmation\r
\r
| Tool | Operation | Risk Level | Description |\r
|------|-----------|-----------|-------------|\r
| `huawei_configure_cce_hpa` | Configure HPA | 🟠 High | Apply HPA configuration changes; preview without `confirm`, apply with `confirm=true` |\r
| Nodepool autoscaling changes | Modify bounds | 🟠 High | Change min/max nodes in nodepool autoscaler configuration |\r
| Node pool resize | Resize pool | 🔴 High | Add or remove nodes from a node pool |\r
\r
#### Prohibited Actions\r
\r
| Action | Description |\r
|--------|-------------|\r
| Automatic downsizing on single period | Do not treat a single period as enough evidence for aggressive downsizing; prefer at least two comparable records |\r
| Apply HPA without preview | Always preview first, then confirm only after explicit user approval |\r
| Skip rollback plan | For real changes, provide the exact reason, expected effect, rollback path, and validation checks |\r
| Modify workloads directly | Do not mutate Deployment replicas, node pools, or addons without explicit authorization |\r
\r
### Capacity Trend Analysis (Read-Only)\r
\r
| Action | Description | Required Params |\r
|--------|-------------|-----------------|\r
| `huawei_analyze_cce_capacity_trend` | Main analyzer: collect metrics, compute trends, simulate elasticity, generate reports with curve charts, store history records | `region`, `cluster_id` |\r
\r
```bash\r
# Basic 6-hour analysis\r
python3 scripts/huawei-cloud.py huawei_analyze_cce_capacity_trend \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> hours=6\r
\r
# Weekly analysis with custom targets and output directory\r
python3 scripts/huawei-cloud.py huawei_analyze_cce_capacity_trend \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> hours=168 \\r
target_cpu_percent=60 target_memory_percent=70 \\r
headroom_percent=15 bottleneck_percent=80 \\r
output_dir=debug/capacity-trend/\x3Ccluster>\r
\r
# Monthly analysis with business namespace scope and action note\r
python3 scripts/huawei-cloud.py huawei_analyze_cce_capacity_trend \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> hours=744 \\r
business_namespaces=default,production \\r
action_note="Scaled HPA max_replicas from 5 to 10 on 2026-05-28"\r
\r
# Recurring run for comparison\r
python3 scripts/huawei-cloud.py huawei_analyze_cce_capacity_trend \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> hours=6 \\r
output_dir=debug/capacity-trend/\x3Ccluster> \\r
history_dir=debug/capacity-trend/\x3Ccluster>/history\r
```\r
\r
### Inventory and Context (Read-Only)\r
\r
| Action | Description | Required Params |\r
|--------|-------------|-----------------|\r
| `huawei_list_cce_clusters` | List CCE clusters in a region | `region` |\r
| `huawei_get_kubernetes_nodes` | Get Kubernetes node inventory for a cluster | `region`, `cluster_id` |\r
| `huawei_list_cce_nodepools` | List CCE nodepools with autoscaling status | `region`, `cluster_id` |\r
| `huawei_get_cce_deployments` | Get business Deployment inventory | `region`, `cluster_id` |\r
| `huawei_list_cce_hpas` | List HPA inventory and target references | `region`, `cluster_id` |\r
\r
```bash\r
# List clusters\r
python3 scripts/huawei-cloud.py huawei_list_cce_clusters region=cn-north-4\r
\r
# Get node inventory\r
python3 scripts/huawei-cloud.py huawei_get_kubernetes_nodes \\r
region=cn-north-4 cluster_id=\x3Ccluster-id>\r
\r
# List nodepools\r
python3 scripts/huawei-cloud.py huawei_list_cce_nodepools \\r
region=cn-north-4 cluster_id=\x3Ccluster-id>\r
\r
# Get deployments\r
python3 scripts/huawei-cloud.py huawei_get_cce_deployments \\r
region=cn-north-4 cluster_id=\x3Ccluster-id>\r
\r
# List HPA configurations\r
python3 scripts/huawei-cloud.py huawei_list_cce_hpas \\r
region=cn-north-4 cluster_id=\x3Ccluster-id>\r
```\r
\r
### Metrics (Read-Only)\r
\r
| Action | Description | Required Params |\r
|--------|-------------|-----------------|\r
| `huawei_get_cce_node_metrics_topN` | Get Node CPU/memory/disk TopN | `region`, `cluster_id` |\r
| `huawei_get_aom_metrics` | Get AOM Prometheus metric time series | `region`, `cluster_id` |\r
\r
```bash\r
# Node metrics TopN\r
python3 scripts/huawei-cloud.py huawei_get_cce_node_metrics_topN \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> top_n=10 hours=6\r
\r
# AOM metrics\r
python3 scripts/huawei-cloud.py huawei_get_aom_metrics \\r
region=cn-north-4 cluster_id=\x3Ccluster-id>\r
```\r
\r
### HPA Configuration (Preview + Confirm)\r
\r
| Action | Description | Risk Level | Requires `confirm` | Required Params |\r
|--------|-------------|-----------|--------------------|-----------------|\r
| `huawei_generate_cce_hpa_manifest` | Generate HPA manifest preview | 🟢 Low | No | `region`, `cluster_id`, `namespace`, `deployment_name`, `min_replicas`, `max_replicas`, `target_cpu_percent` |\r
| `huawei_configure_cce_hpa` | Preview or apply HPA configuration | 🟠 High | **Yes** for apply | `region`, `cluster_id`, `namespace`, `deployment_name`, `min_replicas`, `max_replicas`, `target_cpu_percent` |\r
\r
```bash\r
# Generate HPA manifest preview (read-only)\r
python3 scripts/huawei-cloud.py huawei_generate_cce_hpa_manifest \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> \\r
namespace=default deployment_name=\x3Cname> \\r
min_replicas=2 max_replicas=10 target_cpu_percent=60\r
\r
# Preview HPA configuration (no execution)\r
python3 scripts/huawei-cloud.py huawei_configure_cce_hpa \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> \\r
namespace=default deployment_name=\x3Cname> \\r
min_replicas=2 max_replicas=10 target_cpu_percent=60\r
\r
# Confirm and apply HPA configuration\r
python3 scripts/huawei-cloud.py huawei_configure_cce_hpa \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> \\r
namespace=default deployment_name=\x3Cname> \\r
min_replicas=2 max_replicas=10 target_cpu_percent=60 \\r
confirm=true\r
```\r
\r
---\r
\r
## Parameter Reference\r
\r
### Capacity Trend Analysis Parameters\r
\r
| Parameter | Required | Description |\r
|-----------|----------|-------------|\r
| `region` | Yes | Huawei Cloud region (e.g., `cn-north-4`) |\r
| `cluster_id` | Yes | CCE cluster ID |\r
| `hours` | No | Analysis window in hours, clamped to 1-744 (default: 6) |\r
| `output_dir` | No | Directory to write reports, charts, and history records |\r
| `history_dir` | No | Override the default history folder for recurring comparison |\r
| `business_namespaces` | No | Comma-separated namespace allowlist for business Deployments |\r
| `exclude_namespaces` | No | Comma-separated namespace exclude list (default: `kube-system`) |\r
| `target_cpu_percent` | No | Simulation CPU target utilization (default: 60) |\r
| `target_memory_percent` | No | Simulation memory target utilization (default: 70) |\r
| `headroom_percent` | No | Simulation headroom percentage (default: 15) |\r
| `bottleneck_percent` | No | Bottleneck threshold percentage (default: 80) |\r
| `action_note` | No | Record an optimization action or operational event for before-and-after comparison |\r
| `ak` | No | Access Key ID; `HUAWEI_AK` environment variable preferred |\r
| `sk` | No | Secret Access Key; `HUAWEI_SK` environment variable preferred |\r
| `project_id` | No | Huawei Cloud project ID; auto-obtained via IAM API when not provided |\r
\r
### HPA Configuration Parameters\r
\r
| Parameter | Required | Description |\r
|-----------|----------|-------------|\r
| `region` | Yes | Huawei Cloud region |\r
| `cluster_id` | Yes | CCE cluster ID |\r
| `namespace` | Yes | Kubernetes namespace of the target Deployment |\r
| `deployment_name` | Yes | Target Deployment name |\r
| `min_replicas` | Yes | HPA minimum replica count |\r
| `max_replicas` | Yes | HPA maximum replica count |\r
| `target_cpu_percent` | No | HPA target CPU utilization percentage (default: 60) |\r
| `target_memory_percent` | No | HPA target memory utilization percentage |\r
| `confirm` | No | Must be explicitly set to `true` to apply HPA configuration; without it, returns preview only |\r
\r
---\r
\r
## Output Format\r
\r
### Capacity Trend Report\r
\r
Each analysis run writes the following files:\r
\r
| File | Description |\r
|------|-------------|\r
| `capacity-trend-summary.json` | Full structured JSON output (see `references/output-schema.md`) |\r
| `capacity-trend-report.md` | Markdown report with trend statistics and recommendations |\r
| `capacity-trend-report.html` | HTML report with embedded SVG curve charts |\r
| `capacity-trend-chart.svg` | CPU/memory/disk trend curve chart |\r
| `capacity-simulation-chart.svg` | Simulation result curve chart |\r
| `history/capacity-trend-*.json` | Individual history record for recurring comparison |\r
| `capacity-trend-history.jsonl` | Append-only history log for cross-run comparison |\r
\r
### Key Output Fields\r
\r
| Field | Description |\r
|-------|-------------|\r
| `capacity_stats` | Per-resource trend statistics: avg, min, max, p95, latest, slope, trend direction, bottleneck prediction |\r
| `elasticity` | HPA coverage percentage, node autoscaler enabled status with min/max/current nodes |\r
| `simulation` | Recommended node counts, reducible nodes, capped sample percentage |\r
| `recommendations` | Prioritized optimization suggestions with area, reason, and configuration methods |\r
| `history_comparison` | Deltas between current and previous record when history is available |\r
| `data_gaps` | Missing metric data that prevents reliable trend conclusions |\r
\r
See `references/output-schema.md` for the full JSON response schema.\r
\r
---\r
\r
## Verification\r
\r
1. Run the dispatcher with a known region and cluster to confirm connectivity:\r
```bash\r
python3 scripts/huawei-cloud.py huawei_analyze_cce_capacity_trend \\r
region=cn-north-4 cluster_id=\x3Ccluster-id> hours=1\r
```\r
2. Verify that `capacity_stats` includes trend direction and bottleneck prediction for CPU, memory, and disk\r
3. Verify that `simulation.avg_recommended_nodes` and `max_recommended_nodes` are within autoscaler min/max bounds\r
4. Verify that `capacity-trend-report.html` contains embedded SVG charts\r
5. Run a second analysis and verify that `history_comparison` shows deltas from the first run\r
6. Test HPA preview workflow: call `huawei_configure_cce_hpa` without `confirm` and verify it returns a preview only\r
7. After a confirmed HPA change, run a new capacity analysis to compare before-and-after effects\r
\r
---\r
\r
## Best Practices\r
\r
1. Always use `huawei_analyze_cce_capacity_trend` as the main action; it collects, analyzes, simulates, and generates reports in a single call\r
2. Accept windows from 1 hour to 1 month; common schedules are every 6 hours, daily, weekly, and monthly\r
3. Do not treat a single period as enough evidence for aggressive downsizing; prefer at least two comparable records before lowering baseline capacity\r
4. If the simulation recommends lower capacity but p95 or max utilization is close to the bottleneck threshold, keep headroom and propose observation instead\r
5. For real changes, provide the exact reason, expected effect, rollback path, and validation checks\r
6. Configuration execution must be user-approved and should be followed by a new capacity record to compare before-and-after effects\r
7. Use `action_note` to record optimization actions so the next cycle can compare their effects\r
8. If AOM metrics are unavailable, report the gap and do not invent trend conclusions\r
9. Always consider both workload elasticity (HPA) and node elasticity (nodepool autoscaling) when making recommendations\r
\r
---\r
\r
## Reference Documents\r
\r
| Document | Description |\r
|----------|-------------|\r
| `references/workflow.md` | Capacity trend workflow: scope, collection, trend analysis, elasticity awareness, recurring comparison, and output order |\r
| `references/simulation-rules.md` | Simulation rules: targets, node simulation formula, HPA advice, node autoscaler advice, and execution boundaries |\r
| `references/output-schema.md` | Output JSON schema for capacity trend analysis results |\r
| [Huawei Cloud Python SDK Documentation](https://doc.huihua.com/api/sdk/python.html) | SDK reference |\r
| [Huawei Cloud API Explorer](https://support.huaweiicloud.com/apiexplorer/index.html) | API interactive explorer |\r
\r
---\r
\r
## Notes\r
\r
1. This skill has **read-only tools** (analysis, simulation, report generation) and **preview tools** for HPA configuration — applying configuration changes requires `confirm=true` two-step confirmation\r
2. Do not treat a single period as enough evidence for aggressive downsizing; prefer at least two comparable records\r
3. If simulation recommends lower capacity but p95 is near bottleneck threshold, keep headroom and propose observation\r
4. Never expose or log AK/SK or environment variable values\r
5. All actions are executed via `python3 scripts/huawei-cloud.py \x3Caction>`; do not use hcloud CLI or direct API calls\r
6. Use `action_note` to record optimization events so subsequent runs can validate their effects\r
7. If remediation actions are needed (scale, reboot, drain), output recommendations only and hand off to `huawei-cloud-cce-auto-remediation-runner`\r
\r
---\r
\r
## Common Pitfalls\r
\r
| Pitfall | Correct Approach |\r
|---------|-----------------|\r
| Treating a single period as enough evidence for downsizing | Prefer at least two comparable records before lowering baseline capacity |\r
| Recommending lower capacity when p95 is near bottleneck threshold | Keep headroom and propose observation; low average does not override high p95 |\r
| Applying HPA configuration without preview step | Always call `huawei_configure_cce_hpa` without `confirm` first to preview; only add `confirm=true` after explicit user approval |\r
| Inventing trend conclusions when AOM metrics are unavailable | Report the data gap explicitly; do not fabricate trend analysis from incomplete data |\r
| Ignoring node elasticity when making workload elasticity recommendations | Always consider both HPA coverage and nodepool autoscaling together; workload scaling is constrained by node capacity |\r
| Not running a follow-up analysis after configuration changes | After any confirmed change, run a new capacity analysis and compare before-and-after effects using `action_note` |\r
| Using default simulation targets for latency-sensitive or bursty systems | Lower CPU/memory targets or increase headroom for systems with burst patterns or strict latency requirements |\r
| Skipping history comparison for recurring runs | Always compare the latest record with previous records to track utilization deltas and validate recommendations |
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install huawei-cloud-cce-capacity-trend-forecaster - 安装完成后,直接呼叫该 Skill 的名称或使用
/huawei-cloud-cce-capacity-trend-forecaster触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Huawei Cloud Cce Capacity Trend Forecaster 是什么?
Use when analyzing Huawei Cloud CCE periodic capacity trends, forecasting resource bottlenecks, simulating node/workload elasticity policies, generating capa... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 35 次。
如何安装 Huawei Cloud Cce Capacity Trend Forecaster?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install huawei-cloud-cce-capacity-trend-forecaster」即可一键安装,无需额外配置。
Huawei Cloud Cce Capacity Trend Forecaster 是免费的吗?
是的,Huawei Cloud Cce Capacity Trend Forecaster 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Huawei Cloud Cce Capacity Trend Forecaster 支持哪些平台?
Huawei Cloud Cce Capacity Trend Forecaster 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Huawei Cloud Cce Capacity Trend Forecaster?
由 shijingcheng(@pintudeyudi)开发并维护,当前版本 v0.1.1。