libopenstorage / openstorage

A multi-host clustered implementation of the open storage specification
Apache License 2.0
526 stars 118 forks source link

[PWX-36749] Added pure_nfs_endpoint to PureFileSpec volume spec #2433

Closed vinayakshnd closed 7 months ago

vinayakshnd commented 7 months ago

What this PR does / why we need it:
Explain the PR and why it is needed.

Which issue(s) this PR fixes (optional)
Closes # https://purestorage.atlassian.net/browse/PWX-36749

Testing Notes
Unit tests ran locally successfully:

ok      github.com/libopenstorage/openstorage/alert 8.346s
ok      github.com/libopenstorage/openstorage/alerts    2.052s
?       github.com/libopenstorage/openstorage/alerts/mock   [no test files]
ok      github.com/libopenstorage/openstorage/api   0.038s
ok      github.com/libopenstorage/openstorage/api/client    6.751s
?       github.com/libopenstorage/openstorage/api/client/cluster    [no test files]
ok      github.com/libopenstorage/openstorage/api/client/volume 0.066s
?       github.com/libopenstorage/openstorage/api/errors    [no test files]
?       github.com/libopenstorage/openstorage/api/flexvolume    [no test files]
?       github.com/libopenstorage/openstorage/api/mock  [no test files]
ok      github.com/libopenstorage/openstorage/api/server    12.997s
?       github.com/libopenstorage/openstorage/api/server/mock   [no test files]
ok      github.com/libopenstorage/openstorage/api/server/sdk    54.136s
ok      github.com/libopenstorage/openstorage/api/spec  0.060s
?       github.com/libopenstorage/openstorage/bucket    [no test files]
?       github.com/libopenstorage/openstorage/bucket/drivers/fake   [no test files]
?       github.com/libopenstorage/openstorage/bucket/drivers/mock   [no test files]
?       github.com/libopenstorage/openstorage/bucket/drivers/purefb [no test files]
?       github.com/libopenstorage/openstorage/bucket/drivers/s3 [no test files]
ok      github.com/libopenstorage/openstorage/cli   0.036s
?       github.com/libopenstorage/openstorage/cluster   [no test files]
ok      github.com/libopenstorage/openstorage/cluster/manager   2.291s
?       github.com/libopenstorage/openstorage/cluster/mock  [no test files]
?       github.com/libopenstorage/openstorage/cmd/osd   [no test files]
?       github.com/libopenstorage/openstorage/cmd/osd-token-generator   [no test files]
?       github.com/libopenstorage/openstorage/config    [no test files]
ok      github.com/libopenstorage/openstorage/cosi  2.065s
ok      github.com/libopenstorage/openstorage/csi   17.247s
?       github.com/libopenstorage/openstorage/csi/sched [no test files]
?       github.com/libopenstorage/openstorage/csi/sched/k8s [no test files]
?       github.com/libopenstorage/openstorage/graph [no test files]
?       github.com/libopenstorage/openstorage/graph/drivers [no test files]
?       github.com/libopenstorage/openstorage/graph/drivers/chainfs [no test files]
?       github.com/libopenstorage/openstorage/graph/drivers/layer0  [no test files]
?       github.com/libopenstorage/openstorage/graph/drivers/proxy   [no test files]
ok      github.com/libopenstorage/openstorage/objectstore   0.045s
ok      github.com/libopenstorage/openstorage/osdconfig 0.010s
ok      github.com/libopenstorage/openstorage/pkg/auth  0.054s
ok      github.com/libopenstorage/openstorage/pkg/auth/secrets  0.049s
ok      github.com/libopenstorage/openstorage/pkg/auth/systemtoken  0.008s
?       github.com/libopenstorage/openstorage/pkg/chaos [no test files]
ok      github.com/libopenstorage/openstorage/pkg/chattr    0.027s
?       github.com/libopenstorage/openstorage/pkg/clusterdomain [no test files]
ok      github.com/libopenstorage/openstorage/pkg/correlation   0.022s
?       github.com/libopenstorage/openstorage/pkg/dbg   [no test files]
ok      github.com/libopenstorage/openstorage/pkg/defaultcontext    0.034s
?       github.com/libopenstorage/openstorage/pkg/defrag    [no test files]
?       github.com/libopenstorage/openstorage/pkg/device    [no test files]
?       github.com/libopenstorage/openstorage/pkg/diags [no test files]
?       github.com/libopenstorage/openstorage/pkg/exec  [no test files]
?       github.com/libopenstorage/openstorage/pkg/flexvolume    [no test files]
ok      github.com/libopenstorage/openstorage/pkg/grpcserver    3.015s
ok      github.com/libopenstorage/openstorage/pkg/grpcutil  0.055s
?       github.com/libopenstorage/openstorage/pkg/job   [no test files]
?       github.com/libopenstorage/openstorage/pkg/jsonpb    [no test files]
ok      github.com/libopenstorage/openstorage/pkg/jsonpb/testing    0.003s
ok      github.com/libopenstorage/openstorage/pkg/keylock   8.027s
ok      github.com/libopenstorage/openstorage/pkg/loadbalancer  0.014s
?       github.com/libopenstorage/openstorage/pkg/loadbalancer/mock [no test files]
ok      github.com/libopenstorage/openstorage/pkg/mount 8.115s
?       github.com/libopenstorage/openstorage/pkg/nodedrain [no test files]
?       github.com/libopenstorage/openstorage/pkg/options   [no test files]
ok      github.com/libopenstorage/openstorage/pkg/parser    0.009s
?       github.com/libopenstorage/openstorage/pkg/proto/time    [no test files]
ok      github.com/libopenstorage/openstorage/pkg/role  0.020s
ok      github.com/libopenstorage/openstorage/pkg/sched 124.547s
?       github.com/libopenstorage/openstorage/pkg/schedule  [no test files]
ok      github.com/libopenstorage/openstorage/pkg/seed  16.907s
ok      github.com/libopenstorage/openstorage/pkg/storagepolicy 0.054s
?       github.com/libopenstorage/openstorage/pkg/storagepool   [no test files]
ok      github.com/libopenstorage/openstorage/pkg/units 0.014s
ok      github.com/libopenstorage/openstorage/pkg/util  0.013s
ok      github.com/libopenstorage/openstorage/schedpolicy   0.009s
?       github.com/libopenstorage/openstorage/secrets   [no test files]
?       github.com/libopenstorage/openstorage/tools/sdkver  [no test files]
?       github.com/libopenstorage/openstorage/volume    [no test files]
?       github.com/libopenstorage/openstorage/volume/drivers    [no test files]
?       github.com/libopenstorage/openstorage/volume/drivers/btrfs  [no test files]
?       github.com/libopenstorage/openstorage/volume/drivers/buse   [no test files]
ok      github.com/libopenstorage/openstorage/volume/drivers/common 0.074s
ok      github.com/libopenstorage/openstorage/volume/drivers/fake   2.372s
?       github.com/libopenstorage/openstorage/volume/drivers/fuse   [no test files]
?       github.com/libopenstorage/openstorage/volume/drivers/mock   [no test files]
ok      github.com/libopenstorage/openstorage/volume/drivers/nfs    2.561s
ok      github.com/libopenstorage/openstorage/volume/drivers/pwx    0.080s
?       github.com/libopenstorage/openstorage/volume/drivers/test   [no test files]
?       github.com/libopenstorage/openstorage/volume/drivers/vfs    [no test files]

