cockroachdb / cockroachdb/cockroach-operator
[BUG] Setting `spec.dataStore.supportsAutoResize` to `true` does not enable auto resizing
- Dominant language
- Go
- Stars
- 318
- Forks
- 104
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 1
Description
**What version of operator are you using?**
commit 561cf47d783c368fd8795acb82a5a39099a35984 (HEAD -> master)
**What operating system and processor architecture are you using (`kubectl version`)?**
Ubuntu. 20.04
kubectl version Output
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.0", GitCommit:"4ce5a8954017644c5420bae81d72b09b735c21f0", GitTreeState:"clean", BuildDate:"2022-05-03T13:46:05Z", GoVersion:"go1.18.1", Compiler:"gc", Platform:"darwin/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.9", GitCommit:"6df4433e288edc9c40c2e344eb336f63fad45cd2", GitTreeState:"clean", BuildDate:"2022-05-19T19:53:08Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.24) and server (1.22) exceeds the supported minor version skew of +/-1
**What did you do?**
We are trying to enable the auto resizing feature for the PVC so that we do not need to restart the cluster to resize the PVC.
But it seems this field `supportsAutoResize` is a no-op. We changed the PVC size from `1Gi` to `2Gi`, but the PVC is not automatically resized to `2Gi`.
### Reproduce
1. We first applied the operator yaml file and crd yaml file.
2. Then we applied the following cr file to deploy the initial cockroachdb-operator:
```yaml
apiVersion: crdb.cockroachlabs.com/v1alpha1
kind: CrdbCluster
metadata:
name: test-cluster
spec:
additionalLabels:
crdb: is-cool
dataStore:
pvc:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
image:
name: cockroachdb/cockroach:v21.2.10
nodes: 3
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 100m
memory: 1Gi
tlsEnabled: true
```
(All files were applied using `kubectl apply -f -n cockroach-operator-system`)
3. Then we changed the PVC's size from 1Gi to 2Gi, at the same time changed the field `spec.dataStore.supportsAutoResize` to `true`, but the PVC size is not changed.
```yaml
apiVersion: crdb.cockroachlabs.com/v1alpha1
kind: CrdbCluster
metadata:
name: test-cluster
spec:
additionalLabels:
crdb: is-cool
dataStore:
pvc:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
volumeMode: Filesystem
supportsAutoResize: true
image:
name: cockroachdb/cockroach:v21.2.10
nodes: 3
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 100m
memory: 1Gi
tlsEnabled: true
```
**What did you expect to see and what did you see instead?**
We expect to see PVC resizing is automated after setting the field `spec.dataStore.supportsAutoResize` to `true`. However, the field `spec.dataStore.supportsAutoResize` has no effect.
**Possible cause**
We do not find any relevant functioning code in cockroach operator codebase that handles `spec.dataStore.supportsAutoResize`. The field `supportsAutoResize` is defined in cluster_types.go, but the only possible [code](https://github.com/cockroachdb/cockroach-operator/blob/561cf47d783c368fd8795acb82a5a39099a35984/pkg/actor/resize_pvc.go#L132) handling it in resize_pvc.go is commented.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supportsAutoResize definition in cluster_types.go and inspect the commented handling in pkg/actor/resize_pvc.go around line 132. Use the issue's two PVC manifests to reproduce the update, then confirm that changing the storage request with supportsAutoResize enabled resizes the PVC without restarting the cluster.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100