@@ -685,189 +685,6 @@ jobs:
685685 kubectl get storageclass | grep nested
686686 echo "[SUCCESS] Done"
687687 fi
688- - name : Configure ceph storage
689- if : ${{ inputs.storage_type == 'ceph' }}
690- id : storage-ceph-setup
691- working-directory : ${{ env.SETUP_CLUSTER_TYPE_PATH }}/storage/ceph
692- run : |
693- d8_queue_list() {
694- d8 s queue list | grep -Po '([0-9]+)(?= active)' || echo "[WARNING] Failed to retrieve list queue"
695- }
696-
697- d8_queue() {
698- local count=90
699- local queue_count
700-
701- for i in $(seq 1 $count) ; do
702- queue_count=$(d8_queue_list)
703- if [ -n "$queue_count" ] && [ "$queue_count" = "0" ]; then
704- echo "[SUCCESS] Queue is clear"
705- return 0
706- fi
707-
708- echo "[INFO] Wait until queues are empty ${i}/${count}"
709- if (( i % 5 == 0 )); then
710- echo "[INFO] Show queue list"
711- d8 s queue list | head -n25 || echo "[WARNING] Failed to retrieve list queue"
712- echo " "
713- fi
714-
715- if (( i % 10 == 0 )); then
716- echo "[INFO] deckhouse logs"
717- echo "::group::📝 deckhouse logs"
718- d8 s logs | tail -n 100
719- echo "::endgroup::"
720- echo " "
721- fi
722- sleep 10
723- done
724- }
725-
726- debug_output() {
727- echo "[DEBUG] Show ceph namespace"
728- echo "::group::📦 ceph namespace"
729- kubectl get ns | grep ceph || echo "Failed to retrieve ceph ns"
730- echo "::endgroup::"
731- echo "[DEBUG] Show ModuleConfig ceph"
732- echo "::group::📦 ModuleConfig ceph"
733- kubectl get mc | grep ceph || echo "Failed to retrieve mc"
734- echo "::endgroup::"
735- echo "[DEBUG] Show ceph in resource modules"
736- echo "::group::📦 ceph in resource modules"
737- kubectl get modules -o wide | grep ceph || echo "Failed to retrieve modules"
738- echo "::endgroup::"
739- echo "[DEBUG] Show queue"
740- echo "::group::📦 queue"
741- d8 s queue list || echo "Failed to retrieve list queue"
742- echo "::endgroup::"
743- echo "[DEBUG] Show deckhouse logs"
744- echo "::group::📝 deckhouse logs"
745- d8 s logs | tail -n 100
746- echo "::endgroup::"
747- }
748-
749- ceph_operator_ready() {
750- local count=60
751- local ceph_operator_status
752- local csi_ceph_status
753-
754- for i in $(seq 1 $count); do
755- ceph_operator_status=$(kubectl get ns d8-operator-ceph -o jsonpath='{.status.phase}' || echo "False")
756- csi_ceph_status=$(kubectl get module csi-ceph -o jsonpath='{.status.phase}' || echo "False")
757-
758- if [[ "${ceph_operator_status}" = "Active" && "${csi_ceph_status}" = "Ready" ]]; then
759- echo "[SUCCESS] Namespaces operator-ceph and csi are Active"
760- return 0
761- fi
762-
763- echo "[INFO] Waiting 10s for ceph operator and csi namespaces to be ready (attempt ${i}/${count})"
764-
765- if (( i % 5 == 0 )); then
766- echo "[DEBUG] Get namespace"
767- kubectl get namespace | grep ceph || echo "[WARNING] Namespaces operator-ceph and csi are not ready"
768- echo "[DEBUG] Show all namespaces"
769- kubectl get namespace
770- echo "[DEBUG] Show queue (first 25 lines)"
771- d8 s queue list | head -n25 || echo "[WARNING] Failed to retrieve list queue"
772- echo " "
773- fi
774- sleep 10
775- done
776-
777- debug_output
778- exit 1
779- }
780-
781- ceph_ready() {
782- local count=90
783- local ceph_mgr
784- local ceph_mon
785- local ceph_osd
786-
787- for i in $(seq 1 $count); do
788- echo "[INFO] Check ceph pods, mon mgr osd"
789- ceph_mgr=$(kubectl -n d8-operator-ceph get pods | grep "ceph-mgr.*Running" | wc -l || true)
790- ceph_mon=$(kubectl -n d8-operator-ceph get pods | grep "ceph-mon.*Running" | wc -l || true)
791- ceph_osd=$(kubectl -n d8-operator-ceph get pods | grep "ceph-osd.*Running" | wc -l || true)
792-
793- echo "[INFO] check if ceph pods are ready"
794- if [[ $ceph_mgr -ge 2 && $ceph_mon -ge 3 && $ceph_osd -ge 3 ]]; then
795- echo "[SUCCESS] Ceph cluster is ready"
796- return 0
797- fi
798-
799- echo "[WARNING] Not all pods are ready, ceph_mgr=${ceph_mgr}, ceph_mon=${ceph_mon}, ceph_osd=${ceph_osd}"
800- echo "[INFO] Waiting 10s for ceph operator to be ready"
801- kubectl -n d8-operator-ceph get pods || echo "Failed to retrieve pods"
802- if (( i % 5 == 0 )); then
803- echo "[DEBUG] Show ceph namespace"
804- kubectl get ns | grep ceph || echo "Failed to retrieve ceph ns"
805- echo "[DEBUG] Show ModuleConfig ceph"
806- kubectl get mc | grep ceph || echo "Failed to retrieve mc"
807- echo "[DEBUG] Show ceph in resource modules"
808- kubectl get modules -o wide | grep ceph || echo "Failed to retrieve modules"
809- echo "[DEBUG] Show queue"
810- d8 s queue list | head -n 25 || echo "Failed to retrieve list queue"
811- fi
812- echo "[INFO] Wait until all necessary pods are ready ${i}/${count}"
813- sleep 10
814- done
815-
816- debug_output
817- exit 1
818- }
819-
820- echo "[INFO] Create ceph operator and csi module config"
821- kubectl apply -f 01-mc.yaml
822-
823- echo "[INFO] Check module source"
824- kubectl get modulesources
825-
826- echo "[INFO] Wait while queues are empty"
827- d8_queue
828-
829- echo "[INFO] Wait for operator-ceph namespace to be ready"
830- ceph_operator_ready
831-
832- if (kubectl get mc admission-policy-engine -o jsonpath='{.spec.enabled}') ; then
833- echo "[INFO] Label operator-ceph namespace with security.deckhouse.io/pod-policy"
834- kubectl label ns d8-operator-ceph security.deckhouse.io/pod-policy=privileged
835- echo "[INFO] Restart operator-ceph deployment"
836- kubectl -n d8-operator-ceph rollout restart deployment operator-ceph || true
837- fi
838-
839- echo "[INFO] Start wait for ceph operator and csi"
840- ceph_operator_ready
841-
842- echo "[INFO] Create ServiceAccounts"
843- kubectl apply -f 02-sa.yaml
844- echo "[INFO] Create ConfigMap (patch existing for configure rbd support)"
845- kubectl apply -f 03-cm.yaml
846- echo "[INFO] Create Cluster"
847- kubectl apply -f 04-cluster.yaml
848-
849- echo "[INFO] Get pod in d8-operator-ceph"
850- kubectl -n d8-operator-ceph get pods
851-
852- echo "[INFO] Wait for ceph operator"
853- ceph_ready
854-
855- echo "[INFO] Show pods"
856- kubectl get pods -n d8-operator-ceph
857-
858- kubectl apply -f 05-blockpool.yaml
859- echo "[INFO] Wait for ceph-rbd-pool-r2 blockpool to be ready, timeout 600s"
860- kubectl -n d8-operator-ceph wait --for=jsonpath='{.status.phase}'=Ready cephblockpools.ceph.rook.io ceph-rbd-pool-r2 --timeout=600s
861- kubectl apply -f 06-toolbox.yaml
862- echo "[INFO] Wait for rook-ceph-tools, timeout 300s"
863- kubectl -n d8-operator-ceph wait --for=condition=Available deployment/rook-ceph-tools --timeout=300s
864-
865- echo "[INFO] Show ceph pools via rook-ceph-tools"
866- kubectl -n d8-operator-ceph exec deployments/rook-ceph-tools -c ceph-tools -- ceph osd pool ls
867-
868- echo "[INFO] Configure storage class"
869- chmod +x ./ceph-configure.sh
870- ./ceph-configure.sh
871688
872689 configure-virtualization :
873690 name : Configure Virtualization
0 commit comments