Scenario 1: StorageClass with pure_nfs_endpoint

pure.json

{
   "FlashArrays": [
     {
       "MgmtEndPoint": "dogfood-wing.dev.purestorage.com",
       "APIToken": "c17b6a94-6cfc-9065-13fc-aa669cbced31"
     }
   ],
   "FlashBlades": [
     {
       "MgmtEndPoint": "10.9.1.240",
       "APIToken": "T-05d521d7-96cc-4d70-8631-c30faa4531fd",
       "NFSEndPoint": "10.13.44.13"
     }
   ]
 }

StorageClass:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: end-portworx-pso-fb-v3-new
provisioner: pxd.portworx.com
parameters:
  pure_nfs_endpoint: "10.13.42.13"
  backend: "pure_file"
  pure_export_rules: "*(rw)"
mountOptions:
  - nfsvers=3
  - tcp
allowVolumeExpansion: true
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pure-claim-file-v3-new
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: end-portworx-pso-fb-v3-new

Volume Mount Output:

df -h
Filesystem                                                         Size  Used Avail Use% Mounted on
10.13.42.13:/px_6b9c9668-pvc-e34c2664-2376-4611-b899-fa15620e7290   20G     0   20G   0% /var/lib/osd/mounts/pvc-e34c2664-2376-4611-b899-fa15620e7290

