add error handling for missing config

This commit is contained in:
az 2021-12-01 18:24:29 +01:00
parent b266053f19
commit f59b3fca11
2 changed files with 29 additions and 7 deletions

View file

@ -28,14 +28,22 @@ Note: In case of not being able to connect to "k3stesthost/health", you might ne
- check files `aws --endpoint-url=http://k3stesthost s3 ls s3://mybucket`
## Run docker locally
`docker pull docker:19.03.12-dind`
`docker run -d --privileged --name integration-test docker:19.03.12-dind`
```
docker pull docker:19.03.12-dind
docker run -d --privileged --name integration-test docker:19.03.12-dind
docker exec integration-test sh -c "apk add bash"
```
Set up docker container integration-test:
`docker cp setup-docker.sh integration-test:/`
`docker exec -it integration-test sh`
`chmod +x setup-docker.sh`
`./setup-docker.sh`
```
docker cp setup-docker.sh integration-test:/
docker exec -it integration-test sh
./setup-docker.sh
```
## Deploy nextcloud

View file

@ -1,8 +1,22 @@
#!/bin/bash
set -ex
docker run -d --privileged --tmpfs /run --tmpfs /var/run --restart always -e K3S_TOKEN=12345678901234 -e K3S_KUBECONFIG_OUTPUT=./kubeconfig.yaml -e K3S_KUBECONFIG_MODE=666 -v k3s-server:/var/lib/rancher/k3s:z -v $(pwd):/output:z -p 6443:6443 -p 80:80 -p 443:443 rancher/k3s server --cluster-init
export timeout=60; while [ ! -f /var/lib/docker/volumes/k3s-server/_data/server/kubeconfig.yaml ]; do if [ "$timeout" == 0 ]; then echo "ERROR: Timeout while waiting for file."; break; fi; sleep 1; ((timeout--)); done
mkdir -p $HOME/.kube/
if [ "$timeout" == 0 ]
then
echo -------------------------------------------------------
find . -name "kubeconfig.yaml";
echo -------------------------------------------------------
docker ps -a
echo -------------------------------------------------------
exit -1
fi
mkdir -p $HOME/.kube/
cp /var/lib/docker/volumes/k3s-server/_data/server/kubeconfig.yaml $HOME/.kube/config
apk add git curl bash sudo openjdk8 wget