Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
COSI-11: deploy-COSI-resources-in-CI
Browse files Browse the repository at this point in the history
- added a script for setting up the COSI driver
- added a new workflow step to run the script
  • Loading branch information
anurag4DSB committed Nov 4, 2024
1 parent a62e8d9 commit 737a340
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/scripts/setup_cosi_resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -e

# Define log file for debugging
LOG_FILE=".github/e2e_tests/artifacts/logs/kind_cluster_logs/cosi_deployment/setup_debug.log"
mkdir -p "$(dirname "$LOG_FILE")" # Ensure the log directory exists

# Error handling function
error_handler() {
echo "An error occurred during the COSI setup. Check the log file for details." | tee -a "$LOG_FILE"
echo "Failed command: $BASH_COMMAND" | tee -a "$LOG_FILE"
exit 1
}

# Trap errors and call the error handler
trap 'error_handler' ERR

# Log command execution to the log file for debugging
log_and_run() {
echo "Running: $*" | tee -a "$LOG_FILE"
"$@" | tee -a "$LOG_FILE"
}

# Step 1: Install COSI CRDs
log_and_run echo "Installing COSI CRDs..."
log_and_run kubectl create -k github.com/kubernetes-sigs/container-object-storage-interface-api
log_and_run kubectl create -k github.com/kubernetes-sigs/container-object-storage-interface-controller

# Step 2: Verify COSI Controller Pod Status
log_and_run echo "Verifying COSI Controller Pod status..."
log_and_run kubectl wait --namespace default --for=condition=ready pod -l app.kubernetes.io/name=container-object-storage-interface-controller --timeout=10s
log_and_run kubectl get pods --namespace default

# Step 3: Build COSI driver Docker image
log_and_run echo "Building COSI driver image..."
log_and_run docker build -t ghcr.io/scality/cosi:latest .

# Step 4: Load COSI driver image into KIND cluster
log_and_run echo "Loading COSI driver image into KIND cluster..."
log_and_run kind load docker-image ghcr.io/scality/cosi:latest --name object-storage-cluster

# Step 5: Run COSI driver
log_and_run echo "Applying COSI driver manifests..."
log_and_run kubectl apply -k .

# Step 6: Verify COSI driver Pod Status
log_and_run echo "Verifying COSI driver Pod status..."
log_and_run kubectl wait --namespace scality-object-storage --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=20s
log_and_run kubectl get pods -n scality-object-storage

log_and_run echo "COSI setup completed successfully."
7 changes: 7 additions & 0 deletions .github/workflows/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ jobs:
with:
detached: true


- name: Setup COSI Controller, CRDs and Driver
run: |
pwd
chmod +x .github/scripts/setup_cosi_resources.sh
.github/scripts/setup_cosi_resources.sh
- name: Capture Kubernetes Logs in artifacts directory
run: |
chmod +x .github/scripts/capture_k8s_logs.sh
Expand Down

0 comments on commit 737a340

Please sign in to comment.