Skip to content

Commit aeb5859

Browse files
authored
chore(ci): add NFS to nested e2e (#2123)
Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com>
1 parent 9c68d68 commit aeb5859

10 files changed

Lines changed: 338 additions & 19 deletions

File tree

.github/workflows/e2e-matrix.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,39 @@ jobs:
351351
PROD_IO_REGISTRY_DOCKER_CFG: ${{ secrets.PROD_IO_REGISTRY_DOCKER_CFG }}
352352
BOOTSTRAP_DEV_PROXY: ${{ secrets.BOOTSTRAP_DEV_PROXY }}
353353

354+
e2e-nfs:
355+
name: E2E Pipeline (NFS)
356+
needs:
357+
- set-vars
358+
uses: ./.github/workflows/e2e-reusable-pipeline.yml
359+
with:
360+
storage_type: nfs
361+
nested_storageclass_name: nfs
362+
branch: main
363+
virtualization_tag: main
364+
deckhouse_channel: alpha
365+
default_user: cloud
366+
go_version: "1.24.13"
367+
e2e_timeout: "3.5h"
368+
date_start: ${{ needs.set-vars.outputs.date_start }}
369+
randuuid4c: ${{ needs.set-vars.outputs.randuuid4c }}
370+
cluster_config_workers_memory: "9Gi"
371+
cluster_config_k8s_version: "Automatic"
372+
secrets:
373+
DEV_REGISTRY_DOCKER_CFG: ${{ secrets.DEV_REGISTRY_DOCKER_CFG }}
374+
VIRT_E2E_NIGHTLY_SA_TOKEN: ${{ secrets.VIRT_E2E_NIGHTLY_SA_TOKEN }}
375+
PROD_IO_REGISTRY_DOCKER_CFG: ${{ secrets.PROD_IO_REGISTRY_DOCKER_CFG }}
376+
BOOTSTRAP_DEV_PROXY: ${{ secrets.BOOTSTRAP_DEV_PROXY }}
377+
354378
report-to-channel:
355379
runs-on: ubuntu-latest
356380
name: End-to-End tests report
357381
needs:
358382
- e2e-replicated
383+
- e2e-nfs
359384
if: ${{ always()}}
360385
env:
361-
STORAGE_TYPES: '["replicated"]'
386+
STORAGE_TYPES: '["replicated", "nfs"]'
362387
steps:
363388
- uses: actions/checkout@v4
364389

@@ -380,6 +405,9 @@ jobs:
380405
"replicated")
381406
echo "replicated.csi.storage.deckhouse.io"
382407
;;
408+
"nfs")
409+
echo "nfs.csi.storage.deckhouse.io"
410+
;;
383411
*)
384412
echo "$storage_type"
385413
;;

