From d7f96d14441eafda776d3c6475b8b0d93d91de39 Mon Sep 17 00:00:00 2001 From: Michael Polenchuk Date: Thu, 7 Mar 2019 18:57:49 +0400 Subject: Bring in kubernetes scenario Change-Id: I2b41ce2e275bb053fa2590654ea7fa432b0c857f Signed-off-by: Michael Polenchuk --- mcp/config/states/kubernetes | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 mcp/config/states/kubernetes (limited to 'mcp/config/states') diff --git a/mcp/config/states/kubernetes b/mcp/config/states/kubernetes new file mode 100755 index 000000000..0894b10a6 --- /dev/null +++ b/mcp/config/states/kubernetes @@ -0,0 +1,39 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2019 Mirantis Inc., Enea AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x + +# Create and distribute SSL certificates for services +salt-call state.sls salt.minion + +# Install etcd +salt -I 'etcd:server' state.sls etcd.server.service +salt -I 'etcd:server' cmd.run ". /var/lib/etcd/configenv && etcdctl cluster-health" + +# Install Kubernetes and Calico +salt -I 'kubernetes:master' state.sls kubernetes.master.kube-addons +salt -I 'kubernetes:pool' state.sls kubernetes.pool +salt -I 'kubernetes:pool' cmd.run "calicoctl node status" +salt -I 'kubernetes:pool' cmd.run "calicoctl get ippool" + +# Setup NAT for Calico +salt -I 'kubernetes:master' state.sls etcd.server.setup + +# Run whole master to check consistency +salt -I 'kubernetes:master' state.sls kubernetes exclude=kubernetes.master.setup + +# Register addons +salt -I 'kubernetes:master' state.sls kubernetes.master.setup + +# Upload config +K8S_CONFIG=kubernetes.config +K8S_HOST_ID=$(salt -I 'kubernetes:master' --out=yaml cp.push \ + /etc/kubernetes/admin-kube-config \ + upload_path="$K8S_CONFIG" | cut -d':' -f1) +cd /opt && ln -sf "/var/cache/salt/master/minions/${K8S_HOST_ID}/files/${K8S_CONFIG}" -- cgit 1.2.3-korg