Skip to content

Commit d2b0b16

Browse files
committed
fix(setup): enable minio as gateway for azure blob storage
1 parent b89d817 commit d2b0b16

File tree

3 files changed

+44
-28
lines changed

3 files changed

+44
-28
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ The whole process takes around twenty minutes. In the end, the following resourc
2323

2424
- an AKS cluster running Kubernetes v1.20.
2525
- Azure load balancer.
26-
- ~~Azure MySQL database.~~ MySQL will be provided by Helm under [#5508](https://github.com/gitpod-io/gitpod/issues/5508) solved
27-
- ~~Azure Blob Storage.~~ Minio will be used until [Azure storage gateway](https://github.com/gitpod-io/gitpod-azure-aks-guide/issues/1) is configured
26+
- ~~Azure MySQL database.~~ MySQL will be provided by Helm until [#5508](https://github.com/gitpod-io/gitpod/issues/5508) solved.
27+
- Azure Blob Storage.
2828
- Azure DNS zone.
2929
- Azure container registry.
3030
- [calico](https://docs.projectcalico.org) as CNI and NetworkPolicy implementation.

charts/assets/gitpod-values.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# - MYSQL_GITPOD_PASSWORD
66
# - MYSQL_INSTANCE_NAME
77
# - LOCATION
8-
# - MINIO_ACCESS_KEY
9-
# - MINIO_SECRET_KEY
108

119
hostname: $DOMAIN
1210

@@ -68,8 +66,16 @@ mysql:
6866
# Azure blob storage isn't S3 compatible
6967
minio:
7068
enabled: true
71-
accessKey: $MINIO_ACCESS_KEY
72-
secretKey: $MINIO_SECRET_KEY
69+
accessKey: $STORAGE_ACCOUNT_NAME
70+
secretKey: $STORAGE_ACCOUNT_KEY
71+
fullnameOverride: minio
72+
azuregateway:
73+
enabled: true
74+
persistence:
75+
enabled: false
76+
serviceAccount:
77+
create: true
78+
name: minio
7379

7480
docker-registry:
7581
enabled: false

setup.sh

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ EOF
214214
kubectl apply -f gitpod-certificate.yaml
215215
rm gitpod-certificate.yaml
216216

217+
kubectl rollout restart deployment/server
218+
217219
echo "Gitpod successfully installed to ${DOMAIN}..."
218220
}
219221

@@ -390,28 +392,36 @@ function setup_mysql_database() {
390392
}
391393

392394
function setup_storage() {
393-
# @todo use Minio as Azure facade https://docs.min.io/docs/minio-gateway-for-azure.html
394-
#
395-
# if [ "$(az storage account show --name ${STORAGE_ACCOUNT_NAME} --resource-group ${RESOURCE_GROUP} --query "name == '${STORAGE_ACCOUNT_NAME}'" || echo "empty")" == "true" ]; then
396-
# echo "Storage account exists..."
397-
# else
398-
# echo "Create storage account..."
399-
# az storage account create \
400-
# --access-tier Hot \
401-
# --kind StorageV2 \
402-
# --name "${STORAGE_ACCOUNT_NAME}" \
403-
# --resource-group "${RESOURCE_GROUP}" \
404-
# --sku Standard_LRS
405-
# fi
406-
407-
export MINIO_ACCESS_KEY=$(openssl rand -base64 20)
408-
export MINIO_SECRET_KEY=$(openssl rand -base64 20)
409-
410-
# export STORAGE_ACCOUNT_KEY=$(az storage account keys list \
411-
# --account-name "${STORAGE_ACCOUNT_NAME}" \
412-
# --resource-group "${RESOURCE_GROUP}" \
413-
# --output json \
414-
# | jq -r '.[] | select(.keyName == "key1") | .value')
395+
if [ "$(az storage account show --name ${STORAGE_ACCOUNT_NAME} --resource-group ${RESOURCE_GROUP} --query "name == '${STORAGE_ACCOUNT_NAME}'" || echo "empty")" == "true" ]; then
396+
echo "Storage account exists..."
397+
else
398+
echo "Create storage account..."
399+
az storage account create \
400+
--access-tier Hot \
401+
--kind StorageV2 \
402+
--name "${1}" \
403+
--resource-group "${RESOURCE_GROUP}" \
404+
--sku Standard_LRS
405+
fi
406+
407+
PRINCIPAL_ID=$(az aks show --name "${CLUSTER_NAME}" --resource-group "${RESOURCE_GROUP}" --query "identityProfile.kubeletidentity.objectId" -o tsv)
408+
STORAGE_ACCOUNT_ID=$(az storage account show \
409+
--name "${STORAGE_ACCOUNT_NAME}" \
410+
--output tsv \
411+
--query id \
412+
--resource-group "${RESOURCE_GROUP}" )
413+
414+
echo "Allow Kubernetes managed identity to access the storage account..."
415+
az role assignment create \
416+
--assignee "${PRINCIPAL_ID}" \
417+
--role "Storage Blob Data Contributor" \
418+
--scope "${STORAGE_ACCOUNT_ID}"
419+
420+
export STORAGE_ACCOUNT_KEY=$(az storage account keys list \
421+
--account-name "${STORAGE_ACCOUNT_NAME}" \
422+
--resource-group "${RESOURCE_GROUP}" \
423+
--output json \
424+
| jq -r '.[] | select(.keyName == "key1") | .value')
415425
}
416426

417427
function uninstall() {

0 commit comments

Comments
 (0)