2626 zone :
2727 type : string
2828 required : true
29- location :
30- type : string
31- required : true
32- run-id :
33- required : true
34- type : string
3529 storage-type : # gcpfilestore or gcsfuse
3630 required : false
37- default : ' gcpfilestore'
3831 type : string
3932 storage-command : # attach or create
4033 required : true
4134 default : ' attach'
4235 type : string
36+ storage-name :
37+ required : true
38+ type : string
4339 secrets :
4440 GCP_SA_KEY :
4541 required : true
46- PROJECT_NAME :
47- required : true
4842 BUCKET_NAME :
4943 required : true
50- VOL_NAME :
51- required : true
52- IP_ADDRESS :
53- required : true
54- STORAGE_NAME :
55- required : true
5644jobs :
57- storage-tests :
45+ storage-create :
46+ name : " ${{inputs.storage-type}}-${{inputs.storage-command}}"
5847 runs-on : [ubuntu-22.04]
5948 env :
60- FS_WRITE_WORKLOAD : " ${{inputs.storage-type}}-${{inputs.storage-command}}-write-workload"
61- FS_READ_WORKLOAD : " ${{inputs.storage-type}}-${{inputs.storage-command}}-read-workload"
62- FS_DELETE_WORKLOAD : " ${{inputs.storage-type}}-${{inputs.storage-command}}-delete-workload"
49+ STORAGE_WRITE_WORKLOAD : " ${{inputs.storage-type}}-${{inputs.storage-command}}-write-workload"
50+ STORAGE_READ_WORKLOAD : " ${{inputs.storage-type}}-${{inputs.storage-command}}-read-workload"
51+ STORAGE_DELETE_WORKLOAD : " ${{inputs.storage-type}}-${{inputs.storage-command}}-delete-workload"
6352 steps :
6453 - name : Validate storage-type
6554 run : |
@@ -117,37 +106,42 @@ jobs:
117106 - name : Attach auto-mount GCS FUSE Storage instance
118107 if : inputs.storage-command == 'attach' && inputs.storage-type == 'gcsfuse'
119108 run : |
120- python3 xpk.py storage attach ${{secrets.STORAGE_NAME }} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}} --type=${{inputs.storage-type}} \
109+ python3 xpk.py storage attach ${{inputs.storage-name }} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}} --type=${{inputs.storage-type}} \
121110 --auto-mount=true --mount-point='/${{inputs.storage-type}}-test-mount-point' --readonly=false --size=1 --bucket=${{secrets.BUCKET_NAME}} --mount-options rename-dir-limit=10000 --prefetch-metadata
122111 - name : Create auto-mount GCP Filestore Storage instance
123112 if : inputs.storage-command == 'create' && inputs.storage-type == 'gcpfilestore'
124113 run : |
125- python3 xpk.py storage create ${{secrets.STORAGE_NAME }} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}} --type=${{inputs.storage-type}} \
114+ python3 xpk.py storage create ${{inputs.storage-name }} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}} --type=${{inputs.storage-type}} \
126115 --auto-mount=true --vol=vol1 --size=1024 --tier=BASIC_HDD --mount-point='/${{inputs.storage-type}}-test-mount-point' --readonly=false
116+ - name : Attach an existing GCP Filestore Storage instance
117+ if : inputs.storage-command == 'attach' && inputs.storage-type == 'gcpfilestore'
118+ run : |
119+ python3 xpk.py storage attach ${{inputs.storage-name}} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}} --type=${{inputs.storage-type}} \
120+ --auto-mount=true --vol=vol1 --mount-point='/${{inputs.storage-type}}-test-mount-point' --readonly=false
127121 - name : List and verify existing Storages
128- run : python3 xpk.py storage list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} | tee output.txt | grep ${{secrets.STORAGE_NAME }} || (echo 'No storage found' && exit 143)
122+ run : python3 xpk.py storage list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} | tee output.txt | grep ${{inputs.storage-name }} || (echo 'No storage found' && exit 143)
129123 - name : Verify VolumeBundle created
130- run : kubectl get volumebundle ${{secrets.STORAGE_NAME }} -o jsonpath='{.spec.containerVolumeMounts[0].mountPath}' | grep '/${{inputs.storage-type}}-test-mount-point'
124+ run : kubectl get volumebundle ${{inputs.storage-name }} -o jsonpath='{.spec.containerVolumeMounts[0].mountPath}' | grep '/${{inputs.storage-type}}-test-mount-point'
131125 - name : Verify Persistent Volume mount options
132126 if : inputs.storage-command == 'attach' && inputs.storage-type == 'gcsfuse'
133- run : kubectl get pv ${{secrets.STORAGE_NAME }}-pv -oyaml | grep rename-dir-limit=10000 || (echo 'Invalid storage mount options' && exit 143)
127+ run : kubectl get pv ${{inputs.storage-name }}-pv -oyaml | grep rename-dir-limit=10000 || (echo 'Invalid storage mount options' && exit 143)
134128 - name : Verify that metadata pre-population is enabled
135129 if : inputs.storage-command == 'attach' && inputs.storage-type == 'gcsfuse'
136130 run : |
137- kubectl get pv ${{secrets.STORAGE_NAME }}-pv -oyaml | grep 'gcsfuseMetadataPrefetchOnMount: "true"' || (echo 'Metadata pre-population was not enabled' && exit 143)
131+ kubectl get pv ${{inputs.storage-name }}-pv -oyaml | grep 'gcsfuseMetadataPrefetchOnMount: "true"' || (echo 'Metadata pre-population was not enabled' && exit 143)
138132 - name : Run workload to write file on filestore
139- run : python3 xpk.py workload create --workload $FS_WRITE_WORKLOAD --num-slices=1 --docker-image='marketplace.gcr.io/google/ubuntu2004' --command "mkdir /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/ && echo 'Test text message' > /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/test.txt || (echo 'Writing to filestore failed' && exit 143)" --cluster ${{inputs.cluster-name}} --tpu-type=${{inputs.tpu-type}} --zone ${{inputs.zone}}
133+ run : python3 xpk.py workload create --workload $STORAGE_WRITE_WORKLOAD --num-slices=1 --docker-image='marketplace.gcr.io/google/ubuntu2004' --command "mkdir -p /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/ && echo 'Test text message' > /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/test.txt || (echo 'Writing to filestore failed' && exit 143)" --cluster ${{inputs.cluster-name}} --tpu-type=${{inputs.tpu-type}} --zone ${{inputs.zone}}
140134 - name : Wait for writer workload completion and confirm it succeeded
141- run : python3 xpk.py workload list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} --wait-for-job-completion $FS_WRITE_WORKLOAD --timeout 300
135+ run : python3 xpk.py workload list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} --wait-for-job-completion $STORAGE_WRITE_WORKLOAD --timeout 300
142136 - name : Delete the writer workload on the cluster
143137 if : always()
144- run : python3 xpk.py workload delete --workload $FS_WRITE_WORKLOAD --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}}
138+ run : python3 xpk.py workload delete --workload $STORAGE_WRITE_WORKLOAD --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}}
145139 - name : Run workload to read file on filestore
146- run : python3 xpk.py workload create --workload $FS_READ_WORKLOAD --command "grep 'Test text message' /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/test.txt || (echo 'Reading from filestore failed' && exit 143)" --cluster ${{inputs.cluster-name}} --tpu-type=${{inputs.tpu-type}} --zone ${{inputs.zone}}
140+ run : python3 xpk.py workload create --workload $STORAGE_READ_WORKLOAD --command "grep 'Test text message' /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/test.txt || (echo 'Reading from filestore failed' && exit 143)" --cluster ${{inputs.cluster-name}} --tpu-type=${{inputs.tpu-type}} --zone ${{inputs.zone}}
147141 - name : Wait for reader workload completion and confirm it succeeded
148- run : python3 xpk.py workload list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} --wait-for-job-completion $FS_READ_WORKLOAD --timeout 300
142+ run : python3 xpk.py workload list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} --wait-for-job-completion $STORAGE_READ_WORKLOAD --timeout 300
149143 - name : Delete the reader workload on the cluster
150- run : python3 xpk.py workload delete --workload $FS_READ_WORKLOAD --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}}
144+ run : python3 xpk.py workload delete --workload $STORAGE_READ_WORKLOAD --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}}
151145 - name : Create batch-read.sh script
152146 run : |
153147 cat <<EOF > batch-read.sh
@@ -187,21 +181,8 @@ jobs:
187181 - name : Delete create-shell.exp file
188182 run : rm create-shell.exp
189183 - name : Run workload to delete file on filestore
190- run : python3 xpk.py workload create --workload $FS_DELETE_WORKLOAD --command "rm -rf /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/test.txt || exit 143" --num-slices=1 --cluster ${{inputs.cluster-name}} --tpu-type=${{inputs.tpu-type}} --zone ${{inputs.zone}}
184+ run : python3 xpk.py workload create --workload $STORAGE_DELETE_WORKLOAD --command "rm -rf /${{inputs.storage-type}}-test-mount-point/$RANDOM_SEED/test.txt || exit 143" --num-slices=1 --cluster ${{inputs.cluster-name}} --tpu-type=${{inputs.tpu-type}} --zone ${{inputs.zone}}
191185 - name : Wait for delete workload completion and confirm it succeeded
192- run : python3 xpk.py workload list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} --wait-for-job-completion $FS_DELETE_WORKLOAD --timeout 300
186+ run : python3 xpk.py workload list --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}} --wait-for-job-completion $STORAGE_DELETE_WORKLOAD --timeout 300
193187 - name : Delete the delete workload on the cluster
194- run : python3 xpk.py workload delete --workload $FS_DELETE_WORKLOAD --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}}
195- - name : Detach storage volumes
196- if : always()
197- run : python3 xpk.py storage detach ${{secrets.STORAGE_NAME}} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}}
198- - name : Verify VolumeBundle deleted
199- run : |
200- ! kubectl get volumebundle | grep ${{secrets.STORAGE_NAME}}
201- - name : Delete GCP Filestore Storage instance
202- if : always() && inputs.storage-command == 'create' && inputs.storage-type == 'gcpfilestore'
203- run : python3 xpk.py storage delete ${{secrets.STORAGE_NAME}} --cluster=${{inputs.cluster-name}} --zone=${{inputs.zone}}
204- - name : Verify deletion of GCP Filestore Storage instance
205- if : inputs.storage-command == 'create' && inputs.storage-type == 'gcpfilestore'
206- run : |
207- ! gcloud filestore instances list | grep ${{secrets.STORAGE_NAME}}
188+ run : python3 xpk.py workload delete --workload $STORAGE_DELETE_WORKLOAD --cluster ${{inputs.cluster-name}} --zone=${{inputs.zone}}
0 commit comments