Add Swarm cluster to mcp11-k8s-calico model
The change also fixes the network configuration of the infra node and
adds scripts to deploy Kubnernetes environments.
Change-Id: Ib8b3f01210be9180d9c8eaf8dfe885a4475fd82b
diff --git a/scripts/k8s.sh b/scripts/k8s.sh
new file mode 100755
index 0000000..bcf57d9
--- /dev/null
+++ b/scripts/k8s.sh
@@ -0,0 +1,38 @@
+#!/bin/bash -x
+exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1
+
+# Create and distribute SSL certificates for services using salt state
+salt "*" state.sls salt
+
+# Install keepalived
+salt -C 'I@keepalived:cluster' state.sls keepalived -b 1
+
+# Install haproxy
+salt -C 'I@haproxy:proxy' state.sls haproxy
+salt -C 'I@haproxy:proxy' service.status haproxy
+
+# Install docker
+salt -C 'I@docker:host' state.sls docker.host
+salt -C 'I@docker:host' cmd.run "docker ps"
+
+# Install etcd
+salt -C 'I@etcd:server' state.sls etcd.server.service
+salt -C 'I@etcd:server' cmd.run "etcdctl cluster-health"
+
+# Install Kubernetes and Calico
+salt -C 'I@kubernetes:master' state.sls kubernetes.master.kube-addons
+salt -C 'I@kubernetes:pool' state.sls kubernetes.pool
+salt -C 'I@kubernetes:pool' cmd.run "calicoctl node status"
+salt -C 'I@kubernetes:pool' cmd.run "calicoctl get ippool"
+
+# Setup NAT for Calico
+salt -C 'I@kubernetes:master' state.sls etcd.server.setup
+
+# Run whole master to check consistency
+salt -C 'I@kubernetes:master' state.sls kubernetes exclude=kubernetes.master.setup
+
+# Register addons
+salt -C 'I@kubernetes:master' --subset 1 state.sls kubernetes.master.setup
+
+# Nginx needs to be configured
+salt -C 'I@nginx:server' state.sls nginx