pxctl volume inspect output:

pxctl v i pvc-e34c2664-2376-4611-b899-fa15620e7290
    Volume               :  512223722416365866
    Name                 :  pvc-e34c2664-2376-4611-b899-fa15620e7290
    Size                 :  20 GiB
    Format               :  none
    HA                   :  1
    IO Priority          :  LOW
    Creation time        :  Apr 15 10:19:34 UTC 2024
    Shared               :  no
    Windows share            :  no
    Flashblade           :
          Type           : nfs
          Endpoint       : 10.13.42.13
    Status               :  up
    State                :  Consumed from 10.13.42.13
    Last Attached        :  Jan 1 00:00:00 UTC 1970
    Labels               :  pvc=pure-claim-file-v3-new,backend=pure_file,namespace=default,pure_export_rules=*(rw),pure_nfs_endpoint=10.13.42.13
    ScanPolicy           :  repair_on_mount
    Bytes used           :  0 B
    Replica sets on nodes:
    Replication Status   :

Scenario 2: StorageClass without pure_nfs_endpoint

pure.json

{
   "FlashArrays": [
     {
       "MgmtEndPoint": "dogfood-wing.dev.purestorage.com",
       "APIToken": "c17b6a94-6cfc-9065-13fc-aa669cbced31"
     }
   ],
   "FlashBlades": [
     {
       "MgmtEndPoint": "10.9.1.240",
       "APIToken": "T-05d521d7-96cc-4d70-8631-c30faa4531fd",
       "NFSEndPoint": "10.13.44.13"
     }
   ]
 }

StorageClass:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: portworx-pso-fb-v3-without-nfs-endpoint
provisioner: pxd.portworx.com
parameters:
  backend: "pure_file"
  pure_export_rules: "*(rw)"
mountOptions:
  - nfsvers=3
  - tcp
allowVolumeExpansion: true
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pure-claim-file-v3-without-nfs-endpoint
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
  storageClassName: portworx-pso-fb-v3-without-nfs-endpoint

Volume Mount Output:

df -h
Filesystem                                                         Size  Used Avail Use% Mounted on
10.13.44.13:/px_6b9c9668-pvc-9152c96f-83de-42fa-87e8-54e5e267a3c3   10G     0   10G   0% /var/lib/osd/mounts/pvc-9152c96f-83de-42fa-87e8-54e5e267a3c3

pxctl volume inspect output:

pxctl v i pvc-9152c96f-83de-42fa-87e8-54e5e267a3c3
    Volume               :  746709660502974420
    Name                 :  pvc-9152c96f-83de-42fa-87e8-54e5e267a3c3
    Size                 :  10 GiB
    Format               :  none
    HA                   :  1
    IO Priority          :  LOW
    Creation time        :  Apr 16 08:21:24 UTC 2024
    Shared               :  no
    Windows share            :  no
    Flashblade           :
          Type           : nfs
          Endpoint       : 10.13.44.13
    Status               :  up
    State                :  Consumed from 10.13.44.13
    Last Attached        :  Jan 1 00:00:00 UTC 1970
    Labels               :  backend=pure_file,namespace=n1,pure_export_rules=*(rw),pvc=pure-claim-file-v3-without-nfs-endpoint
    ScanPolicy           :  repair_on_mount
    Bytes used           :  0 B
    Replica sets on nodes:
    Replication Status   :

Special notes for your reviewer:
Add any notes for the reviewer here.