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]: Two StorageClasses are set as default #1545

Open
janfrederik opened this issue Nov 13, 2024 · 4 comments
Open

[Bug]: Two StorageClasses are set as default #1545

janfrederik opened this issue Nov 13, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@janfrederik
Copy link
Contributor

Description

When setting enable_local_storage = true in kube.tf, two StorageClasses are created, as expected:

$ kubectl get storageclass
NAME                       PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
hcloud-volumes (default)   csi.hetzner.cloud       Delete          WaitForFirstConsumer   true                   111m
local-path (default)       rancher.io/local-path   Delete          WaitForFirstConsumer   false                  111m

However, both have annotation "storageclass.kubernetes.io/is-default-class":"true".
This is not what we want, because now it is unclear which one kubernetes will use.

Kube.tf file

module "kube-hetzner" {
  providers = {
    hcloud = hcloud
  }
  hcloud_token = var.hcloud_token
  source = "kube-hetzner/kube-hetzner/hcloud"
  ssh_public_key = file("~/.ssh/id_ed25519.pub")
  ssh_private_key = file("~/.ssh/id_ed25519")
  control_plane_nodepools = [
    {
      name        = "control-plane-hel1",
      server_type = "cax11",
      location    = "hel1",
      count       = 1,
      labels      = [],
      taints      = [],
    },
  ]
  hetzner_csi_version = "v2.10.0"
  enable_local_storage = true
}

provider "hcloud" {
  token = var.hcloud_token
}

terraform {
  required_version = ">= 1.5.0"
  required_providers {
    hcloud = {
      source  = "hetznercloud/hcloud"
      version = ">= 1.43.0"
    }
  }
}

output "kubeconfig" {
  value     = module.kube-hetzner.kubeconfig
  sensitive = true
}

variable "hcloud_token" {
  sensitive = true
  default   = ""
}

Screenshots

No response

Platform

linux

@janfrederik janfrederik added the bug Something isn't working label Nov 13, 2024
@janfrederik
Copy link
Contributor Author

According to k3s-io/k3s#3445 (comment), the local-path provider is set as default on each reboot.

Workaround: disable local-storage anyway and install it manually or through helm afterwards.

@mysticaltech
Copy link
Collaborator

@janfrederik But that's not a problem, is it? Just specify the class you want in your pvc definition.

@janfrederik
Copy link
Contributor Author

@mysticaltech Yes, when I have full control, I can always choose the storageclass in a pvc.
However, not all helm charts provide a configurable value for the storageclass. And it's just easier as well to not having to bother looking up how to configure it ;-)

Do you want me to create a pull request or do you prefer to drop this anyway?

@janfrederik
Copy link
Contributor Author

janfrederik commented Nov 28, 2024

I created #1572 to mention this issue in the doc. That's the most pragmatic solution :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants