rancher / k3k

Kubernetes in Kubernetes
Apache License 2.0
131 stars 21 forks source link

Controller allows cluster deployment in the k3k-system namespace if the cluster name is "system" #69

Closed maxsokolovsky closed 8 months ago

maxsokolovsky commented 9 months ago

If I create a cluster named "system", the k3k controller tries to create a namespace called "k3k-system", which succeeds whether it already exists or not. The cluster is deployed in this special k3k-system namespace. The problem is that when the chart if uninstalled, Helm will also take down the namespace with the k3k cluster with it, which may be undesirable.

A possible solution may be to not allow a k3k cluster whose name is "system" or change the namespace naming scheme

galal-hussein commented 8 months ago

Tested with: v0.1.1-rc2

Creating a cluster object with the name "system" will result in the following error message:

I0105 23:43:51.014334       1 cluster.go:145] enqueue cluster [system]
E0105 23:43:51.014341       1 cluster.go:184] Invalid cluster name system, no action will be taken

using the k3kcli with create cluster with name system will result in:


k3kcli-amd64 cluster create  --servers 1 --agents 0 --name system --token test
FATA[0000] invalid cluster name
``