Skip to content

Commit

Permalink
Fix minio problems
Browse files Browse the repository at this point in the history
  • Loading branch information
welpaolo committed Sep 12, 2024
1 parent bc8e479 commit 772dcc2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
uses: aquasecurity/[email protected]
with:
scan-type: 'image'
format: 'spdx'
format: 'spdx-json'
output: 'dependency-results.sbom.json'
image-ref: 'trivy/charmed-spark:test'
github-pat: ${{ secrets.GITHUB_TOKEN }}
Expand Down
9 changes: 3 additions & 6 deletions tests/integration/setup-aws-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
sudo snap install aws-cli --classic


get_s3_endpoint(){
# Get S3 endpoint from MinIO
kubectl get service minio -n minio-operator -o jsonpath='{.spec.clusterIP}'
}

source ./utils/s3-utils.sh

wait_and_retry(){
# Retry a command for a number of times by waiting a few seconds.
Expand Down Expand Up @@ -37,8 +34,8 @@ wait_and_retry get_s3_endpoint

S3_ENDPOINT=$(get_s3_endpoint)
DEFAULT_REGION="us-east-2"
ACCESS_KEY=$(kubectl get secret -n minio-operator microk8s-user-1 -o jsonpath='{.data.CONSOLE_ACCESS_KEY}' | base64 -d)
SECRET_KEY=$(kubectl get secret -n minio-operator microk8s-user-1 -o jsonpath='{.data.CONSOLE_SECRET_KEY}' | base64 -d)
ACCESS_KEY=$(get_s3_access_key)
SECRET_KEY=$(get_s3_secret_key)

# Configure AWS CLI credentials
aws configure set aws_access_key_id $ACCESS_KEY
Expand Down
24 changes: 20 additions & 4 deletions tests/integration/utils/s3-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,30 @@ get_s3_endpoint(){


get_s3_access_key(){
# Print the S3 Access Key by reading it from K8s secret
kubectl get secret -n minio-operator microk8s-user-1 -o jsonpath='{.data.CONSOLE_ACCESS_KEY}' | base64 -d
# Print the S3 Access Key by reading it from K8s secret or by outputting the default value
kubectl get secret -n minio-operator microk8s-user-1
if [ $? -eq 0 ]; then
echo "Use access-key from secret"
access_key=$(kubectl get secret -n minio-operator microk8s-user-1 -o jsonpath='{.data.CONSOLE_ACCESS_KEY}' | base64 -d)
else
echo "use default access-key"
access_key="minio"
fi
echo "$access_key"
}


get_s3_secret_key(){
# Print the S3 Secret Key by reading it from K8s secret
kubectl get secret -n minio-operator microk8s-user-1 -o jsonpath='{.data.CONSOLE_SECRET_KEY}' | base64 -d
# Print the S3 Secret Key by reading it from K8s secret or by outputting the default value
kubectl get secret -n minio-operator microk8s-user-1
if [ $? -eq 0 ]; then
echo "Use access-key from secret"
secret_key=$(kubectl get secret -n minio-operator microk8s-user-1 -o jsonpath='{.data.CONSOLE_SECRET_KEY}' | base64 -d)
else
echo "use default access-key"
secret_key="minio123"
fi
echo "$secret_key"
}


Expand Down

0 comments on commit 772dcc2

Please sign in to comment.