mirror of
https://github.com/jcwimer/startup-infrastructure
synced 2026-03-24 22:34:42 +00:00
Switched from docker swarm to Kubernetes with rke
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
---
|
||||
# Variables listed here are applicable to all host groups
|
||||
|
||||
### Software versions
|
||||
docker_ce_version_to_install: 18.03.1
|
||||
|
||||
### rke variables
|
||||
rke_directory: /opt/rke
|
||||
rke_ssh_key_location: /vagrant/tests/files/test_rsa
|
||||
rke_node_directory: /opt/rke
|
||||
rke_version: 0.3.1
|
||||
rke_cluster_name: rke-k8s
|
||||
|
||||
### User stuff
|
||||
################################ REQUIRED ################################
|
||||
################################ User stuff
|
||||
standard_user: vagrant
|
||||
chosen_timezone: "America/New_York"
|
||||
# root domain for all services. You should have an A record for *.root_domain. For example, if your domain is test.com you should have an A record for *.test.com pointing to your node.
|
||||
# this will allow automatic dns for for things like dokuwiki.test.com and portainer.test.com
|
||||
root_domain: test.com
|
||||
root_domain: 192.168.254.3.xip.io
|
||||
rke_ssh_key_location: /home/vagrant/test_rsa
|
||||
|
||||
# the directory on your localhost to store all deployment yaml for apps deployed
|
||||
startup_infrastructure_directory: /home/{{ standard_user }}/startup-infrastructure
|
||||
|
||||
################################ STORAGE CONFIG
|
||||
longhorn_enabled: True
|
||||
|
||||
|
||||
################################ OPTIONAL ################################
|
||||
################################ RKE (Kubernetes deployment) variables
|
||||
kubernetes_network_interface: eth1
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /root/.ssh
|
||||
|
||||
# Putting test_rsa.pub into root and vagrant authorized keys
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYa9zstumlg7XkKoNrJMlIN/zteqMA9J4GjuZA7r0xfMPrz4CglxzYKd/BhBpwp/HhU+vSR6vBa15kRODHdPZ+T1oXzMXAmMT3R2ZJRqF280Hsx9sK0X+FZWM84e4a1zQUrxuWyWJ4kKIiaX6DBAmhy8zHNvQ0c4Nk1exfwRicojaze71qrexSas4FHWaI4usC/g3mMKfiML/QX0UWW/G+D8qrg3cK3zClG916XlY/p1h9SWantqz75ea33TtmDNW6iCraKSjVeDGfzhshJsmQ7+/Rr/L4/s7hdpwTqdjSlJTIi61eBxcpDfMWBmsHOMZgnsTZ3wrdYXo70k44moA7 vagrant@test" >> /home/vagrant/.ssh/authorized_keys
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYa9zstumlg7XkKoNrJMlIN/zteqMA9J4GjuZA7r0xfMPrz4CglxzYKd/BhBpwp/HhU+vSR6vBa15kRODHdPZ+T1oXzMXAmMT3R2ZJRqF280Hsx9sK0X+FZWM84e4a1zQUrxuWyWJ4kKIiaX6DBAmhy8zHNvQ0c4Nk1exfwRicojaze71qrexSas4FHWaI4usC/g3mMKfiML/QX0UWW/G+D8qrg3cK3zClG916XlY/p1h9SWantqz75ea33TtmDNW6iCraKSjVeDGfzhshJsmQ7+/Rr/L4/s7hdpwTqdjSlJTIi61eBxcpDfMWBmsHOMZgnsTZ3wrdYXo70k44moA7 vagrant@test" >> /root/.ssh/authorized_keys
|
||||
|
||||
# Setting A record
|
||||
echo "192.168.254.2 swarm.test.com" >> /etc/hosts
|
||||
echo "192.168.254.2 portainer.test.com" >> /etc/hosts
|
||||
# echo "192.168.254.2 mysql-orchestrator.test.com" >> /etc/hosts
|
||||
# echo "192.168.254.2 kanban.test.com" >> /etc/hosts
|
||||
|
||||
cp /vagrant/tests/files/test_rsa /home/vagrant/test_rsa
|
||||
chmod 600 /home/vagrant/test_rsa
|
||||
chown vagrant:vagrant /home/vagrant/test_rsa
|
||||
chown vagrant:vagrant /home/vagrant/test_rsa
|
||||
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq lvm2 curl
|
||||
3
tests/lib/mysql-query.sh
Normal file
3
tests/lib/mysql-query.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
kubectl run mysql-client --image=mysql:5.7 -it --rm --restart=Never \
|
||||
-- mysql -h mysql-cluster-mysql -u root -ppassword -e "show databases; show slave status;"
|
||||
@@ -9,7 +9,7 @@ function testbash() {
|
||||
local name="${1}"
|
||||
shift
|
||||
local command="${@}"
|
||||
eval $command
|
||||
eval "${command}"
|
||||
local return=$?
|
||||
if [[ ! $return -eq 0 ]]; then
|
||||
echo "${red}FAILED: ${name}${reset}"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -eEuo pipefail
|
||||
|
||||
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))"
|
||||
source ${project_dir}/tests/lib/test-function.sh
|
||||
@@ -24,11 +25,13 @@ function run-tests {
|
||||
"vagrant ssh client -c 'bash /vagrant/tests/files/run-test-deploy.sh'"
|
||||
|
||||
testbash "Running kubectl should not fail" \
|
||||
"vagrant ssh client -c 'export KUBECONFIG=/opt/rke/kube_config_rke-k8s.yaml; kubectl get nodes'"
|
||||
"vagrant ssh client -c 'kubectl get nodes'"
|
||||
|
||||
# testbash "Portainer was deployed and admin account was initialized" \
|
||||
# "vagrant ssh client -c 'curl --silent -I \
|
||||
# -X GET \"http://portainer.test.com/api/users/admin/check\" -H \"accept: application/json\"' | grep 204"
|
||||
testbash "Longhorn dashboard is running" \
|
||||
"vagrant ssh client -c 'curl --silent -I -X GET http://longhorn.192.168.254.3.xip.io/dashboard' | grep '200 OK'"
|
||||
|
||||
testbash "Running a query on the mysql cluster should not fail" \
|
||||
"vagrant ssh client -c 'bash /vagrant/tests/lib/mysql-query.sh'"
|
||||
}
|
||||
|
||||
function destroy-infrastructure {
|
||||
|
||||
Reference in New Issue
Block a user