cockroach-operator icon indicating copy to clipboard operation
cockroach-operator copied to clipboard

[BUG] Setting `spec.dataStore.supportsAutoResize` to `true` does not enable auto resizing

Open hoyhbx opened this issue 3 years ago • 0 comments

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:
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 <filename> -n cockroach-operator-system)

  1. 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.
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 handling it in resize_pvc.go is commented.

hoyhbx avatar Jun 17 '22 01:06 hoyhbx