Advertisement
wagz

Trident pre-provision san-eco

Dec 11th, 2024
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 3.79 KB | None | 0 0
  1. In the context of NAS-ECO, here is what you can configure in Trident 24.10:
  2. LimitVolumeSize: limits the max size of a PVC (ie qtree)
  3. LimitVolumePoolSize: limits the max size of the FlexVol hosting the qtrees
  4. DenyNewVolumePools: avoids the creation of a new FlexVol when the current one is full
  5. QtreesPerFlexvol: defines the max number of Qtrees you want to have per FlexVol (default: 200, min: 50, max: 300)
  6.  
  7.  
  8. In ONTAP, you can:
  9. Limit the max number of FlexVol per SVM
  10. Limit the logical capacity assigned to a SVM (9.13+, no MCC)
  11.  
  12.  
  13. You can also pre-provision FlexVol that Trident will pick up (or create a dummy PVC, which triggers the creation of a FlexVol, delete the PVC, & patch the TBC with denyNewVolumePools)
  14.  
  15. The difficult part is to find the correct configuration of the FlexVol when doing it manually
  16.  
  17.  
  18.  
  19. Example or pre-provisioned FlexVol:
  20.  
  21.  
  22. My Trident Backend:
  23.  
  24.  
  25. cat << EOF | kubectl apply -f -
  26.  
  27. apiVersion: trident.netapp.io/v1
  28.  
  29. kind: TridentBackendConfig
  30.  
  31. metadata:
  32.   name: backend-nas-eco2
  33.  
  34.   namespace: trident
  35.  
  36. spec:
  37.   version: 1
  38.  
  39.   backendName: nas-eco2
  40.  
  41.   storageDriverName: ontap-nas-economy
  42.  
  43.   managementLIF: 192.168.0.133
  44.  
  45.   storagePrefix: eco2_
  46.  
  47.   autoExportCIDRs:
  48.   - 192.168.0.0/24
  49.  
  50.   autoExportPolicy: true
  51.  
  52.   denyNewVolumePools: "true"
  53.  
  54.   limitVolumeSize: 15Gi
  55.  
  56.   limitVolumePoolSize: 20Gi
  57.  
  58.   qtreesPerFlexvol: '50'
  59.  
  60.   defaults:
  61.     nameTemplate: "{{ .config.StoragePrefix }}_{{ .volume.Namespace }}_{{ .volume.RequestName }}"
  62.  
  63.   credentials:
  64.     name: secret-nas-svm-creds
  65.  
  66. EOF
  67.  
  68.  
  69.  
  70.  
  71.  
  72. The API Calls to create the corresponding volume:
  73.  
  74.  
  75. curl -X POST -ku admin:Netapp1! -H "accept: application/json" -H "Content-Type: application/json" -d '{
  76.  
  77.  "name": "eco2_empty",
  78.  
  79.  "svm": {"name": "nassvm"}
  80.  
  81. }' https://cluster1.demo.netapp.com/api/protocols/nfs/export-policies
  82.  
  83.  
  84.  
  85. curl -X POST -ku admin:Netapp1! -H "accept: application/json" -H "Content-Type: application/json" -d '{
  86.  
  87.  "aggregates": [{"name": "aggr1"}],
  88.  
  89.  "comment": "",
  90.  
  91.  "guarantee":{"type":"none"},
  92.  
  93.  "name": "trident_qtree_pool_eco2_demo",
  94.  
  95.  "nas":{
  96.  
  97.        "export_policy":{"name":"eco2_empty"},
  98.  
  99.        "security_style":"unix",
  100.  
  101.        "unix_permissions":711
  102.  
  103.  },
  104.  
  105.  "size": "1073741824",
  106.  
  107.  "snapshot_policy":{"name":"none"},
  108.  
  109.  "space":{"snapshot":{"reserve_percent":0}},
  110.  
  111.  "state":"online",
  112.  
  113.  "style": "flexvol",
  114.  
  115.  "svm": {"name":"nassvm"},
  116.  
  117.  "tiering":{"policy":"none"}
  118.  
  119. }' https://cluster1.demo.netapp.com/api/storage/volumes
  120.  
  121.  
  122.  
  123. GETVOL=$(curl -X GET -ku admin:Netapp1! https://cluster1.demo.netapp.com/api/storage/volumes?fields=nas.path&name=trident_qtree_pool_eco2_demo&state=online&style=flexvol&svm.name=nassvm -H "accept: application/json")
  124.  
  125. VOLID=$(echo $GETVOL | jq -r .records[0].uuid)
  126.  
  127.  
  128.  
  129. curl -X POST -ku admin:Netapp1! -H "accept: application/json" -H "Content-Type: application/json" -d '{
  130.  
  131.      "qtree":{"name":""},
  132.  
  133.      "space":{"hard_limit":-1},
  134.  
  135.      "svm":{"name":"nassvm"},
  136.  
  137.      "type":"tree",
  138.  
  139.      "volume":{"name":"trident_qtree_pool_eco2_demo"}
  140.  
  141. }' https://cluster1.demo.netapp.com/api/storage/quota/rules
  142.  
  143.  
  144.  
  145. curl -X PATCH -ku admin:Netapp1! -H "accept: application/json" -H "Content-Type: application/json" -d '{
  146.  
  147.      "quota":{"enabled": "true"}
  148.  
  149. }' https://cluster1.demo.netapp.com/api/storage/volumes/$VOLID
  150.  
  151.  
  152.  
  153. curl -X PATCH -ku admin:Netapp1! -H "accept: application/json" -H "Content-Type: application/json" -d '{
  154.  
  155.      "snapshot_directory_access_enabled": "false"
  156.  
  157. }' https://cluster1.demo.netapp.com/api/storage/volumes/$VOLID
  158.  
  159.  
  160.  
  161. In order to retrieve the list of API calls for a specific TBC, you need to enable debug mode for Trident, which will log all the API calls.
  162.  
  163. From there, you need to retrieve all the POST/PATCH calls…
  164.  
  165.  
  166.  
  167. hth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement