Fix Kubernetes suite tests.
Also deploy kubernetes dashboard prior to authelia services to ease debugging of the suite.pull/447/head
parent
e20112f209
commit
b2ced06402
|
@ -39,6 +39,9 @@ var hostEntries = []HostEntry{
|
||||||
HostEntry{Domain: "proxy-client1.example.com", IP: "192.168.240.201"},
|
HostEntry{Domain: "proxy-client1.example.com", IP: "192.168.240.201"},
|
||||||
HostEntry{Domain: "proxy-client2.example.com", IP: "192.168.240.202"},
|
HostEntry{Domain: "proxy-client2.example.com", IP: "192.168.240.202"},
|
||||||
HostEntry{Domain: "proxy-client3.example.com", IP: "192.168.240.203"},
|
HostEntry{Domain: "proxy-client3.example.com", IP: "192.168.240.203"},
|
||||||
|
|
||||||
|
// Kubernetes dashboard
|
||||||
|
HostEntry{Domain: "kubernetes.example.com", IP: "192.168.240.110"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCommand(cmd string, args ...string) {
|
func runCommand(cmd string, args ...string) {
|
||||||
|
|
|
@ -1,4 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Retries a command on failure.
|
||||||
|
# $1 - the max number of attempts
|
||||||
|
# $2... - the command to run
|
||||||
|
|
||||||
|
retry() {
|
||||||
|
local -r -i max_attempts="$1"; shift
|
||||||
|
local -r cmd="$@"
|
||||||
|
local -i attempt_num=1
|
||||||
|
until $cmd
|
||||||
|
do
|
||||||
|
if ((attempt_num==max_attempts))
|
||||||
|
then
|
||||||
|
echo "Attempt $attempt_num failed and there are no more attempts left!"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
echo "Attempt $attempt_num failed! Trying again in 10 seconds..."
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
|
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
|
||||||
kubectl port-forward --address 0.0.0.0 -n kubernetes-dashboard service/kubernetes-dashboard 443:443
|
retry 10 kubectl port-forward --address 0.0.0.0 -n kubernetes-dashboard service/kubernetes-dashboard 443:443
|
|
@ -93,6 +93,8 @@ storage:
|
||||||
host: mariadb-service
|
host: mariadb-service
|
||||||
port: 3306
|
port: 3306
|
||||||
database: authelia
|
database: authelia
|
||||||
|
username: admin
|
||||||
|
password: password
|
||||||
|
|
||||||
notifier:
|
notifier:
|
||||||
smtp:
|
smtp:
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
start_dashboard() {
|
||||||
|
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta4/aio/deploy/recommended.yaml
|
||||||
|
kubectl apply -f dashboard.yml
|
||||||
|
|
||||||
|
echo "Bearer token for UI user."
|
||||||
|
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
|
start_dashboard
|
|
@ -12,14 +12,6 @@ start_ingress_controller() {
|
||||||
kubectl apply -f ingress-controller
|
kubectl apply -f ingress-controller
|
||||||
}
|
}
|
||||||
|
|
||||||
start_dashboard() {
|
|
||||||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta4/aio/deploy/recommended.yaml
|
|
||||||
kubectl apply -f dashboard.yml
|
|
||||||
|
|
||||||
echo "Bearer token for UI user."
|
|
||||||
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print $1}')
|
|
||||||
}
|
|
||||||
|
|
||||||
# Spawn Redis and storage backend
|
# Spawn Redis and storage backend
|
||||||
# Please note they are not configured to be distributed on several machines
|
# Please note they are not configured to be distributed on several machines
|
||||||
start_storage() {
|
start_storage() {
|
||||||
|
@ -42,7 +34,6 @@ create_namespace() {
|
||||||
}
|
}
|
||||||
|
|
||||||
create_namespace
|
create_namespace
|
||||||
start_dashboard
|
|
||||||
start_storage
|
start_storage
|
||||||
start_ldap
|
start_ldap
|
||||||
start_mail
|
start_mail
|
||||||
|
|
|
@ -83,6 +83,24 @@ func (k Kubectl) StopProxy() error {
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StartDashboard start Kube dashboard
|
||||||
|
func (k Kubectl) StartDashboard() error {
|
||||||
|
if err := kindCommand("sh -c 'cd /authelia && ./bootstrap-dashboard.sh'").Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := utils.Shell("docker-compose -f docker-compose.yml -f example/compose/kind/docker-compose.yml up -d kube-dashboard").Run(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// StopDashboard stop kube dashboard
|
||||||
|
func (k Kubectl) StopDashboard() error {
|
||||||
|
cmd := utils.Shell("docker-compose -f docker-compose.yml -f example/compose/kind/docker-compose.yml rm -s -f kube-dashboard")
|
||||||
|
return cmd.Run()
|
||||||
|
}
|
||||||
|
|
||||||
// DeployThirdparties deploy thirdparty services (ldap, db, ingress controllers, etc...)
|
// DeployThirdparties deploy thirdparty services (ldap, db, ingress controllers, etc...)
|
||||||
func (k Kubectl) DeployThirdparties() error {
|
func (k Kubectl) DeployThirdparties() error {
|
||||||
cmd := kindCommand("sh -c 'cd /authelia && ./bootstrap.sh'")
|
cmd := kindCommand("sh -c 'cd /authelia && ./bootstrap.sh'")
|
||||||
|
|
|
@ -41,6 +41,11 @@ func init() {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debug("Starting Kubernetes dashboard...")
|
||||||
|
if err := kubectl.StartDashboard(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
log.Debug("Deploying thirdparties...")
|
log.Debug("Deploying thirdparties...")
|
||||||
if err = kubectl.DeployThirdparties(); err != nil {
|
if err = kubectl.DeployThirdparties(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue