Skip to content

Commit fbd0c33

Browse files
committed
Merge branch 'master' into release-1.0
2 parents df48b86 + b8ffffa commit fbd0c33

File tree

11 files changed

+94
-43
lines changed

11 files changed

+94
-43
lines changed

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Install Contiv on your Docker Swarm or Kubernetes cluster.
33
## Docker Swarm Installation
44
### Prerequisites
5-
* CentOS 7.x operating system
5+
* CentOS 7.x operating system.
6+
* Python installed on the master and worker nodes.
67
* Docker installed on the host where you are running the installer.
78
* Install a Docker Swarm cluster or use the Contiv installer to install the scheduler stack after installing Docker on a node external to the cluster where the scheduler stack is being installed.
89

@@ -16,34 +17,38 @@ If your access to the Internet is limited or slow and you want to download the f
1617
Note: The full image contains only Contiv components. Installing Docker Swarm will need Internet connectivity.
1718
* Extract the install bundle <br>`tar oxf contiv-$VERSION.tgz`.
1819
* Change directories to the extracted folder <br>`cd contiv-$VERSION`
19-
* To install Contiv with Docker Swarm:<br> `./install/ansible/install_swarm.sh -f cfg.yml -e <ssh key> -u <username> -i`
20-
* To install Contiv with Docker Swarm and ACI:<br> `./install/ansible/install_swarm.sh -f aci_cfg.yml -e <ssh key> -u <username> -i -m aci`
20+
* To install Contiv with Docker Legacy Swarm:<br> `./install/ansible/install_swarm.sh -f cfg.yml -e <ssh key> -u <username> -i`
21+
* To install Contiv with Docker Legacy Swarm and ACI:<br> `./install/ansible/install_swarm.sh -f aci_cfg.yml -e <ssh key> -u <username> -i -m aci`
22+
* To install Contiv v2plugin:<br> `./install/ansible/install_swarm.sh -f cfg.yml -e <ssh key> -u <username> -p`
2123
* Example host config files are available at install/ansible/cfg.yml and install/ansible/aci_cfg.yml
2224
* To see additional install options and examples, run <br>`./install/ansible/install_swarm.sh -h`.
2325

2426
### Removing Contiv
2527

2628
If you need to remove Contiv from Docker Swarm and return to your original state, you can uninstall Contiv with the following commands:
27-
* To uninstall Contiv and Docker Swarm:<br>
29+
* To uninstall Contiv and Docker Legacy Swarm:<br>
2830
`./install/ansible/uninstall_swarm.sh -f cfg.yml -e <ssh key> -u <username> -i`
29-
* To uninstall Contiv and Docker Swarm with ACI support:<br>
31+
* To uninstall Contiv and Docker Legacy Swarm with ACI support:<br>
3032
`./install/ansible/uninstall_swarm.sh -f aci_cfg.yml -e <ssh key> -u <username> -i -m aci`
31-
* To uninstall Contiv and not Docker Swarm:<br>
33+
* To uninstall Contiv and not Docker Legacy Swarm:<br>
3234
`./install/ansible/uninstall_swarm.sh -f cfg.yml -e <ssh key> -u <username>`
35+
* To uninstall Contiv v2plugin:<br>
36+
`./install/ansible/uninstall_swarm.sh -f cfg.yml -e <ssh key> -u <username> -p`
3337
* Note: Adding the `-r` flag, will cleanup any Contiv state.
3438

35-
## Kubernetes 1.4 Installation
39+
## Kubernetes Installation
3640

3741
### Prerequisites
3842

