summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-12 07:33:47 +0000
committerGerrit Code Review <review@openstack.org>2019-02-12 07:33:48 +0000
commit6139799be23d6421e768dd068949982eab5f2cb3 (patch)
tree916f7ab8ca17d50dfb0338788adba897c8e11e44
parent1253de101a99c6786482ee40fd00d43f9d351a5f (diff)
parentb1f36deedc0b97d4e7538c7c43072615f40178ff (diff)
Merge "Add Ubuntu version of heat-config-kubelet"1.8.0stable/stein
-rwxr-xr-xheat-config-kubelet/install.d/50-heat-config-kubelet74
1 files changed, 72 insertions, 2 deletions
diff --git a/heat-config-kubelet/install.d/50-heat-config-kubelet b/heat-config-kubelet/install.d/50-heat-config-kubelet
index 06bf0fa..8edeaa4 100755
--- a/heat-config-kubelet/install.d/50-heat-config-kubelet
+++ b/heat-config-kubelet/install.d/50-heat-config-kubelet
@@ -73,10 +73,80 @@ EOF
73 systemctl enable heat-config-kubelet-nat-rule.service 73 systemctl enable heat-config-kubelet-nat-rule.service
74 systemctl disable firewalld 74 systemctl disable firewalld
75 75
76SCRIPTDIR=$(dirname $0) 76elif [[ "ubuntu" =~ "$DISTRO_NAME" ]]; then
77install -D -g root -o root -m 0755 ${SCRIPTDIR}/hook-kubelet.py /var/lib/heat-config/hooks/kubelet 77 apt-get update
78 apt-get install -y apt-transport-https gnupg
79 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add
80 cat << EOF > /etc/apt/sources.list.d/kubernetes.list
81deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main
82EOF
83 apt-get update
84 apt-get install -y kubelet kubeadm kubectl kubernetes-cni bridge-utils docker.io
85
86 cat << EOF > /etc/network/interfaces.d/cbr0.cfg
87auto cbr0
88iface cbr0 inet static
89bridge_ports none
90bridge_stp on
91bridge_waitport 2
92bridge_fd 2
93address 10.240.1.1
94netmask 255.255.255.0
95mtu 1450
96post-up /bin/ip route add 10.240.0.0/16 dev cbr0 scope link src 10.240.1.1
97EOF
98
99# defer docker starting until cbr0 is up
100cat > /etc/systemd/system/docker.service <<EOF
101.include /lib/systemd/system/docker.service
102[Unit]
103After=network-online.target docker.socket
104EOF
105
106 cat > /etc/systemd/system/heat-config-kubelet-nat-rule.service <<EOF
107[Unit]
108Description=iptables rule to allow nat masquerading out of 10.240.1.0/24
109
110[Service]
111ExecStart=/sbin/iptables -t nat -A POSTROUTING -o eth0 -s 10.240.1.0/24 -j MASQUERADE
112Type=oneshot
113
114[Install]
115WantedBy=multi-user.target
116EOF
117
118if [ -f "/opt/heat-docker/images.tar" ]; then
119 cat > /etc/systemd/system/heat-config-kubelet-load-images.service <<EOF
120[Unit]
121Description=Call docker load on /opt/heat-config/images.tar
122After=docker.service
123Before=os-collect-config.service kubelet.service
124
125[Service]
126ExecStart=/usr/bin/docker load -i /opt/heat-docker/images.tar
127ExecStart=/bin/rm -f /opt/heat-docker/images.tar
128Type=oneshot
129
130[Install]
131WantedBy=multi-user.target
132EOF
133 systemctl enable heat-config-kubelet-load-images.service
134fi
135
136 cat << EOF > /etc/docker/daemon.json
137{ "bridge": "cbr0", "mtu": 1450, "iptables": false, "insecure-registries": ["192.168.20.112:5001"] }
138EOF
139
140 sed -e 's|KUBELET_EXTRA_ARGS=|KUBELET_EXTRA_ARGS="--config=/var/lib/heat-config/heat-config-kubelet/kubelet-manifests"|g' -i /etc/default/kubelet
141 systemctl disable docker.service
142 systemctl enable docker.service
143 systemctl enable kubelet.service
144 systemctl enable heat-config-kubelet-nat-rule.service
78 145
79else 146else
80 echo "Distribution '$DISTRO_NAME' is not supported" 147 echo "Distribution '$DISTRO_NAME' is not supported"
81 exit 1 148 exit 1
82fi 149fi
150
151SCRIPTDIR=$(dirname $0)
152install -D -g root -o root -m 0755 ${SCRIPTDIR}/hook-kubelet.py /var/lib/heat-config/hooks/kubelet