operator icon indicating copy to clipboard operation
operator copied to clipboard

VMSingle with storageDataPath and external PVC doesn't create any Pod

Open kernel164 opened this issue 3 years ago • 3 comments

if I use following VMSingle CR. it doesn't create any VMSingle pod.

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMSingle
spec:
  storageDataPath: /data
  volumeMounts:
    - mountPath: /data
      name: data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: pvc-vmsingle-data

kernel164 avatar Dec 27 '21 19:12 kernel164

{"level":"error","ts":1640666777.92905,"logger":"controller.vmsingle","msg":"Reconciler error","reconciler group":"operator.victoriametrics.com","reconciler kind":"VMSingle","name":"demo","namespace":"gravity-observability-system","error":"cannot create new vmsingle deploy: Deployment.apps \"vmsingle-demo\" is invalid: spec.template.spec.containers[0].volumeMounts[1].mountPath: Invalid value: \"/data\": must be unique","stacktrace":"sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\tsigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:214"}

https://github.com/VictoriaMetrics/operator/blob/53b34c6dfe35efbd158e0844afe2b6cdd1d98de6/controllers/factory/vmsingle.go#L207-L214

https://github.com/VictoriaMetrics/operator/blob/53b34c6dfe35efbd158e0844afe2b6cdd1d98de6/controllers/factory/vmsingle.go#L235-L240

when storageSpec == nil, empty dir volume source is set which is causing this issue.

kernel164 avatar Dec 28 '21 05:12 kernel164

It's really uneven, need to fix it and make it more simple.

Can you try this one example:

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMSingle
spec:
  storage: {}
  storageDataPath: /data
  volumes:
    - name: data
      persistentVolumeClaim:
        claimName: pvc-vmsingle-data

f41gh7 avatar Dec 30 '21 13:12 f41gh7

@f41gh7 tried, works, seems operator will create a volumeMounts with the storageDataPath

wenerme avatar Mar 08 '22 18:03 wenerme