Skip to content

Commit

Permalink
Fix nodes taints config
Browse files Browse the repository at this point in the history
  • Loading branch information
gkocur committed Jun 11, 2024
1 parent 79e3906 commit 8c63be2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,20 @@ No requirements.

## node_pools variable
The node_pools variable takes the following parameters:
| Name | Description | Default | Requirement |
| --- | --- | --- | --- |
| <a name="autoscaling"></a> [autoscaling](#autoscaling) | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | `true` | Optional |
| <a name="node_locations"></a> [node\_locations](#node\_locations) | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | `""` | Optional |
| <a name="node_count"></a> [node\_count](#node\_count) | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | `1` | Required |
| <a name="min_count"></a> [min\_count](#min\_count) | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | `1` | Optional |
| <a name="max_count"></a> [max\_count](#max\_count) | Maximum number of nodes in the NodePool. Must be >= min_count | `100` | Optional |
| <a name="image_type"></a> [image\_type](#image\_type) | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | `COS_CONTAINERD` | Optional |
| <a name="machine_type"></a> [machine\_type](#machine\_type) | The name of a Google Compute Engine machine type | `e2-medium` | Optional |
| <a name="min_cpu_platform"></a> [min\_cpu\_platform](#min\_cpu\_platform) | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | `""` | Optional |
| <a name="local_ssd_count"></a> [local\_ssd\_count](#local\_ssd\_count) | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | `0` | Optional |
| <a name="disk_size_gb"></a> [disk\_size\_gb](#disk\_size\_gb) | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | `100` | Optional |
| <a name="preemptible"></a> [preemptible](#preemptible) | A boolean that represents whether or not the underlying node VMs are preemptible. See the [official documentation](https://cloud.google.com/container-engine/docs/preemptible-vm)</a> for more information.) | `false` | Optional |
| <a name="spot"></a> [spot](#spot) | A boolean that represents whether the underlying node VMs are spot. See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/concepts/spot-vms) for more information. | `false` | Optional |
| <a name="compact_placement_policy"></a> [compact\_placement\_policy](#compact\_placement\_policy) | Compact placement policy enabled places node pool's nodes in a closer physical proximity in order to reduce network latency between nodes. | `false` | Optional |

| Name | Description | Default | Requirement |
|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------| --- |
| <a name="autoscaling"></a> [autoscaling](#autoscaling) | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | `true` | Optional |
| <a name="node_locations"></a> [node\_locations](#node\_locations) | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | `""` | Optional |
| <a name="node_count"></a> [node\_count](#node\_count) | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | `1` | Required |
| <a name="min_count"></a> [min\_count](#min\_count) | Minimum number of nodes in the NodePool. Must be >=0 and <= max_count. Should be used when autoscaling is true | `1` | Optional |
| <a name="max_count"></a> [max\_count](#max\_count) | Maximum number of nodes in the NodePool. Must be >= min_count | `100` | Optional |
| <a name="image_type"></a> [image\_type](#image\_type) | The image type to use for this node. Note that changing the image type will delete and recreate all nodes in the node pool | `COS_CONTAINERD` | Optional |
| <a name="machine_type"></a> [machine\_type](#machine\_type) | The name of a Google Compute Engine machine type | `e2-medium` | Optional |
| <a name="min_cpu_platform"></a> [min\_cpu\_platform](#min\_cpu\_platform) | Minimum CPU platform to be used by the nodes in the pool. The nodes may be scheduled on the specified or newer CPU platform. | `""` | Optional |
| <a name="local_ssd_count"></a> [local\_ssd\_count](#local\_ssd\_count) | The amount of local SSD disks that will be attached to each cluster node and may be used as a `hostpath` volume or a `local` PersistentVolume. | `0` | Optional |
| <a name="disk_size_gb"></a> [disk\_size\_gb](#disk\_size\_gb) | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | `100` | Optional |
| <a name="preemptible"></a> [preemptible](#preemptible) | A boolean that represents whether or not the underlying node VMs are preemptible. See the [official documentation](https://cloud.google.com/container-engine/docs/preemptible-vm)</a> for more information.) | `false` | Optional |
| <a name="spot"></a> [spot](#spot) | A boolean that represents whether the underlying node VMs are spot. See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/concepts/spot-vms) for more information. | `false` | Optional |
| <a name="compact_placement_policy"></a> [compact\_placement\_policy](#compact\_placement\_policy) | Compact placement policy enabled places node pool's nodes in a closer physical proximity in order to reduce network latency between nodes. | `false` | Optional |
| <a name="taints"></a> [taints](#taints) | List of objects, each object needs a `key`, `value`, and `effect` fields. | `[]` | Optional |
10 changes: 9 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ resource "google_container_node_pool" "pools" {
labels = lookup(each.value, "labels", {})
oauth_scopes = lookup(each.value, "oauth_scopes", var.default_node_pools_oauth_scopes)
service_account = lookup(each.value, "service_account", null)
taint = lookup(each.value, "taint", [])

dynamic "taint" {
for_each = lookup(each.value, "taints", [])
content {
key = each.key
value = each.value
effect = each.taint
}
}

dynamic "guest_accelerator" {
for_each = lookup(each.value, "guest_accelerator", null) != null ? [1] : []
Expand Down

0 comments on commit 8c63be2

Please sign in to comment.