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] rancher2_cluster_v2 rolling_update argument configured as string instead of int #1454

Open
jsfrerot opened this issue Dec 13, 2024 · 0 comments
Labels

Comments

@jsfrerot
Copy link

Rancher Server Setup

  • Rancher version: 2.10
  • Installation option (Docker install/Helm Chart): Docker

Information about the Cluster

  • Kubernetes version: v1.31.2+rke2r1
  • Cluster Type (Local/Downstream): Downstream, Infrastructure Provider: AWS/EC2

User Information

  • What is the role of the user logged in? Admin/Cluster

Provider Information

  • What is the version of the Rancher v2 Terraform Provider in use? 6.0.0
  • What is the version of Terraform in use? opentofu 1.8.6

Describe the bug

setting rolling_update arguments max_unavailable and max_surge are considered strings instead of in as per the following error message:

Failed to update fleet-default/testjs2-controlplane cluster.x-k8s.io/v1beta1, Kind=MachineDeployment for rke-cluster fleet-default/testjs2: admission webhook "validation.machinedeployment.cluster.x-k8s.io" denied the request: MachineDeployment.cluster.x-k8s.io "testjs2-controlplane" is invalid: [spec.strategy.rollingUpdate.maxSurge: Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:"1"}: must be either an int or a percentage: invalid value for IntOrString: invalid type: string is not a percentage, spec.strategy.rollingUpdate.maxUnavailable: Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:"1"}: must be either an int or a percentage: invalid value for IntOrString: invalid type: string is not a percentage]

The configuration used

resource "rancher2_cluster_v2" "rke2_cluster" {
  name               = var.cluster_name
  kubernetes_version = var.kubernetes_version

  rke_config {
    machine_pools {
      name                         = "controlplane"
      cloud_credential_secret_name = "cattle-global-data:cc-47v8l"
      control_plane_role           = true
      etcd_role                    = true
      worker_role                  = true
      quantity                     = 3
      drain_before_delete          = true
      rolling_update {
        max_unavailable = 1
        max_surge = 1
      }
      machine_config {
        kind = rancher2_machine_config_v2.node_config.kind
        name = rancher2_machine_config_v2.node_config.name
      }
      # using workaround: https://github.com/rancher/terraform-provider-rancher2/issues/949
      machine_labels = {
        role = "storage-node"
      }
    }

    upgrade_strategy {
      control_plane_concurrency = "1"
      worker_concurrency        = "1"
      control_plane_drain_options {
        delete_empty_dir_data = true
      }
      worker_drain_options {
        delete_empty_dir_data = true
      }
    }
    machine_global_config = <<EOF
cni: cilium
cluster-cidr: "172.16.0.0/16"
service-cidr: "172.17.0.0/16"
EOF
  }
}

Updating the cluster configuration yaml we can see it's a string:

        rollingUpdate:
          maxSurge: '1'
          maxUnavailable: '1'

Manually changing the yaml to the following works

        rollingUpdate:
          maxSurge: 1
          maxUnavailable: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant