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] User Data and Network Data display incorrectly when provisioning RKE2 via terraform-provider-rancher2 #3598

Closed
lanfon72 opened this issue Mar 6, 2023 · 7 comments
Assignees
Labels
area/rke2 RKE2 area/ui kind/bug Issues that are defects reported by users or that we know have reached a real release need-reprioritize not-require/test-plan Skip to create a e2e automation test issue reproduce/always Reproducible 100% of the time severity/2 Function working but has a major issue w/o workaround (a major incident with significant impact)
Milestone

Comments

@lanfon72
Copy link
Member

lanfon72 commented Mar 6, 2023

Describe the bug

When provision RKE2 via terraform-provider-rancher2, UserData and NetworkData become garbled.
image

To Reproduce

Steps to reproduce the behavior:

  1. Install Harvester with any nodes
  2. Install Rancher
  3. Login to Harvester dashboard, create an image for VM creation
  4. Create a VM Network which able to access Rancher
  5. Install terraform-provider-rancher2
  6. Apply code snippet in Additional content
    • Update all UPPER_CASE info in the code snippet
  7. View RKE2 cluster config after It provisioned (configuration will not able to view before RKE2 provisioned)

Expected behavior

UserData and NetworkData should display as human readable.

Environment:

  • Harvester ISO version: v1.1-a002d078-head
  • ui-source Option: Auto
  • Underlying Infrastructure (e.g. Baremetal with Dell PowerEdge R630): qemu/KVM 3 nodes
  • Rancher Version:
    • v2.7-c24fb8b0869a0b445f55b3307c6ed4582e147747-head (Docker Image: 216bef921570)
    • v2.6-a55f968896341f311fc8302b3ed6247da3c13900-head (Docker Image: 122aa2f1b66b)

Additional context

ref to rancher/terraform-provider-rancher2#1051 (comment)

Code snippet as below:

terraform {
  required_providers {
    rancher2 = {
      source = "rancher/rancher2"
      version = "0.0.0-master"
    }
  }
}


provider "rancher2" {
  api_url    = "RANCHER_URL"
  access_key = "RANCHER_ACCESS_TOKEN"
  secret_key = "RANCHER_SECRET_KEY_FOR_TOKEN"
  insecure = true
}


data "rancher2_cluster_v2" "foo-harvester" {
  name = "vm"
}

# Create a new Cloud Credential for an imported Harvester cluster
resource "rancher2_cloud_credential" "foo-harvester" {
  name = "foo-harvester"
  harvester_credential_config {
    cluster_id = data.rancher2_cluster_v2.foo-harvester.cluster_v1_id
    cluster_type = "imported"
    kubeconfig_content = data.rancher2_cluster_v2.foo-harvester.kube_config
  }
}

# Create a new rancher2 machine config v2 using harvester node_driver
resource "rancher2_machine_config_v2" "foo-harvester-v2" {
  generate_name = "harv"
  harvester_config {
    vm_namespace = "default"
    cpu_count = "2"
    memory_size = "4"
    disk_info = <<EOF
    {
        "disks": [{
            "imageName": "IMAGE_ID",
            "size": 40,
            "bootOrder": 1
        },{
            "storageClassName": "harvester-longhorn",
            "size": 5,
            "bootOrder": 2
        }]
    }
    EOF
    network_info = <<EOF
    {
        "interfaces": [{
            "networkName": "VM_NETWORK_ID",
            "macAddress": ""
        },{
            "networkName": "VM_NETWORK_ID",
            "macAddress": ""
        }]
    }
    EOF
    ssh_user = "ubuntu"
    user_data = <<EOF
#cloud-config
password: password
chpasswd: {expire: False}
sshpwauth: True
EOF
    network_data = <<EOF
version: 1
config:
  - type: physical
    name: enp1s0
    subnets:
      - type: dhcp
  - type: physical
    name: enp2s0
    subnets:
      - type: dhcp
EOF
  }
}

resource "rancher2_cluster_v2" "foo-harvester-v2" {
  name = "harv2"
  kubernetes_version = "v1.24.9+rke2r2"
  rke_config {
    machine_pools {
      name = "pool1"
      cloud_credential_secret_name = rancher2_cloud_credential.foo-harvester.id
      control_plane_role = true
      etcd_role = true
      worker_role = true
      quantity = 1
      machine_config {
        kind = rancher2_machine_config_v2.foo-harvester-v2.kind
        name = rancher2_machine_config_v2.foo-harvester-v2.name
      }
    }
    machine_selector_config {
      config = {
        cloud-provider-name = ""
      }
    }
    machine_global_config = <<EOF
cni: "calico"
disable-kube-proxy: false
etcd-expose-metrics: false
EOF
    upgrade_strategy {
      control_plane_concurrency = "10%"
      worker_concurrency = "10%"
    }
    etcd {
      snapshot_schedule_cron = "0 */5 * * *"
      snapshot_retention = 5
    }
    chart_values = ""
  }
}
@lanfon72 lanfon72 added kind/bug Issues that are defects reported by users or that we know have reached a real release area/ui severity/1 Function broken (a critical incident with very high impact) area/rke2 RKE2 need-reprioritize reproduce/always Reproducible 100% of the time labels Mar 6, 2023
@lanfon72 lanfon72 added this to the v1.1.2 milestone Mar 6, 2023
@futuretea
Copy link
Contributor

This issue is not related to the multi disks and multi network issue,moved this issue to 1.2.0. cc @lanfon72

@futuretea futuretea modified the milestones: v1.1.2, v1.2.0 Mar 6, 2023
@futuretea futuretea added severity/2 Function working but has a major issue w/o workaround (a major incident with significant impact) and removed severity/1 Function broken (a critical incident with very high impact) labels Mar 6, 2023
@WuJun2016 WuJun2016 added the not-require/test-plan Skip to create a e2e automation test issue label Mar 8, 2023
@harvesterhci-io-github-bot
Copy link

harvesterhci-io-github-bot commented Mar 8, 2023

Pre Ready-For-Testing Checklist

* [ ] If labeled: require/HEP Has the Harvester Enhancement Proposal PR submitted?
The HEP PR is at:

* [ ] Is there a workaround for the issue? If so, where is it documented?
The workaround is at:

* [ ] Have the backend code been merged (harvester, harvester-installer, etc) (including backport-needed/*)?
The PR is at:

* [ ] Does the PR include the explanation for the fix or the feature?

* [ ] Does the PR include deployment change (YAML/Chart)? If so, where are the PRs for both YAML file and Chart?
The PR for the YAML change is at:
The PR for the chart change is at:

* [ ] If labeled: require/doc, require/knowledge-base Has the necessary document PR submitted or merged?
The documentation/KB PR is at:

* [ ] If NOT labeled: not-require/test-plan Has the e2e test plan been merged? Have QAs agreed on the automation test case? If only test case skeleton w/o implementation, have you created an implementation issue?
- The automation skeleton PR is at:
- The automation test case PR is at:

* [ ] If the fix introduces the code for backward compatibility Has a separate issue been filed with the label release/obsolete-compatibility?
The compatibility issue is filed at:

@WuJun2016
Copy link
Contributor

Hi, @lanfon72 Can you help verify this problem first ? It has been merged into rancher 2.7.2

@lanfon72
Copy link
Member Author

@WuJun2016 this also break on v2.6-head, are we going to fix them on v2.6?

@WuJun2016
Copy link
Contributor

@WuJun2016 this also break on v2.6-head, are we going to fix them on v2.6?

It won't be fixed in 2.6.11 because it's already released,
Maybe it should be fixed in 2.6-head, But there is no planned version (rancher 2.6.12) right now

@lanfon72
Copy link
Member Author

Tested with following cases:

  • UI fixed on Rancher v2.7-211409c9a689d8ee4d801ed1bce1d887b0fb4b00-head with Harvester v1.1.2-rc3, but RKE2 provision stuck.
  • UI not fixed on Rancher v2.7.2-rc5 with Harvester v1.1.2-rc3, but RKE2 provisioned successfully.

@lanfon72 lanfon72 self-assigned this Mar 15, 2023
@lanfon72
Copy link
Member Author

Verified this has been fixed.

image

Test Information

  • Environment: qemu/KVM single node
  • Harvester Version: v1.1.2-rc3
  • ui-source Option: Auto
  • Rancher Version: v2.7-cd1a71624a94de993d471ce8a643cf4d2dbb75a6-head

Verify Steps:

#cloud-config
package_update: true
packages:
  - qemu-guest-agent
runcmd:
  - - systemctl
    - enable
    - '--now'
    - qemu-guest-agent.service

Footnotes

  1. we changed to not install qemu-guest-agent automatically when using terraform in https://github.com/harvester/harvester/issues/3392

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rke2 RKE2 area/ui kind/bug Issues that are defects reported by users or that we know have reached a real release need-reprioritize not-require/test-plan Skip to create a e2e automation test issue reproduce/always Reproducible 100% of the time severity/2 Function working but has a major issue w/o workaround (a major incident with significant impact)
Projects
None yet
Development

No branches or pull requests

4 participants