|
| 1 | +# Upgrading to v5.0 |
| 2 | + |
| 3 | +The v5.0 release of *kubernetes-engine* is a backwards incompatible |
| 4 | +release. |
| 5 | + |
| 6 | +## Migration Instructions |
| 7 | + |
| 8 | +### Node pool taints |
| 9 | +Previously, node pool taints could be set on all module versions. |
| 10 | + |
| 11 | +Now, to set taints you must use the beta version of the module. |
| 12 | + |
| 13 | +```diff |
| 14 | + module "kubernetes_engine_private_cluster" { |
| 15 | +- source = "terraform-google-modules/kubernetes-engine/google" |
| 16 | ++ source = "terraform-google-modules/kubernetes-engine/google//modules/beta-public-cluster" |
| 17 | +- version = "~> 4.0" |
| 18 | ++ version = "~> 5.0" |
| 19 | + } |
| 20 | +``` |
| 21 | + |
| 22 | +### Service Account creation |
| 23 | + |
| 24 | +Previously, if you explicitly specified a Service Account using the `service_account` variable on the module this was sufficient to force that Service Account to be used. |
| 25 | + |
| 26 | +Now, an additional `create_service_account` has been added with a default value of `true`. If you would like to use an explicitly created Service Account from outside the module, you will need to set `create_service_account` to `false` (in addition to passing in the Service Account email). |
| 27 | + |
| 28 | +No action is needed if you use the module's default service account. |
| 29 | + |
| 30 | +```diff |
| 31 | + module "kubernetes_engine_private_cluster" { |
| 32 | + source = "terraform-google-modules/kubernetes-engine/google" |
| 33 | +- version = "~> 4.0" |
| 34 | ++ version = "~> 5.0" |
| 35 | + |
| 36 | + service_account = " [email protected]" |
| 37 | ++ create_service_account = false |
| 38 | + # ... |
| 39 | + } |
| 40 | +``` |
| 41 | + |
| 42 | +### Resource simplification |
| 43 | +The `google_container_cluster` and `google_container_node_pool` resources previously were different between regional and zonal clusters. They have now been collapsed into a single resource using the `location` variable. |
| 44 | + |
| 45 | +If you are using regional clusters, no migration is needed. If you are using zonal clusters, a state migration is needed. You can use a [script](../helpers/migrate.py) we provided to determine the required state changes: |
| 46 | + |
| 47 | +1. Download the script |
| 48 | + |
| 49 | + ```sh |
| 50 | + curl -O https://raw.githubusercontent.com/terraform-google-modules/terraform-google-kubernetes-engine/v5.0.0/helpers/migrate.py |
| 51 | + chmod +x migrate.py |
| 52 | + ``` |
| 53 | + |
| 54 | +2. Run the script in dryrun mode to confirm the expected changes: |
| 55 | + |
| 56 | + ```sh |
| 57 | + $ ./migrate.py --dryrun |
| 58 | +
|
| 59 | + ---- Migrating the following modules: |
| 60 | + -- module.gke-cluster-dev.module.gke |
| 61 | + ---- Commands to run: |
| 62 | + terraform state mv -state terraform.tfstate "module.gke-cluster-dev.module.gke.google_container_cluster.zonal_primary[0]" "module.gke-cluster-dev.module.gke.google_container_cluster.primary[0]" |
| 63 | + terraform state mv "module.gke-cluster-dev.module.gke.google_container_node_pool.zonal_pools[0]" "module.gke-cluster-dev.module.gke.google_container_node_pool.pools[0]" |
| 64 | + ``` |
| 65 | + |
| 66 | +3. Execute the migration script |
| 67 | + |
| 68 | + ```sh |
| 69 | + $ ./migrate.py |
| 70 | +
|
| 71 | + ---- Migrating the following modules: |
| 72 | + -- module.gke-cluster-dev.module.gke |
| 73 | + ---- Commands to run: |
| 74 | + Move "module.gke-cluster-dev.module.gke.google_container_cluster.zonal_primary[0]" to "module.gke-cluster-dev.module.gke.google_container_cluster.primary[0]" |
| 75 | + Successfully moved 1 object(s). |
| 76 | + Move "module.gke-cluster-dev.module.gke.google_container_node_pool.zonal_pools[0]" to "module.gke-cluster-dev.module.gke.google_container_node_pool.pools[0]" |
| 77 | + Successfully moved 1 object(s). |
| 78 | + Move "module.gke-cluster-dev.module.gke.null_resource.wait_for_zonal_cluster" to "module.gke-cluster-dev.module.gke.null_resource.wait_for_cluster" |
| 79 | + Successfully moved 1 object(s). |
| 80 | + ``` |
| 81 | + |
| 82 | +4. Run `terraform plan` to confirm no changes are expected. |
0 commit comments