.github/workflows/e2e-reusable-pipeline.yml

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -531,15 +531,15 @@ jobs:
531531
sds_replicated_ready() {
532532
local count=60
533533
for i in $(seq 1 $count); do
534-
534+
535535
sds_replicated_volume_status=$(kubectl get ns d8-sds-replicated-volume -o jsonpath='{.status.phase}' || echo "False")
536-
536+
537537
if [[ "${sds_replicated_volume_status}" = "Active" ]]; then
538538
echo "[SUCCESS] Namespaces sds-replicated-volume are Active"
539539
kubectl get ns d8-sds-replicated-volume
540540
return 0
541541
fi
542-
542+
543543
echo "[INFO] Waiting 10s for sds-replicated-volume namespace to be ready (attempt ${i}/${count})"
544544
if (( i % 5 == 0 )); then
545545
echo "[INFO] Show namespaces sds-replicated-volume"
@@ -582,7 +582,7 @@ jobs:
582582
echo "[SUCCESS] sds-replicated-volume is ready"
583583
return 0
584584
fi
585-
585+
586586
echo "[WARNING] Not all pods are ready, linstor_node=${linstor_node}, csi_node=${csi_node}"
587587
echo "[INFO] Waiting 10s for pods to be ready (attempt ${i}/${count})"
588588
if (( i % 5 == 0 )); then
@@ -615,12 +615,12 @@ jobs:
615615
local count=60
616616
workers=$(kubectl get nodes -o name | grep worker | wc -l)
617617
workers=$((workers))
618-
618+
619619
if [[ $workers -eq 0 ]]; then
620620
echo "[ERROR] No worker nodes found"
621621
exit 1
622622
fi
623-
623+
624624
for i in $(seq 1 $count); do
625625
blockdevices=$(kubectl get blockdevice -o name | wc -l || true)
626626
if [ $blockdevices -ge $workers ]; then
@@ -686,6 +686,70 @@ jobs:
686686
echo "[SUCCESS] Done"
687687
fi
688688
689+
- name: Configure NFS storage
690+
if: ${{ inputs.storage_type == 'nfs' }}
691+
id: storage-nfs-setup
692+
working-directory: ${{ env.SETUP_CLUSTER_TYPE_PATH }}/storage/nfs
693+
env:
694+
NAMESPACE: ${{ needs.bootstrap.outputs.namespace }}
695+
run: |
696+
nfs_ready() {
697+
local count=90
698+
local controller
699+
local csi_controller
700+
local csi_node_desired
701+
local csi_node_ready
702+
703+
for i in $(seq 1 $count); do
704+
echo "[INFO] Check d8-csi-nfs pods (attempt ${i}/${count})"
705+
controller=$(kubectl -n d8-csi-nfs get deploy controller -o jsonpath='{.status.readyReplicas}' 2>/dev/null || echo "0")
706+
csi_controller=$(kubectl -n d8-csi-nfs get deploy csi-controller -o jsonpath='{.status.readyReplicas}' 2>/dev/null || echo "0")
707+
csi_node_desired=$(kubectl -n d8-csi-nfs get ds csi-node -o jsonpath='{.status.desiredNumberScheduled}' 2>/dev/null || echo "0")
708+
csi_node_ready=$(kubectl -n d8-csi-nfs get ds csi-node -o jsonpath='{.status.numberReady}' 2>/dev/null || echo "0")
709+
710+
if [[ "$controller" -ge 1 && "$csi_controller" -ge 1 && "$csi_node_desired" -gt 0 && "$csi_node_ready" -eq "$csi_node_desired" ]]; then
711+
echo "[SUCCESS] NFS CSI is ready (controller=${controller}, csi-controller=${csi_controller}, csi-node=${csi_node_ready}/${csi_node_desired})"
712+
return 0
713+
fi
714+
715+
echo "[WARNING] NFS CSI not ready: controller=${controller}, csi-controller=${csi_controller}, csi-node=${csi_node_ready}/${csi_node_desired}"
716+
if (( i % 5 == 0 )); then
717+
echo "[DEBUG] Pods in d8-csi-nfs:"
718+
kubectl -n d8-csi-nfs get pods || echo "[WARNING] Failed to retrieve pods"
719+
echo "[DEBUG] Deployments in d8-csi-nfs:"
720+
kubectl -n d8-csi-nfs get deploy || echo "[WARNING] Failed to retrieve deployments"
721+
echo "[DEBUG] DaemonSets in d8-csi-nfs:"
722+
kubectl -n d8-csi-nfs get ds || echo "[WARNING] Failed to retrieve daemonsets"
723+
echo "[DEBUG] csi-nfs module status:"
724+
kubectl get modules csi-nfs -o wide || echo "[WARNING] Failed to retrieve module"
725+
fi
726+
sleep 10
727+
done
728+
729+
echo "[ERROR] NFS CSI did not become ready in time"
730+
kubectl -n d8-csi-nfs get pods || true
731+
exit 1
732+
}
733+
734+
echo "[INFO] Apply csi-nfs ModuleConfig, ModulePullOverride, snapshot-controller"
735+
kubectl apply -f mc.yaml
736+
737+
echo "[INFO] Wait for csi-nfs module to be ready"
738+
kubectl wait --for=jsonpath='{.status.phase}'=Ready modules csi-nfs --timeout=300s
739+
740+
echo "[INFO] Wait for csi-nfs pods to be ready"
741+
nfs_ready
742+
743+
echo "[INFO] Apply NFSStorageClass"
744+
envsubst < storageclass.yaml | kubectl apply -f -
745+
746+
echo "[INFO] Configure default storage class"
747+
./default-sc-configure.sh
748+
749+
750+
echo "[INFO] Show existing storageclasses"
751+
kubectl get storageclass
752+
689753
configure-virtualization:
690754
name: Configure Virtualization
691755
runs-on: ubuntu-latest
@@ -822,7 +886,7 @@ jobs:
822886
kubectl describe node $node
823887
echo "::endgroup::"
824888
done
825-
889+
826890
echo "[DEBUG] Show queue (first 25 lines)"
827891
d8 s queue list | head -n 25 || echo "[WARNING] Failed to retrieve list queue"
828892
echo "[DEBUG] Show deckhouse logs"
@@ -848,7 +912,7 @@ jobs:
848912
d8 s queue list | head -n25 || echo "[WARNING] Failed to retrieve list queue"
849913
echo " "
850914
fi
851-
915+
852916
if (( i % 10 == 0 )); then
853917
echo "[INFO] deckhouse logs"
854918
echo "::group::📝 deckhouse logs"
@@ -873,9 +937,9 @@ jobs:
873937
kubectl get vmclass || echo "[WARNING] no vmclasses found"
874938
return 0
875939
fi
876-
940+
877941
echo "[INFO] Waiting 10s for Virtualization module to be ready (attempt $i/$count)"
878-
942+
879943
if (( i % 5 == 0 )); then
880944
echo " "
881945
echo "[DEBUG] Show additional info"
@@ -887,7 +951,7 @@ jobs:
887951
fi
888952
sleep 10
889953
done
890-
954+
891955
debug_output
892956
exit 1
893957
}
@@ -897,9 +961,9 @@ jobs:
897961
local virt_handler_ready
898962
local workers
899963
local time_wait=10
900-
964+
901965
workers=$(kubectl get nodes -o name | grep worker | wc -l || true)
902-
workers=$((workers))
966+
workers=$((workers))
903967
904968
for i in $(seq 1 $count); do
905969
virt_handler_ready=$(kubectl -n d8-virtualization get pods | grep "virt-handler.*Running" | wc -l || true)
@@ -1145,7 +1209,7 @@ jobs:
11451209
# Format: https://github.com/{owner}/{repo}/actions/runs/{run_id}
11461210
# The job name will be visible in the workflow run view
11471211
local link="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
1148-
1212+
11491213
jq -n \
11501214
--arg csi "$csi" \
11511215
--arg date "$date" \
@@ -1188,11 +1252,11 @@ jobs:
11881252
local status_msg="$3"
11891253
local job_name="$4"
11901254
local is_e2e_test="${5:-false}"
1191-
1255+
11921256
if [ "$result_value" != "success" ]; then
11931257
FAILED_STAGE="$stage_name"
11941258
FAILED_JOB_NAME="$job_name (${{ inputs.storage_type }})"
1195-
1259+
11961260
if [ -z "$REPORT_JSON" ] || [ "$REPORT_JSON" == "" ]; then
11971261
REPORT_JSON=$(create_failure_summary "$stage_name" "$status_msg" "$FAILED_JOB_NAME")
11981262
elif [ "$is_e2e_test" == "true" ]; then

