Skip to content

Commit

Permalink
Merge pull request #621 from rawmind0/gkev2
Browse files Browse the repository at this point in the history
Added rancher2_cluster support to gke config v2
  • Loading branch information
rawmind0 authored May 7, 2021
2 parents 3a138db + 14d1013 commit 12451d6
Show file tree
Hide file tree
Showing 29 changed files with 2,511 additions and 88 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 1.14.0 (Unreleased)
## 1.14.0 (May 7, 2021)

FEATURES:

Expand All @@ -10,11 +10,15 @@ FEATURES:
* **New Argument:** `rancher2_cluster.rke_config.ingress.update_strategy` - (Optional) RKE ingress update strategy (list Maxitems: 1)
* **New Argument:** `rancher2_cluster.rke2_config` - (Optional/Computed) The RKE2 configuration for `rke2` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
* **New Argument:** `rancher2_cluster_sync.wait_alerting` - (Optional) Wait until alerting is up and running. Default: `false` (bool)
* **New Argument:** `rancher2_cluster.gke_config_v2` - (Optional) The Google GKE V2 configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.8 or above (list maxitems:1)
* **New Argument:** `rancher2_cloud_credential.google_credential_config` - (Optional) Google config for the Cloud Credential (list maxitems:1)

ENHANCEMENTS:

* Improved `rancher2_cluster_sync` with new cluster state check method and new option to wait until alerting is enabled
* Updated `rancher2_catalog_v2` schema resource, defining conflict between `git_repo` and `url` arguments
* Improved `rancher2_cluster_sync` with new cluster state check method and new option to wait until alerting is enabled
* Updated go mod to support Rancher `v2.5.8`
* Updated acceptance tests to use Rancher `v2.5.8`

BUG FIXES:

Expand Down
15 changes: 8 additions & 7 deletions docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ The following attributes are exported:
* `kube_config` - (Computed) Kube Config generated for the cluster (string)
* `ca_cert` - (Computed) K8s cluster ca cert (string)
* `system_project_id` - (Computed) System project ID for the cluster (string)
* `rke_config` - (Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke2_config` (list maxitems:1)
* `rke_config` - (Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `k3s_config` (list maxitems:1)
* `rke2_config` - (Computed) The RKE2 configuration for `rke2` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
* `k3s_config` - (Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `aks_config` - (Computed) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `eks_config` - (Computed) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `eks_config_v2` - (Computed) The Amazon EKS configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config`. For Rancher v2.5.x or above (list maxitems:1)
* `gke_config` - (Computed) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `oke_config` - (Computed) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `gke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `k3s_config` - (Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `rke_config` (list maxitems:1)
* `aks_config` - (Computed) The Azure aks configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
* `eks_config` - (Computed) The Amazon eks configuration for `eks` Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
* `eks_config_v2` - (Computed) The Amazon EKS V2 configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.x or above (list maxitems:1)
* `gke_config` - (Computed) The Google gke configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1) (list maxitems:1)
* `gke_config_v2` - (Computed) The Google GKE V2 configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.8 or above (list maxitems:1)
* `oke_config` - (Computed) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `k3s_config` and `rke_config` (list maxitems:1)
* `description` - (Computed) The description for Cluster (string)
* `cluster_auth_endpoint` - (Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
* `cluster_monitoring_input` - (Computed) Cluster monitoring config (list maxitems:1)
Expand Down
7 changes: 7 additions & 0 deletions docs/resources/cloud_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The following arguments are supported:
* `azure_credential_config` - (Optional) Azure config for the Cloud Credential (list maxitems:1)
* `description` - (Optional) Description for the Cloud Credential (string)
* `digitalocean_credential_config` - (Optional) DigitalOcean config for the Cloud Credential (list maxitems:1)
* `google_credential_config` - (Optional) Google config for the Cloud Credential (list maxitems:1)
* `linode_credential_config` - (Optional) Linode config for the Cloud Credential (list maxitems:1)
* `openstack_credential_config` - (Optional) OpenStack config for the Cloud Credential (list maxitems:1)
* `vsphere_credential_config` - (Optional) vSphere config for the Cloud Credential (list maxitems:1)
Expand Down Expand Up @@ -67,6 +68,12 @@ The following attributes are exported:

* `access_token` - (Required/Sensitive) DigitalOcean access token (string)

### `google_credential_config`

#### Arguments

* `auth_encoded_json` - (Required/Sensitive) Google auth encoded json (string)

### `linode_credential_config`

#### Arguments
Expand Down
193 changes: 186 additions & 7 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,78 @@ resource "rancher2_cluster" "foo" {
}
```

### Importing GKE cluster from Rancher v2, using `gke_config_v2`. For Rancher v2.5.8 or above.

```hcl
resource "rancher2_cloud_credential" "foo-google" {
name = "foo-google"
description= "Terraform cloudCredential acceptance test"
google_credential_config {
auth_encoded_json = file(<GOOGLE_AUTH_ENCODED_JSON>)
}
}
resource "rancher2_cluster" "foo" {
name = "foo"
description = "Foo rancher2 imported GKE cluster"
gke_config_v2 {
name = "foo"
google_credential_secret = rancher2_cloud_credential.foo-google.id
region = <REGION> # Zone argument could also be used instead of region
project_id = <PROJECT_ID>
imported = true
}
}
```

### Creating GKE cluster from Rancher v2, using `gke_config_v2`. For Rancher v2.5.8 or above.

**Note** At the moment, routed-based GKE clusters are not supported due to [rancher/issues/32585]](https://github.com/rancher/rancher/issues/32585)

```
resource "rancher2_cloud_credential" "foo-google" {
name = "foo-google"
description= "Terraform cloudCredential acceptance test"
google_credential_config {
auth_encoded_json = file(<GOOGLE_AUTH_ENCODED_JSON>)
}
}
resource "rancher2_cluster" "foo" {
name = "foo"
description = "Terraform GKE cluster"
gke_config_v2 {
name = "foo"
google_credential_secret = rancher2_cloud_credential.foo-google.id
region = <REGION> # Zone argument could also be used instead of region
project_id = <PROJECT_ID>
kubernetes_version = <K8S_VERSION>
network = <NETWORK>
subnetwork = <SUBNET>
node_pools {
initial_node_count = 1
max_pods_constraint = 110
name = <NODE_POOL_NAME>
version = <VERSION>
}
}
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) The name of the Cluster (string)
* `rke_config` - (Optional/Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke2_config` (list maxitems:1)
* `rke_config` - (Optional/Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `k3s_config` (list maxitems:1)
* `rke2_config` - (Optional/Computed) The RKE2 configuration for `rke2` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
* `k3s_config` - (Optional/Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `aks_config` - (Optional) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `eks_config` - (Optional) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `eks_config_v2` - (Optional) The Amazon EKS configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config`. For Rancher v2.5.x or above (list maxitems:1)
* `gke_config` - (Optional) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `gke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
* `k3s_config` - (Optional/Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `rke_config` (list maxitems:1)
* `aks_config` - (Optional) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
* `eks_config` - (Optional) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
* `eks_config_v2` - (Optional) The Amazon EKS V2 configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config`. For Rancher v2.5.x or above (list maxitems:1)
* `gke_config` - (Optional) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
* `gke_config_v2` - (Optional) The Google GKE V2 configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.8 or above (list maxitems:1)
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `k3s_config` and `rke_config` (list maxitems:1)
* `description` - (Optional) The description for Cluster (string)
* `cluster_auth_endpoint` - (Optional/Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
* `cluster_monitoring_input` - (Optional) Cluster monitoring config. Any parameter defined in [rancher-monitoring charts](https://github.com/rancher/system-charts/tree/dev/charts/rancher-monitoring) could be configured (list maxitems:1)
Expand Down Expand Up @@ -1275,6 +1334,126 @@ The following arguments are supported:
* `taints` - (Required) List of Kubernetes taints to be applied to each node (list)
* `zone` - (Optional) GKE cluster zone. Conflicts with `region` (string)

### `gke_config_v2`

#### Arguments

* `name` - (Required/ForceNew) The GKE ip v4 cidr block (string)
* `google_credential_secret` - (Required/Sensitive) Google credential secret (string)
* `project_id` - (Required/ForceNew) The GKE cluster project id (string)
* `cluster_ipv4_cidr_block` - (Optional/Computed/ForceNew) The GKE ip v4 cidr block (string)
* `cluster_addons` - (Optional/Computed) The GKE cluster addons (List maxitems:1)
* `description` - (Optional/Computed/ForceNew) The GKE cluster addons (string)
* `enable_kubernetes_alpha` - (Optional/Computed/ForceNew) Enable Kubernetes alpha. Default: `false` (bool)
* `ip_allocation_policy` - (Optional/Computed/ForceNew) The GKE ip allocation policy (List maxitems:1)
* `imported` - (Optional/ForceNew) Is GKE cluster imported? Default: `false` (bool)
* `kubernetes_version` - (Optional/Computed) The kubernetes master version. Required for create new cluster (string)
* `labels` - (Optional/Computed) The GKE cluster labels (map)
* `locations` - (Optional/Computed) The GKE cluster locations (List)
* `logging_service` - (Optional/Computed) The GKE cluster logging service (string)
* `maintenance_window` - (Optional/Computed) The GKE cluster maintenance window (string)
* `master_authorized_networks_config` - (Optional/Computed/ForceNew) The GKE cluster master authorized networks config (List maxitems:1)
* `monitoring_service` - (Optional/Computed) The GKE cluster monitoring service (string)
* `network` - (Optional/Computed/ForceNew) The GKE cluster network. Required for create new cluster (string)
* `network_policy_enabled` - (Optional/Computed) Is GKE cluster network policy enabled? Default: `false` (bool)
* `node_pools` - (Optional/Computed) The GKE cluster node pools. Required for create new cluster (List)
* `private_cluster_config` - (Optional/Computed/ForceNew) The GKE private cluster config (List maxitems:1)
* `region` - (Optional/Computed/ForceNew) The GKE cluster region. Required if `zone` not set (string)
* `subnetwork` - (Optional/Computed/ForceNew) The GKE cluster subnetwork. Required for create new cluster (string)
* `zone` - (Optional/Computed/ForceNew) The GKE cluster zone. Required if `region` not set (string)

#### `cluster_addons`

##### Arguments

* `http_load_balancing` - (Optional/Computed) Enable GKE HTTP load balancing. Default: `false` (bool)
* `horizontal_pod_autoscaling` - (Optional/Computed) Enable GKE horizontal pod autoscaling. Default: `false` (bool)
* `network_policy_config` - (Optional/Computed) Enable GKE network policy config. Default: `false` (bool)

#### `ip_allocation_policy`

##### Arguments

* `cluster_ipv4_cidr_block` - (Optional/Computed) The GKE cluster ip v4 allocation cidr block (string)
* `cluster_secondary_range_name` - (Optional/Computed) The GKE cluster ip v4 allocation secondary range name(string)
* `create_subnetwork` - (Optional/Computed) Create GKE subnetwork? Default: `false` (bool)
* `node_ipv4_cidr_block` - (Optional/Computed) The GKE node ip v4 allocation cidr block (string)
* `services_ipv4_cidr_block` - (Optional/Computed) The GKE services ip v4 allocation cidr block (string)
* `services_secondary_range_name` - (Optional/Computed) The GKE services ip v4 allocation secondary range name (string)
* `subnetwork_name` - (Optional/Computed) The GKE cluster subnetwork name (string)
* `use_ip_aliases` - (Optional/Computed) Use GKE ip aliases? Default: `true` (bool)

#### `master_authorized_networks_config`

##### Arguments

* `cidr_blocks` - (Required) The GKE master authorized network config cidr blocks (List)
* `enabled` - (Optional) Enable GKE master authorized network config Default: `false` (bool)

##### `cidr_blocks`

###### Arguments

* `cidr_block` - (Required) The GKE master authorized network config cidr block (string)
* `display_name` - (Optional) The GKE master authorized network config cidr block dispaly name (string)

#### `node_pools`

##### Arguments

* `name` - (Required) The GKE node pool config name (string)
* `initial_node_count` - (Required) The GKE node pool config initial node count (int)
* `version` - (Required) The GKE node pool config version. Required for create new cluster (string)
* `autoscaling` - (Optional/computed) The GKE node pool config autoscaling (List maxitems:1)
* `config` - (Optional/Computed/ForceNew) The GKE node pool node config (List maxitems:1)
* `management` - (Optional/Computed) The GKE node pool config management (List maxitems:1)
* `max_pods_constraint` - (Optional/Computed) The GKE node pool config max pods constraint. Required for create new cluster if `ip_allocation_policy.use_ip_aliases = true` (int)

##### `autoscaling`

###### Arguments

* `enabled` - (Optional) Enable GKE node pool config autoscaling. Default: `false` (bool)
* `max_node_count` - (Optional/Computed) The GKE node pool config max node count (int)
* `min_node_count` - (Optional/Computed) The GKE node pool config min node count (int)

##### `config`

###### Arguments

* `disk_size_gb` - (Optional/Computed) The GKE node config disk size Gb (int)
* `disk_type` - (Optional/Computed) The GKE node config disk type (string)
* `image_type` - (Optional/Computed) The GKE node config image type (string)
* `labels` - (Optional/Computed) The GKE node config labels (map)
* `local_ssd_count` - (Optional/Computed) The GKE node config local ssd count (int)
* `machine_type` - (Optional/Computed) The GKE node config machine type (string)
* `oauth_scopes` - (Optional) The GKE node config oauth scopes (List)
* `preemptible` - (Optional) Enable GKE node config preemptible. Default: `false` (bool)
* `taints` - (Optional) The GKE node config taints (List)

###### `taints`

####### Arguments

* `key` - (Required) The GKE taint key (string)
* `value` - (Required) The GKE taint value (string)
* `effect` - (Required) The GKE taint effect (string)

##### `management`

###### Arguments

* `auto_repair` - (Optional/Computed) Enable GKE node pool config management auto repair. Default: `false` (bool)
* `auto_upgrade` - (Optional/Computed) Enable GKE node pool config management auto upgrade. Default: `false` (bool)

#### `private_cluster_config`

##### Arguments

* `master_ipv4_cidr_block` - (Required) The GKE cluster private master ip v4 cidr block (string)
* `enable_private_endpoint` - (Optional) Enable GKE cluster private endpoint. Default: `false` (bool)
* `enable_private_nodes` - (Optional) Enable GKE cluster private endpoint. Default: `false` (bool)

### `oke_config`

#### Arguments
Expand Down
Loading

0 comments on commit 12451d6

Please sign in to comment.