Skip to content

Commit

Permalink
COSI-17: add-dev-container-for-sodi-driver
Browse files Browse the repository at this point in the history
- the container sets up minikube, s3 and iam services.
  • Loading branch information
anurag4DSB committed Nov 13, 2024
1 parent 9e51a25 commit a50814a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go Dev Container",
"image": "mcr.microsoft.com/devcontainers/go:1-1.23-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
},
"ghcr.io/devcontainers/features/aws-cli:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "1.31",
"helm": "latest",
"minikube": "latest"
}
},
"forwardPorts": [8000, 8600],
"customizations": {
"codespaces": {
"repositories": {
"scality/cloudserver": {
"permissions": {
"packages": "read"
}
},
"scality/vault": {
"permissions": {
"packages": "read"
}
}
}
}
},
"postCreateCommand": "bash .devcontainer/setup-dev-container.sh"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
32 changes: 32 additions & 0 deletions .devcontainer/setup-dev-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

echo "Installing Ginkgo and Gomega..."
go install github.com/onsi/ginkgo/v2/ginkgo
go get github.com/onsi/gomega/...

# Create a KIND cluster
echo "Starting Minikube..."
minikube start

echo "Logging into GHCR (GitHub Container Registry)..."
echo "$REPOSITORY_USER_TOKEN" | docker login ghcr.io -u "$REPOSITORY_USER" --password-stdin

# Navigate to the directory and prepare the environment
echo "Preparing S3 and IAM log and directories..."
cd .github/s3_and_iam_deployment && \
mkdir -p logs/s3 logs/iam logs/cosi_driver data/vaultdb && \
sudo chown -R vscode:vscode logs data && \
chmod -R ugo+rwx logs data && \

# Start Docker Compose for the 'iam_s3' profile
echo "Deploying S3 and IAM using docker compose..."
docker compose --profile iam_s3 up -d

# Set Minikube's Docker environment variables
eval $(minikube docker-env)

# Prune Docker on Minikube's Docker Daemon
echo "Pruning unused images..."
docker system prune -af

echo "Setup complete."
2 changes: 1 addition & 1 deletion .github/scripts/setup_cosi_resources.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi

# Step 6: Verify COSI driver Pod Status
log_and_run echo "Verifying COSI driver Pod status..."
if ! kubectl wait --namespace scality-object-storage --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=20s; then
if ! kubectl wait --namespace scality-object-storage --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=30s; then
echo "Error: COSI driver Pod did not reach ready state." | tee -a "$LOG_FILE"
exit 1
fi
Expand Down

0 comments on commit a50814a

Please sign in to comment.