test/dvp-static-cluster/charts/infra/templates/_helpers.tpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ spec:
2828
blockDeviceRefs:
2929
- kind: VirtualDisk
3030
name: {{ include "infra.vd-root-name" $name }}
31+
{{- if ne $ctx.Values.storageType "nfs" }}
3132
{{- range $i, $v := $cfg.additionalDisks }}
3233
- kind: VirtualDisk
3334
name: {{ printf "%s-%d" $name $i }}
35+
{{- end }}
3436
{{- end }}
3537
bootloader: {{ $ctx.Values.image.bootloader }}
3638
liveMigrationPolicy: PreferForced
@@ -90,6 +92,7 @@ spec:
9092
storageClassName: {{ $ctx.Values.storageClass }}
9193
{{- end }}
9294

95+
{{ if ne $ctx.Values.storageType "nfs" }}
9396
{{range $i, $v := $cfg.additionalDisks }}
9497
---
9598
apiVersion: virtualization.deckhouse.io/v1alpha2
@@ -105,3 +108,4 @@ spec:
105108
{{- end }}
106109
{{- end }}
107110
{{- end }}
111+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{ if eq .Values.storageType "nfs" }}
2+
---
3+
apiVersion: v1
4+
kind: Service
5+
metadata:
6+
name: nfs-server
7+
namespace: {{ .Values.namespace }}
8+
labels:
9+
app: nfs
10+
spec:
11+
type: ClusterIP
12+
selector:
13+
app: nfs
14+
ports:
15+
- name: tcp-2049
16+
port: 2049
17+
protocol: TCP
18+
- name: udp-111
19+
port: 111
20+
protocol: UDP
21+
{{ end }}

0 commit comments

Comments
 (0)