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] "write-kubeconfig" and "write-kubeconfig-mode" ignored when used in machine_global_config #1384

Open
upics opened this issue Aug 7, 2024 · 0 comments
Labels

Comments

@upics
Copy link

upics commented Aug 7, 2024

Rancher Server Setup

  • Rancher version: 2.8.6

Information about the Cluster

  • Kubernetes version: v1.28.11+k3s2
  • Cluster Type (Local/Downstream): Downstream
    • If downstream, what type of cluster? : Custom

Provider Information

  • What is the version of the Rancher v2 Terraform Provider in use? 4.1.0
  • What is the version of Terraform in use? 1.7.5

Describe the bug

When using write-kubeconfig-mode to set 644 chmod to k3s.yaml file, via machine_global_config, seems that the parameter is ignored. Same for write-kubeconfig. Instead when using other parameters (https://docs.k3s.io/cli/server), they are correctly considered.

To Reproduce

resource "rancher2_cluster_v2" "cluster" {
  name = var.rancher.cluster.name
  kubernetes_version = var.rancher.cluster.k3s_version

  rke_config {
    machine_selector_config {
      machine_label_selector {
        match_labels = {
          "rke.cattle.io/worker-role" = "true",
        }
      }
      config = <<EOF
      system-default-registry: 
      EOF
    } 

    machine_global_config = yamlencode({
      system-default-registry = local.registry.url
      flannel-backend = "none"
      disable-network-policy = true
      cluster-init = true
      disable = "traefik"
      write-kubeconfig-mode = "0644"
      write-kubeconfig = "/tmp/kubeconfig_output"
      cluster-cidr = "192.168.201.0/24"
    })

    registries {
      configs {
        hostname = element(split("/", local.registry.url), 0)
        auth_config_secret_name = rancher2_secret_v2.auth-private-registry.name
        ca_bundle = join("",[one(values(tls_private_key.registry_cert_private_key)).private_key_pem, one(values(tls_locally_signed_cert.registry_cert)).cert_pem, one(values(tls_self_signed_cert.registry_ca_cert)).cert_pem])
      }
    }
  }
}

Actual Result

image

Expected Result

image

@upics upics added the kind/bug label Aug 7, 2024
@matttrach matttrach assigned matttrach and unassigned matttrach Aug 27, 2024
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

2 participants