32 lines
808 B
Bash
Executable File
32 lines
808 B
Bash
Executable File
#!/bin/bash
|
|
|
|
NAMESPACE=mosquitto
|
|
|
|
kubectl create namespace $NAMESPACE \
|
|
--dry-run=client \
|
|
-o yaml | \
|
|
kubectl -f - apply
|
|
|
|
echo "Applying certificate ..."
|
|
kubectl apply -f $DEPLOYMENT_DIR/certificate.yml -n $NAMESPACE
|
|
|
|
echo "Applyiny configuration ..."
|
|
kubectl create configmap mosquitto-broker-config
|
|
--from-file=mosquitto.conf=mosquitto.conf
|
|
--from-file=pwfile=pwfile
|
|
--namespace=$NAMESPACE
|
|
--dry-run=client -o yaml | kubectl apply -f - -n $NAMESPACE
|
|
|
|
echo "Waiting for certificate secret to be created..."
|
|
kubectl wait --for=condition=Ready certificate/mosquitto-broker-cert -n $NAMESPACE --timeout=300s
|
|
|
|
if [ $? -ne 0 ]; then
|
|
echo "Certificate secret creation failed or timed out"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Certificate ready, applying deployment ..."
|
|
|
|
kubectl apply -f deploy.yml -n $NAMESPACE
|
|
|