#Declare a Backend within a PVC.yaml

1 messages · Page 1 of 1 (latest)

lime trench
#

Hi everybody. I am playing around with trident and created multiple backends that use different Data-LIFs. I now want to control the backend my PVs get provisioned to, when I create a PVC. However I have not found any documentation about this, is it even possible?

I know that I can import existing volumes in ONTAP with tridentctl and specify a backend. So theoretically I should be able to specify the Backend in my PVC?

Thanks in advance!

mint marsh
pearl terrace
#

yeah, the chain goes PVC->StorageClass->Backend so for multiple backends you need multiple StorageClasses. You should also make sure that only one of them has the "default" annotation otherwise it will be a bit random if you forget to specify the SC in the PVC

lime trench
#

I tested it and it seems like the selector flag is not supported on the storage-class in the yaml format. Do I have to use the json format with tridentctl?

#

This is my sc yaml.

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: test1
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: csi.trident.netapp.io
parameters:
  backendType: "ontap-nas"
  provisioningType: "thin"
  snapshots: "true"
selector: "test=lif1"
reclaimPolicy: Delete
allowVolumeExpansion: true

#

The error:

StorageClass in version "v1" cannot be handled as a StorageClass: strict decoding error: unknown field "selector"

pearl terrace
#

selector should be under parameters, not at top level

#

something like

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: test1
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
provisioner: csi.trident.netapp.io
parameters:
  backendType: "ontap-nas"
  selector: "cluster=cl1; disktype=sata"
allowVolumeExpansion: true
lime trench
#

I've tried that too, but then trident doesn't recognize the storageclass.

Tridentctl get storageclass is empty when I put it under parameters.

I guess my backend must be wrongly configured then.

The label on the backend is configured like this?

  storage:
    - labels:
        cluster: lif1
pearl terrace
#

the backend should look something like this:

apiVersion: trident.netapp.io/v1
kind: TridentBackendConfig
metadata:
  name: backend-test
  namespace: trident
spec:
  version: 1
  storageDriverName: ontap-nas
  managementLIF: 10.x.x.x
  dataLIF: 10.x.x.x
  backendName: backend-test
  storagePrefix: "test_"
  aggregate: aggrSATA
  credentials:
    name: trident-secret
  labels:
    k8scluster: prod
    cluster: cl1
    disktype: sata
  limitVolumeSize: 100Gi
  nfsMountOptions: nfsvers=3,rsize=65536,wsize=65536
  defaults:
    spaceReserve: none
    exportPolicy: default
    snapshotPolicy: none
    snapshotReserve: '0'
  deletionPolicy: retain
lime trench
#

Hmm it seems like dots are the problem. I had dots in the label value.

labels:
  cluster: test.lif1

Without the dot it works.

#

Thank you for the support ❤️😊

lime trench
#

And capital characters also don't seem to work