operator icon indicating copy to clipboard operation
operator copied to clipboard

PVC autoscaling.

Open 0megam opened this issue 1 year ago • 1 comments

Is it feasible to concurrently utilize operators such as https://github.com/DevOps-Nirvana/Kubernetes-Volume-Autoscaler alongside the VM operator? My understanding is that the Kubernetes volume autoscaler will adjust PVC resources to scale up PV, but I presume the VM operator may revert these changes.

0megam avatar Feb 08 '24 08:02 0megam

Hello,

I think, it's possible to use PVC autoscaling with operator. Operator checks the actual size of pvc and compares it with claimTemplate defined at statefulset. It it's bigger, operator logs and error and do nothing with this pvc. It's a case for vmstorage, vmselect, vmagent and vmalertmanager.

For vmsingle, it's possible to use external pvc and operator will ignore it's size.

I think, we could add special annotation for claim template, that we'll delegate PVC resize to the external controller such as volume-auto-scaler.

cc @Haleygo

f41gh7 avatar Feb 08 '24 17:02 f41gh7

Since v0.42.0 release, it's possible to add special annotation operator.victoriametrics.com/pvc-allow-volume-expansion: "false". It prevents operator from scaling persistent volumes and delegates control over it to external tool.

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMCluster
metadata:
  name: example-vmcluster-persistent
spec:
  retentionPeriod: "4"
  replicationFactor: 2
  vmstorage:
    replicaCount: 2
    storageDataPath: "/vm-data"
    storage:
      volumeClaimTemplate:
        metadata:
         annotations:
          operator.victoriametrics.com/pvc-allow-volume-expansion: "false"
        spec:
          storageClassName: sc-immutable
          resources:
            requests:
              storage: 10Gi
  vmselect:
    replicaCount: 2
    cacheMountPath: "/select-cache"
    storage:
      volumeClaimTemplate:
        metadata:
         annotations:
          operator.victoriametrics.com/pvc-allow-volume-expansion: "false"
        spec:
          storageClassName: sc-mutable
          resources:
            requests:
              storage: 2Gi
  vminsert:
    replicaCount: 2

f41gh7 avatar Apr 18 '24 09:04 f41gh7