Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] machine_labels are 'sticky' to the position of the machine_pool in the list of machine_pools #1254

Open
hansbogert opened this issue Oct 19, 2023 · 2 comments

Comments

@hansbogert
Copy link

hansbogert commented Oct 19, 2023

Rancher Server Setup

  • Rancher version: 2.7.6
  • Installation option (Docker install/Helm Chart):
    • If Helm Chart, Kubernetes Cluster and version (RKE1, RKE2, k3s, EKS, etc): rke2

Information about the Cluster

  • Kubernetes version: 1.26
  • Cluster Type (Local/Downstream): local
    • If downstream, what type of cluster? (Custom/Imported or specify provider for Hosted/Infrastructure Provider):

Provider Information

  • What is the version of the Rancher v2 Terraform Provider in use? 3.1.x
  • What is the version of Terraform in use? 1.5.2

Describe the bug

having machine labels in machine_pools causes unnecessary recreation of machine pools during deletion of other machine_pools. Worse though is that these newly recreated machine_pool machines now can have wrong machine_labels on them.

The situation in which this actually occurs is explained below.

To Reproduce

Have a cluster with the following machine_pools (in pseudo-config)

machine_pools:
  - pool1
  - pool2
    machine_labels:
      foo: bar
  - pool3

Remove pool1 using Terraform

Actual Result

in pseudo config:

machine_pools:
  - pool2
    machine_labels:
      foo: bar
  - pool3
    machine_labels:
      foo: bar

Expected Result

In pseudo config:

machine_pools:
  - pool2
    machine_labels:
      foo: bar
  - pool3

Additional context

There are multiple issues at play here:

  • machine_pools is a list. A set or map would've been a better choice.
  • The machine_labels is optional, but computed in the Terraform schema. Why is this computed? This is an edge case in the Terraform SDK, similar to this one

If the machine_labels does not need to be computed, then this issue is easily solved by removing the computed attribute. I've verified that the behavior is then correct.

@hansbogert hansbogert changed the title [BUG] machine_labels are [BUG] machine_labels are 'sticky' to the position of the machine_pool in the list of machine_pools Oct 19, 2023
@a-blender a-blender self-assigned this Nov 25, 2023
@kkaempf kkaempf removed the team/area2 label Dec 7, 2023
@hansbogert
Copy link
Author

@a-blender @kkaempf a gentle nudge for this issue; Is everything clear, or is more info or reproduction details needed?

@kkaempf kkaempf assigned snasovich and unassigned a-blender Apr 11, 2024
@kkaempf
Copy link
Contributor

kkaempf commented Apr 11, 2024

Reassigning for better visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants