buggood first issueteam/collie
Metriche repository
- Star
- (886 star)
- Metriche merge PR
- (Metriche PR in attesa)
Descrizione
Environmental Info:
- Host Cluster Version: 1.35.2+rke2r1
- K3KCLI Version: 1.1.0-rc2
- K3K Helm Chart Version: 1.1.0-rc2
- K3K Cluster Configuration: 1 server, shared mode
Note: This was observed when validating https://github.com/rancher/k3k/issues/560
Describe the bug:
Currently, k3kcli and the Cluster CR allow creating clusters with negative storage sizes. Cluster creation is attempted, but it ultimately fails with the following error:
StatefulSet.apps "k3k-<cluster>-server" is invalid: spec.volumeClaimTemplates[0].spec.resources[storage]: Invalid value: "-1G": must be greater than zero
It would be better if the CLI/API rejected negative values upfront.
Steps To Reproduce:
- Create a cluster with negative storage size:
k3kcli cluster create -n k3k-system --mode shared --storage-class-name longhorn --storage-request-size -1G --kubeconfig-server <server> testcluster
Expected behavior:
- CLI/API validates storageRequestSize before creating the cluster.
- Negative values are rejected immediately.
Actual behavior:
- CLI/API does not reject negative values upfront.
- Cluster creation fails only after attempting resource creation.
$ k3kcli cluster create -n k3k-system --mode shared --storage-class-name longhorn --storage-request-size -1G --kubeconfig-server <server> k3ksharedlonghorn8 --debug
INFO[0000] Creating cluster 'k3ksharedlonghorn8' in namespace 'k3k-system'
INFO[0001] Cluster details:
Mode: shared
Servers: 1
Version: v1.35.2 (Host: v1.35.2)
Persistence:
Type: dynamic
StorageClass: longhorn
Size: -1G
INFO[0001] Waiting for cluster to be available..
Error: failed to wait for cluster to become ready (status: Failed): cluster creation failed: Failed
FATA[0001] failed to wait for cluster to become ready (status: Failed): cluster creation failed: Failed
$ k3kcli cluster list | grep k3ksharedlonghorn8
k3k-system k3ksharedlonghorn8 shared Failed <none>
$ kubectl describe clusters.k3k.io -n k3k-system k3ksharedlonghorn8 | tail -5
k3k-k3ksharedlonghorn8-service.k3k-system
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning ProvisioningFailed 0s (x11 over 24s) k3k-cluster-controller StatefulSet.apps "k3k-k3ksharedlonghorn8-server" is invalid: spec.volumeClaimTemplates[0].spec.resources[storage]: Invalid value: "-1G": must be greater than zero
$ kubectl get pvc -n k3k-system | grep k3ksharedlonghorn8
$
cc @bigkevmcd