All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
38 lines
867 B
Bash
Executable File
38 lines
867 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$IMAGE_TAG" == "" ]; then
|
|
echo "Make sure IMAGE_TAG is set"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
IMAGE_NAME=gitea.hottis.de/deployments/exim-forwarder
|
|
NAMESPACE=forwarder
|
|
DEPLOYMENT_DIR=$PWD/deployment
|
|
|
|
pushd $DEPLOYMENT_DIR > /dev/null
|
|
|
|
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 "Waiting for certificate secret to be created..."
|
|
kubectl wait --for=condition=Ready certificate/exim-forwarder-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..."
|
|
cat $DEPLOYMENT_DIR/deploy-yml.tmpl | \
|
|
sed -e 's,%IMAGE%,'$IMAGE_NAME':'$IMAGE_TAG','g | \
|
|
kubectl apply -f - -n $NAMESPACE
|
|
|
|
popd > /dev/null
|
|
|