Skip to content

Conversation

@yec-akamai
Copy link
Contributor

@yec-akamai yec-akamai commented Apr 1, 2025

📝 Description

This PR supports new fields k8s_version, rolling_update for LKE-enterprise node pool. Also improves the Update logic in the resource to better match our code standard and reduce sending unnecessary update calls.

✔️ How to Test

The linodego change hasn't merged yet. May need to pull this PR locally and replace the linodego dependency.

make test-unit

Run the whole lkenodepool integration test to make sure the new feature and improvement both works as expected.

make test-int PKG_NAME=lkenodepool

Manual test:

  1. In a sandbox environment, i.e. dx-devenv, pull the change and make sure you have the correct linodego. Input the following config:
provider "linode" {
  api_version="v4beta"
}

resource "linode_lke_cluster" "nodepool_test_cluster" {
  label       = "lke-e-nodepool-test-cluster"
  region      = "us-lax"
  k8s_version = "v1.31.1+lke4"
  tags        = ["nodepool_test_cluster"]
  external_pool_tags  = ["external"]
  tier = "enterprise"

  pool {
      type  = "g6-standard-1"
      count = 1
  }
}

resource "linode_lke_node_pool" "foobar" {
    cluster_id = linode_lke_cluster.nodepool_test_cluster.id
    node_count = 2
    type  = "g6-standard-2"
    k8s_version = linode_lke_cluster.nodepool_test_cluster.k8s_version
    update_strategy = "on_recycle"
    tags  = ["external", "my-pool"]
}
  1. Observe the cluster and node pool are created successfully.
  2. Test updating the update_strategy. For example, update the update_strategy to be rolling_update in the above config.
  3. Observe the update is successful.
  4. When the strategy is rolling_update, try to update k8s_version to be any value (since there is not another valid value for us to test). For example, update the k8s_version to be lke-version, and then make plan or tf plan. Observe that the plan requires replace, i.e.
Terraform will perform the following actions:

  # linode_lke_node_pool.foobar must be replaced

Feel free to play around with updating the resource to ensure the correctness.

@yec-akamai yec-akamai added new-feature for new features in the changelog. improvement for improvements in existing functionality in the changelog. labels Apr 1, 2025
@yec-akamai yec-akamai requested a review from a team as a code owner April 1, 2025 19:40
@yec-akamai yec-akamai requested review from ezilber-akamai and jriddle-linode and removed request for a team April 1, 2025 19:40
sr.Plan.GetAttribute(ctx, path.Root("update_strategy"), &strategy)
rrifr.RequiresReplace = strategy == "rolling_update"
},
"Triggers replacement when `k8s_version` is changed and `update_strategy` is rolling_update",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the design, Rolling Update strategy will immediately trigger a recycle of the node pool when the k8s version is updated. Unfortunately we don't have enough valid k8s version for testing. Can validate it once possible.

Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests passing locally. Nice work!

Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yec-akamai yec-akamai merged commit 55137a0 into dev Apr 7, 2025
9 checks passed
@yec-akamai yec-akamai deleted the TPT-3555/nodepool-enterprise branch April 7, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement for improvements in existing functionality in the changelog. new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants