mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
46 lines
1.8 KiB
Bash
46 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
export KUBECONFIG=/Users/chrisfu/dev/knoe/knoe-k3s.kubeconfig
|
|
|
|
echo "==> Inspect current minio init container image..."
|
|
kubectl -n gitlab get deployment gitlab-minio \
|
|
-o jsonpath='{.spec.template.spec.initContainers[*].name}' && echo
|
|
kubectl -n gitlab get deployment gitlab-minio \
|
|
-o jsonpath='{.spec.template.spec.initContainers[0].image}' && echo
|
|
|
|
echo "==> Patching minio Deployment: replace configure init container with ARM64 alpine..."
|
|
kubectl -n gitlab patch deployment gitlab-minio --type=json -p '[
|
|
{
|
|
"op": "replace",
|
|
"path": "/spec/template/spec/initContainers/0",
|
|
"value": {
|
|
"name": "configure",
|
|
"image": "alpine:latest",
|
|
"command": ["sh", "-c",
|
|
"mkdir -p /tmp/.minio && echo -n \"$MINIO_ACCESS_KEY\" > /tmp/.minio/access_key && echo -n \"$MINIO_SECRET_KEY\" > /tmp/.minio/secret_key && chmod 600 /tmp/.minio/access_key /tmp/.minio/secret_key && echo \"Credentials written OK\""],
|
|
"env": [
|
|
{"name": "MINIO_ACCESS_KEY", "valueFrom": {"secretKeyRef": {"name": "gitlab-minio-secret", "key": "accesskey"}}},
|
|
{"name": "MINIO_SECRET_KEY", "valueFrom": {"secretKeyRef": {"name": "gitlab-minio-secret", "key": "secretkey"}}}
|
|
],
|
|
"volumeMounts": [
|
|
{"name": "minio-configuration", "mountPath": "/tmp/.minio"}
|
|
]
|
|
}
|
|
}
|
|
]'
|
|
|
|
echo "==> Deleting old minio pod to force restart with new init container..."
|
|
kubectl -n gitlab delete pod -l app=minio --ignore-not-found
|
|
|
|
echo "==> Waiting 60s for minio to restart..."
|
|
sleep 60
|
|
|
|
echo "==> Minio pod status:"
|
|
kubectl -n gitlab get pod -l app=minio --no-headers
|
|
|
|
echo "==> Minio init container log:"
|
|
kubectl -n gitlab logs -l app=minio -c configure --tail=5 2>&1 || true
|
|
|
|
echo "==> Minio main container log:"
|
|
kubectl -n gitlab logs -l app=minio --tail=5 2>&1 | grep -v LD_PRELOAD | head -5 || true
|