feat(deploy): add k01 business cluster manifests for k3s with cnpg, strimzi, redis and mongodb operators
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REGISTRY_HOST="registry.juwan.xhttp.zip"
|
||||
CNPG_VERSION="1.29.0"
|
||||
STRIMZI_VERSION="1.0.0"
|
||||
REDIS_OP_VERSION="0.24.0"
|
||||
MONGODB_OP_VERSION="1.8.0"
|
||||
|
||||
if ! command -v kubectl >/dev/null 2>&1; then
|
||||
curl -sfL https://get.k3s.io | \
|
||||
INSTALL_K3S_EXEC="--disable=traefik --write-kubeconfig-mode=644" \
|
||||
sh -
|
||||
fi
|
||||
|
||||
if ! command -v helm >/dev/null 2>&1; then
|
||||
curl -fsSL https://packages.buildkite.com/helm-linux/helm-debian/gpgkey | \
|
||||
gpg --dearmor -o /usr/share/keyrings/helm.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/helm.gpg] https://packages.buildkite.com/helm-linux/helm-debian/any/ any main" \
|
||||
> /etc/apt/sources.list.d/helm-stable-debian.list
|
||||
apt-get update
|
||||
apt-get install -y helm
|
||||
fi
|
||||
|
||||
if [ ! -f /root/registry-password ]; then
|
||||
echo "need /root/registry-password (zot admin password)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p /etc/rancher/k3s
|
||||
cat > /etc/rancher/k3s/registries.yaml <<EOF
|
||||
mirrors:
|
||||
${REGISTRY_HOST}:
|
||||
endpoint:
|
||||
- "https://${REGISTRY_HOST}"
|
||||
configs:
|
||||
${REGISTRY_HOST}:
|
||||
auth:
|
||||
username: admin
|
||||
password: $(cat /root/registry-password)
|
||||
EOF
|
||||
|
||||
systemctl restart k3s
|
||||
|
||||
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||
|
||||
until kubectl get nodes >/dev/null 2>&1; do sleep 2; done
|
||||
|
||||
K01_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
kubectl apply -f "${K01_DIR}/00-base/"
|
||||
|
||||
kubectl apply -f \
|
||||
"https://github.com/cloudnative-pg/cloudnative-pg/releases/download/v${CNPG_VERSION}/cnpg-${CNPG_VERSION}.yaml"
|
||||
|
||||
kubectl create namespace kafka 2>/dev/null || true
|
||||
kubectl apply -n kafka \
|
||||
-f "https://github.com/strimzi/strimzi-kafka-operator/releases/download/${STRIMZI_VERSION}/strimzi-cluster-operator-${STRIMZI_VERSION}.yaml"
|
||||
|
||||
helm repo add ot-helm https://ot-container-kit.github.io/helm-charts/ 2>/dev/null || true
|
||||
helm repo add mongodb https://mongodb.github.io/helm-charts 2>/dev/null || true
|
||||
helm repo update
|
||||
|
||||
helm upgrade --install redis-operator ot-helm/redis-operator \
|
||||
--version "${REDIS_OP_VERSION}" \
|
||||
--namespace redis-operator --create-namespace
|
||||
|
||||
helm upgrade --install mongodb-kubernetes mongodb/mongodb-kubernetes \
|
||||
--version "${MONGODB_OP_VERSION}" \
|
||||
--namespace mongodb-operator --create-namespace \
|
||||
--set operator.watchNamespace=juwan
|
||||
|
||||
kubectl -n cnpg-system rollout status deploy/cnpg-controller-manager --timeout=300s
|
||||
kubectl -n kafka rollout status deploy/strimzi-cluster-operator --timeout=300s
|
||||
kubectl -n redis-operator rollout status deploy/redis-operator --timeout=300s
|
||||
kubectl -n mongodb-operator rollout status deploy/mongodb-kubernetes-operator --timeout=300s
|
||||
|
||||
echo
|
||||
echo "k3s + 4 operators ready"
|
||||
Reference in New Issue
Block a user