diff options
Diffstat (limited to 'src/fuel-plugin/deployment_scripts')
4 files changed, 77 insertions, 0 deletions
diff --git a/src/fuel-plugin/deployment_scripts/k8s-master-install.sh b/src/fuel-plugin/deployment_scripts/k8s-master-install.sh new file mode 100755 index 0000000..6d05ede --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/k8s-master-install.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -eux + +api_advertise_address=$1 +service_cidr=$2 +pod_network=$3 +pod_network_cidr=$4 +token='8c5adc.1cec8dbf339093f0' + +curl -s http://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - +cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list +deb http://apt.kubernetes.io/ kubernetes-xenial main +EOF + +sudo apt-get update +sudo apt-get install -y docker.io +sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni +rm -rf /var/lib/kubelet +sudo kubeadm init --api-advertise-addresses $api_advertise_address --service-cidr=$service_cidr --pod-network-cidr=$pod_network_cidr --token $token + +if [ $pod_network_cidr = 'flannel' ]; then + sudo kubectl apply -f http://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml +else + sudo kubectl apply -f http://git.io/weave-kube +fi diff --git a/src/fuel-plugin/deployment_scripts/k8s-slave-install.sh b/src/fuel-plugin/deployment_scripts/k8s-slave-install.sh new file mode 100755 index 0000000..cc7652f --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/k8s-slave-install.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eux + +api_advertise_address=$1 +token='8c5adc.1cec8dbf339093f0' + +curl -s http://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - +cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list +deb http://apt.kubernetes.io/ kubernetes-xenial main +EOF +sudo apt-get update +sudo apt-get install -y docker.io +sudo apt-get install -y kubelet kubeadm kubectl kubernetes-cni +rm -rf /var/lib/kubelet +sudo kubeadm join --token $token $api_advertise_address || true diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp new file mode 100644 index 0000000..8c52fad --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-master-install.pp @@ -0,0 +1,22 @@ +notice('MODULAR: k8s-master-install') +# get options + +$network_metadata = hiera_hash('network_metadata') +$k8s_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['k8s-master']) +$k8s_mgmt_ips_hash = get_node_to_ipaddr_map_by_network_role($k8s_nodes_hash, 'management') +$k8s_mgmt_ips = values($k8s_mgmt_ips_hash) + +$network_scheme = hiera_hash('network_scheme') +$service_cidr = $network_scheme['endpoints']['br-mgmt']['IP'] + +$k8s_settings = hiera_hash('fuel-plugin-k8s') +$pod_network = $k8s_settings['pod_network'] +$pod_network_cidr = $k8s_settings['pod_network_cidr'] + +if $operatingsystem == 'Ubuntu' { + exec { 'install k8s master': + command => "/etc/fuel/plugins/fuel-plugin-k8s-1.0/k8s-master-install.sh $k8s_mgmt_ips $service_cidr $pod_network $pod_network_cidr", + path => '/usr/bin:/usr/sbin:/bin:/sbin', + } +} elsif $operatingsystem == 'CentOS' { +} diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp new file mode 100644 index 0000000..4e4863b --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/k8s-slave-install.pp @@ -0,0 +1,15 @@ +notice('MODULAR: k8s-slave-install') +# get options + +$network_metadata = hiera_hash('network_metadata') +$k8s_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['k8s-master']) +$k8s_mgmt_ips_hash = get_node_to_ipaddr_map_by_network_role($k8s_nodes_hash, 'management') +$k8s_mgmt_ips = values($k8s_mgmt_ips_hash) + +if $operatingsystem == 'Ubuntu' { + exec { 'install k8s slave': + command => "/etc/fuel/plugins/fuel-plugin-k8s-1.0/k8s-slave-install.sh $k8s_mgmt_ips", + path => '/usr/bin:/usr/sbin:/bin:/sbin', + } +} elsif $operatingsystem == 'CentOS' { +} |