|
| 1 | +--- |
| 2 | +page_title: "cloudpilotai_workload_autoscaler Resource - cloudpilotai" |
| 3 | +subcategory: "Workload Autoscaler" |
| 4 | +description: |- |
| 5 | + Manages the CloudPilot AI Workload Autoscaler with recommendation and autoscaling policies. |
| 6 | +--- |
| 7 | + |
| 8 | +# cloudpilotai_workload_autoscaler (Resource) |
| 9 | + |
| 10 | +Manages the CloudPilot AI Workload Autoscaler on a Kubernetes cluster. This resource installs the autoscaler components, configures recommendation policies, and sets up autoscaling policies for workload right-sizing. |
| 11 | + |
| 12 | +## Example Usage |
| 13 | + |
| 14 | +```terraform |
| 15 | +resource "cloudpilotai_workload_autoscaler" "example" { |
| 16 | + cluster_id = cloudpilotai_eks_cluster.my_cluster.cluster_id |
| 17 | + kubeconfig = "/path/to/kubeconfig" |
| 18 | +
|
| 19 | + recommendation_policies { |
| 20 | + name = "default-rp" |
| 21 | + strategy_type = "percentile" |
| 22 | + percentile_cpu = 95 |
| 23 | + percentile_memory = 95 |
| 24 | + history_window_cpu = "168h" |
| 25 | + history_window_memory = "168h" |
| 26 | + evaluation_period = "1h" |
| 27 | + } |
| 28 | +
|
| 29 | + autoscaling_policies { |
| 30 | + name = "default-ap" |
| 31 | + enable = true |
| 32 | + recommendation_policy_name = "default-rp" |
| 33 | +
|
| 34 | + target_refs { |
| 35 | + api_version = "apps/v1" |
| 36 | + kind = "Deployment" |
| 37 | + } |
| 38 | +
|
| 39 | + update_schedules { |
| 40 | + name = "default" |
| 41 | + mode = "inplace" |
| 42 | + } |
| 43 | + } |
| 44 | +
|
| 45 | + enable_proactive = [ |
| 46 | + { |
| 47 | + namespaces = ["my-namespace"] |
| 48 | + } |
| 49 | + ] |
| 50 | +
|
| 51 | + disable_proactive = [ |
| 52 | + { |
| 53 | + namespaces = ["kube-system"] |
| 54 | + } |
| 55 | + ] |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +## Schema |
| 60 | + |
| 61 | +### Required |
| 62 | + |
| 63 | +- `cluster_id` (String) — The CloudPilot AI cluster ID to deploy Workload Autoscaler on. |
| 64 | +- `kubeconfig` (String) — Path to the kubeconfig file for the target Kubernetes cluster. |
| 65 | + |
| 66 | +### Optional |
| 67 | + |
| 68 | +- `storage_class` (String) — StorageClass name for VictoriaMetrics persistent volume. Default: cluster default. |
| 69 | +- `enable_node_agent` (Boolean) — Enable the Node Agent DaemonSet for per-node metrics. Default: `true`. |
| 70 | +- `recommendation_policies` (List of Object) — List of recommendation policies. See [Recommendation Policy](#recommendation-policy) below. |
| 71 | +- `autoscaling_policies` (List of Object) — List of autoscaling policies. See [Autoscaling Policy](#autoscaling-policy) below. |
| 72 | +- `enable_proactive` (List of Object) — Workload filters to enable proactive optimization. See [Proactive Filter](#proactive-filter) below. |
| 73 | +- `disable_proactive` (List of Object) — Workload filters to disable proactive optimization. See [Proactive Filter](#proactive-filter) below. |
| 74 | + |
| 75 | +### Recommendation Policy |
| 76 | + |
| 77 | +Each recommendation policy supports: |
| 78 | + |
| 79 | +| Attribute | Type | Required | Description | |
| 80 | +|-----------|------|----------|-------------| |
| 81 | +| `name` | String | Yes | Policy name | |
| 82 | +| `strategy_type` | String | No | Strategy type (`percentile`). Default: `percentile` | |
| 83 | +| `percentile_cpu` | Number | No | CPU percentile (50-100). Default: `95` | |
| 84 | +| `percentile_memory` | Number | No | Memory percentile (50-100). Default: `95` | |
| 85 | +| `history_window_cpu` | String | Yes | CPU history window duration (e.g. `168h`) | |
| 86 | +| `history_window_memory` | String | Yes | Memory history window duration | |
| 87 | +| `evaluation_period` | String | Yes | Evaluation period duration (e.g. `1h`) | |
| 88 | +| `buffer_cpu` | String | No | CPU buffer (e.g. `10%` or `100m`) | |
| 89 | +| `buffer_memory` | String | No | Memory buffer (e.g. `10%` or `128Mi`) | |
| 90 | +| `request_min_cpu` | String | No | Minimum CPU request recommendation | |
| 91 | +| `request_min_memory` | String | No | Minimum Memory request recommendation | |
| 92 | +| `request_max_cpu` | String | No | Maximum CPU request recommendation | |
| 93 | +| `request_max_memory` | String | No | Maximum Memory request recommendation | |
| 94 | + |
| 95 | +### Autoscaling Policy |
| 96 | + |
| 97 | +Each autoscaling policy supports: |
| 98 | + |
| 99 | +| Attribute | Type | Required | Description | |
| 100 | +|-----------|------|----------|-------------| |
| 101 | +| `name` | String | Yes | Policy name | |
| 102 | +| `enable` | Boolean | No | Whether enabled. Default: `true` | |
| 103 | +| `recommendation_policy_name` | String | Yes | Associated recommendation policy | |
| 104 | +| `priority` | Number | No | Priority (higher wins). Default: `0` | |
| 105 | +| `update_resources` | List(String) | No | Resources to optimize (e.g. `["cpu", "memory"]`) | |
| 106 | +| `drift_threshold_cpu` | String | No | CPU drift threshold | |
| 107 | +| `drift_threshold_memory` | String | No | Memory drift threshold | |
| 108 | +| `on_policy_removal` | String | No | Behavior on removal: `off`, `recreate`, `inplace`. Default: `off` | |
| 109 | +| `target_refs` | List(Object) | No | Target workload references | |
| 110 | +| `update_schedules` | List(Object) | No | Update schedule items | |
| 111 | +| `limit_policies` | List(Object) | No | Per-resource limit policies | |
| 112 | +| `startup_boost_enabled` | Boolean | No | Enable startup resource boost. Default: `false` | |
| 113 | +| `in_place_fallback_default_policy` | String | No | Fallback policy: `recreate` or `hold` | |
| 114 | + |
| 115 | +### Proactive Filter |
| 116 | + |
| 117 | +Each `enable_proactive` and `disable_proactive` entry supports the same set of filter attributes: |
| 118 | + |
| 119 | +| Attribute | Type | Required | Description | |
| 120 | +|-----------|------|----------|-------------| |
| 121 | +| `workload_name` | String | No | Filter by workload name (substring match) | |
| 122 | +| `namespaces` | List(String) | No | Namespaces to filter workloads | |
| 123 | +| `workload_kinds` | List(String) | No | Workload kinds (e.g. `Deployment`, `StatefulSet`) | |
| 124 | +| `autoscaling_policy_names` | List(String) | No | Filter by autoscaling policy names | |
| 125 | +| `workload_state` | String | No | Filter by workload state | |
| 126 | +| `optimization_states` | List(String) | No | Filter by optimization states | |
| 127 | +| `disable_proactive_update` | Boolean | No | Filter by whether proactive update is disabled | |
| 128 | +| `recommendation_policy_names` | List(String) | No | Filter by recommendation policy names | |
| 129 | +| `runtime_languages` | List(String) | No | Filter by container runtime languages | |
| 130 | +| `optimized` | Boolean | No | Filter by whether the workload is optimized | |
| 131 | + |
| 132 | +## Import |
| 133 | + |
| 134 | +This resource does not support import. |
0 commit comments