43+
* Kubernetes 1.4.x, 1.5.x and 1.6.2+ are supported with the following instructions.
3944
* CentOS 7.x operating system
40-
* Install Kubernetes 1.4:
41-
1. Contiv service-cidr is currently 10.254.0.0/16. `kubeadm init` step needs to be called with the `--service-cidr 10.254.0.0/16` parameter.
42-
2. kubeadm installs the latest Kubernetes version. To install the latest supported version use the `--use-kubernetes-version v1.4.7` parameter.<br>
43-
See an example script [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.4/k8smaster.sh)
44-
3. Replace step (3/4) in the kubeadm install guide with the following Contiv Installation Instructions. Contiv installation can be done after completing step (4/4).
45-
4. Instructions to install Kubernetes 1.4 are available [here.](http://kubernetes.io/docs/getting-started-guides/kubeadm/)
46-
5. **NOTE:** A recent kubeadm update has rendered the latest kubeadm unable to install Kubernetes 1.4. To workaround this issue, please use kubeadm version 1.6.0-0.alpha or earlier.
45+
* Install Kubernetes:
46+
1. kubeadm installs the latest Kubernetes version. <br>
47+
For Kubernetes 1.4, see an example script [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.4/k8smaster.sh)
48+
For Kubernetes 1.6, see an example script [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.6/k8smaster.sh)
49+
1. Replace step (3/4) in the kubeadm install guide with the following Contiv Installation Instructions. Contiv installation can be done after completing step (4/4).
50+
1. Instructions to install Kubernetes are available [here.](http://kubernetes.io/docs/getting-started-guides/kubeadm/)
51+
1. **Kubernetes 1.4 NOTE:** A recent kubeadm update has rendered the latest kubeadm unable to install Kubernetes 1.4. To workaround this issue, please use kubeadm version 1.6.0-0.alpha or earlier.
4752
Example pre-built RPMs are available as shown [here.](https://github.com/contiv/install/blob/master/cluster/k8s1.4/bootstrap_centos.sh#L22-L26)
4853

4954
### Contiv Installation

install/ansible/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
FROM alpine
2-
3-
RUN apk add --no-cache python openssl libffi \
4-
py-pip ansible nmap-ncat
1+
FROM alpine:3.6
52

3+
RUN DEV_PACKAGES="python-dev gcc musl-dev openssl-dev libffi-dev" \
4+
&& apk add --no-cache python openssl libffi nmap-ncat py-pip $DEV_PACKAGES \
5+
&& pip install --upgrade pip \
6+
&& pip install ansible==2.3.1.0 \
7+
&& apk del $DEV_PACKAGES

install/ansible/env.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"etcd_cleanup_state": "False",
1414
"auth_proxy_local_install": "False",
1515
"contiv_network_local_install": "False",
16+
"netctl_url": "http://netmaster:9999",
1617
"contiv_v2plugin_install": "False",
1718
"contiv_v2plugin_image": "contiv/v2plugin:__CONTIV_V2PLUGIN_VERSION__"
1819
}

install/ansible/install.sh

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh
22

3+
set -xeuo pipefail
4+
35
# This scripts runs in a container with ansible installed.
46
. ./install/ansible/install_defaults.sh
57

@@ -19,6 +21,7 @@ install_scheduler=false
1921

2022
# This is the netmaster IP that needs to be provided for the installation to proceed
2123
netmaster=""
24+
contiv_v2plugin_install=""
2225

2326
usage() {
2427
echo "Usage:"
@@ -90,14 +93,18 @@ if [ "$netmaster" = "" ]; then
9093
usage
9194
fi
9295

96+
if [ "$install_scheduler" = "true" ] && [ "$contiv_v2plugin_install" = "true" ]; then
97+
echo "ERROR: -p and -i are mutually exclusive"
98+
usage
99+
fi
100+
93101
ansible_path=./ansible
94102
env_file=install/ansible/env.json
95103
# Verify ansible can reach all hosts
96104

97105
echo "Verifying ansible reachability"
98-
ansible all $ans_opts -i $host_inventory -m setup -a 'filter=ansible_distribution*' >&$inventory_log
99-
egrep 'FAIL|UNREACHABLE' $inventory_log >&/dev/null
100-
if [ $? -eq 0 ]; then
106+
ansible all -vvv $ans_opts -i $host_inventory -m setup -a 'filter=ansible_distribution*' | tee $inventory_log
107+
if [ egrep 'FAIL|UNREACHABLE' $inventory_log > /dev/null ]; then
101108
echo "WARNING Some of the hosts are not accessible via passwordless SSH"
102109
echo " "
103110
echo "This means either the host is unreachable or passwordless SSH is not"
@@ -131,22 +138,30 @@ cp /var/contiv/key.pem /ansible/roles/auth_proxy/files/
131138
if [ "$aci_image" != "" ]; then
132139
sed -i.bak "s#.*aci_gw_image.*#\"aci_gw_image\":\"$aci_image\",#g" "$env_file"
133140
fi
141+
if [ "$contiv_v2plugin_install" == "true" ]; then
142+
sed -i.bak "s#.*contiv_v2plugin_install.*#\"contiv_v2plugin_install\":\"True\",#g" "$env_file"
143+
else
144+
sed -i.bak "s#.*contiv_v2plugin_install.*#\"contiv_v2plugin_install\":\"False\",#g" "$env_file"
145+
fi
134146

135147
echo "Installing Contiv"
136148
# Always install the base, install the scheduler stack/etcd if required
137-
echo '- include: install_base.yml' >$ansible_path/install_plays.yml
138149

139-
if [ "$install_scheduler" == "true" ] ; then
150+
rm -f $ansible_path/install_plays.yml
151+
touch $ansible_path/install_plays.yml
152+
153+
if [ "$install_scheduler" == "true" ]; then
154+
echo '- include: install_base.yml' >$ansible_path/install_plays.yml
140155
echo '- include: install_docker.yml' >>$ansible_path/install_plays.yml
141156
echo '- include: install_etcd.yml' >>$ansible_path/install_plays.yml
142157
echo '- include: install_scheduler.yml' >>$ansible_path/install_plays.yml
143158
else
144159
if [ "$install_etcd" == "true" ]; then
145-
echo '- include: install_etcd.yml' >>$ansible_path/install_plays.yml
160+
echo '- include: install_etcd.yml' >$ansible_path/install_plays.yml
146161
fi
147162
fi
148163
# Install contiv & API Proxy
149-
if [ "$contiv_v2plugin_install" == "true" ] ; then
164+
if [ "$contiv_v2plugin_install" == "true" ]; then
150165
echo '- include: install_v2plugin.yml' >>$ansible_path/install_plays.yml
151166
echo '- include: install_auth_proxy.yml' >>$ansible_path/install_plays.yml
152167
else
@@ -172,6 +187,8 @@ chmod 666 $inventory_log
172187
chmod 666 $env_file
173188
chmod 666 $log_file
174189

190+
set +x
191+
175192
if [ "$unreachable" = "" ] && [ "$failed" = "" ]; then
176193
echo "Installation is complete"
177194
echo "========================================================="
@@ -188,6 +205,7 @@ if [ "$unreachable" = "" ] && [ "$failed" = "" ]; then
188205
echo " For example, netctl net create -t default --subnet=20.1.1.0/24 default-net"
189206
echo " "
190207
echo "========================================================="
208+
exit 0
191209
else
192210
echo "Installation failed"
193211
echo "========================================================="

install/ansible/install_swarm.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -euo pipefail
4+
35
# This is the installation script for Contiv.
46

57
. ./install/ansible/install_defaults.sh
@@ -9,6 +11,9 @@ ans_opts=""
911
ans_user="root"
1012
ans_key=$src_conf_path/insecure_private_key
1113
install_scheduler=""
14+
netmaster=""
15+
v2plugin_param=""
16+
contiv_v2plugin_install=""
1217

1318
# Check for docker
1419

install/ansible/uninstall.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh
22

3+
set -xeuo pipefail
34
# This scripts runs in a container with ansible installed.
45
. ./install/ansible/install_defaults.sh
56

@@ -103,9 +104,8 @@ env_file=install/ansible/env.json
103104
# Verify ansible can reach all hosts
104105

105106
echo "Verifying ansible reachability"
106-
ansible all $ans_opts -i $host_inventory -m setup -a 'filter=ansible_distribution*' >&$inventory_log
107-
egrep 'FAIL|UNREACHABLE' $inventory_log >&/dev/null
108-
if [ $? -eq 0 ]; then
107+
ansible all -vvv $ans_opts -i $host_inventory -m setup -a 'filter=ansible_distribution*' | tee $inventory_log
108+
if [ egrep 'FAIL|UNREACHABLE' $inventory_log > /dev/null ]; then
109109
echo "WARNING Some of the hosts are not accessible via passwordless SSH"
110110
echo " "
111111
echo "This means either the host is unreachable or passwordless SSH is not"
@@ -135,13 +135,17 @@ sed -i.bak "s/.*docker_reset_container_state.*/\"docker_reset_container_state\":
135135
sed -i.bak "s/.*docker_reset_image_state.*/\"docker_reset_image_state\":$reset_images,/g" $env_file
136136
sed -i.bak "s/.*etcd_cleanup_state.*/\"etcd_cleanup_state\":$reset,/g" $env_file
137137

138-
sed -i.bak "s#__CLUSTER_STORE__#$cluster#g" $env_file
139-
140138
if [ "$aci_image" != "" ]; then
141139
sed -i.bak "s#.*aci_gw_image.*#\"aci_gw_image\":\"$aci_image\",#g" "$env_file"
142140
fi
141+
if [ "$uninstall_v2plugin" == "true" ]; then
142+
sed -i.bak "s#.*contiv_v2plugin_install.*#\"contiv_v2plugin_install\":\"True\",#g" "$env_file"
143+
else
144+
sed -i.bak "s#.*contiv_v2plugin_install.*#\"contiv_v2plugin_install\":\"False\",#g" "$env_file"
145+
fi
143146

144147
echo "Uninstalling Contiv"
148+
rm -f $ansible_path/uninstall_plays.yml
145149

146150
# Uninstall contiv & API Proxy
147151
if [ $uninstall_v2plugin == true ]; then
@@ -179,8 +183,11 @@ chmod 666 $inventory_log
179183
chmod 666 $env_file
180184
chmod 666 $log_file
181185

186+
set +x
187+
182188
if [ "$unreachable" = "" ] && [ "$failed" = "" ]; then
183189
echo "Uninstallation is complete"
190+
exit 0
184191
else
185192
echo "Uninstallation failed"
186193
echo "========================================================="

install/ansible/uninstall_swarm.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
3+
set -euo pipefail
4+
25
# This is the uninstall script for Contiv.
36

47
. ./install/ansible/install_defaults.sh
@@ -8,6 +11,7 @@ ans_opts=""
811
ans_user="root"
912
ans_key=$src_conf_path/insecure_private_key
1013
uninstall_scheduler=""
14+
netmaster=""
1115
uninstall_v2plugin=""
1216
reset_params=""
1317

install/k8s/install.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ fi
207207

208208
if [ "$apic_url" != "" ]; then
209209
cat $contiv_aci_gw_template >>$contiv_yaml
210+
# We do not support routing in ACI mode
211+
fwd_mode="bridge"
210212
fi
211213

212214
# We will store the ACI key in a k8s secret.
@@ -221,9 +223,10 @@ fi
221223

222224
$kubectl create secret generic aci.key --from-file=$aci_key -n kube-system
223225

226+
mkdir -p /var/contiv
227+
224228
if [ "$tls_cert" = "" ]; then
225229
echo "Generating local certs for Contiv Proxy"
226-
mkdir -p /var/contiv
227230
mkdir -p ./local_certs
228231

229232
chmod +x ./install/generate-certificate.sh
@@ -274,8 +277,10 @@ for i in {0..30}; do
274277
done
275278
set -e
276279

277-
netctl global set --fwd-mode $fwd_mode
278-
netctl net create -n infra -s $infra_subnet -g $infra_gateway contivh1
280+
if [ "$fwd_mode" == "routing" ]; then
281+
netctl global set --fwd-mode $fwd_mode
282+
netctl net create -n infra -s $infra_subnet -g $infra_gateway contivh1
283+
fi
279284

280285
echo "Installation is complete"
281286
echo "========================================================="

install/k8s/k8s1.6/contiv.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ spec:
137137
tolerations:
138138
- key: node-role.kubernetes.io/master
139139
effect: NoSchedule
140-
nodeSelector:
141-
node-role.kubernetes.io/master: ""
142140
serviceAccountName: contiv-netplugin
143141
containers:
144142
# Runs netplugin container on each Kubernetes node. This

scripts/build.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@ fi
1313
DEV_IMAGE_NAME="devbuild"
1414
VERSION=${BUILD_VERSION-$DEV_IMAGE_NAME}
1515

16-
contiv_version=${CONTIV_VERSION:-"1.0.2"}
17-
16+
contiv_version=${CONTIV_VERSION:-"1.0.3"}
17+
pull_images=${CONTIV_CI_HOST:-"false"}
1818
aci_gw_version=${CONTIV_ACI_GW_VERSION:-"latest"}
1919
ansible_image_version=${CONTIV_ANSIBLE_IMAGE_VERSION:-$contiv_version}
2020
auth_proxy_version=${CONTIV_API_PROXY_VERSION:-$contiv_version}
21-
v2plugin_version=${CONTIV_V2PLUGIN_VERSION:-"1.0.2"}
2221
docker_version=${CONTIV_DOCKER_VERSION:-1.12.6}
2322
etcd_version=${CONTIV_ETCD_VERSION:-v2.3.8}
2423

24+
# the installer currently pulls the v2plugin image directly from Docker Hub, but
25+
# this will change to being downloaded from the Docker Store in the future.
26+
# because of this, the default value for this variable will become the latest
27+
# version that is available in the Docker Store and should be considered
28+
# independent of $contiv_version above.
29+
v2plugin_version=${CONTIV_V2PLUGIN_VERSION:-"1.0.3"}
30+
2531
function usage() {
2632
echo "Usage:"
2733
echo "./release.sh -a <ACI gateway image> -c <contiv version> -e <etcd version> -p <API proxy image version> "
@@ -121,13 +127,13 @@ mkdir -p $binary_cache
121127
tar czf $tmp_output_file -C $release_dir contiv-$VERSION
122128

123129
# Save the auth proxy & aci-gw images for packaging the full docker images with contiv install binaries
124-
if [ "$(docker images -q contiv/auth_proxy:$auth_proxy_version 2>/dev/null)" == "" ]; then
130+
if [[ "$(docker images -q contiv/auth_proxy:$auth_proxy_version 2>/dev/null)" == "" || "$pull_images" == "true" ]]; then
125131
docker pull contiv/auth_proxy:$auth_proxy_version
126132
fi
127133
proxy_image=$(docker images -q contiv/auth_proxy:$auth_proxy_version)
128134
docker save $proxy_image -o $binary_cache/auth-proxy-image.tar
129135

130-
if [ "$(docker images -q contiv/aci-gw:$aci_gw_version 2>/dev/null)" == "" ]; then
136+
if [[ "$(docker images -q contiv/aci-gw:$aci_gw_version 2>/dev/null)" == "" || "$pull_images" == "true" ]]; then
131137
docker pull contiv/aci-gw:$aci_gw_version
132138
fi
133139
aci_image=$(docker images -q contiv/aci-gw:$aci_gw_version)
@@ -139,7 +145,7 @@ curl -sL -o $binary_cache/netplugin-$contiv_version.tar.bz2 https://github.com/c
139145

140146
env_file=$output_dir/install/ansible/env.json
141147
sed -i.bak "s#.*auth_proxy_local_install.*# \"auth_proxy_local_install\": True,#g" $env_file
142-
sed -i.bak "s#.*contiv_network_local_install.*# \"contiv_network_local_install\": True#g" $env_file
148+
sed -i.bak "s#.*contiv_network_local_install.*# \"contiv_network_local_install\": True,#g" $env_file
143149

144150
# Create the full tar bundle
145151
tar czf $tmp_full_output_file -C $release_dir contiv-$VERSION

scripts/get_latest_release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ if [[ "$releases" != *"browser_download_url"* ]]; then
1212
if [[ "$releases" != *"browser_download_url"* ]]; then
1313
exit 1
1414
fi
15-
release=$(echo "$releases" | python -c 'import json, sys;print json.load(sys.stdin)[0]["name"]')
15+
release=$(echo "$releases" | python -c 'import json, sys;print json.load(sys.stdin)[0]["name"]')
1616
else
17-
release=$(echo "$releases" | python -c 'import json, sys;print json.load(sys.stdin)["name"]')
17+
release=$(echo "$releases" | python -c 'import json, sys;print json.load(sys.stdin)["name"]')
1818
fi
1919
echo $release

0 commit comments

Comments
 (0)