Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 593ae03

Browse files
author
Abhinav Dahiya
committed
update hack scripts to use CALICO_NETWORK_POLICY env variable
Signed-off-by: Abhinav Dahiya <[email protected]>
1 parent a9c634e commit 593ae03

File tree

6 files changed

+38
-4
lines changed

6 files changed

+38
-4
lines changed

hack/multi-node/bootkube-up

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ else
1818
etcd_render_flags="--etcd-servers=https://172.17.4.51:2379"
1919
fi
2020

21+
CALICO_NETWORK_POLICY=${CALICO_NETWORK_POLICY:-false}
22+
if [ ${CALICO_NETWORK_POLICY} = "true" ]; then
23+
echo "WARNING: THIS IS EXPERIMENTAL SUPPORT FOR NETWORK POLICY"
24+
cnp_render_flags="--experimental-calico-network-policy"
25+
else
26+
cnp_render_flags=""
27+
fi
28+
2129
# Render assets
2230
if [ ! -d "cluster" ]; then
23-
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.101:443 ${etcd_render_flags} --experimental-calico-network-policy
31+
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.101:443 ${etcd_render_flags} ${cnp_render_flags}
2432
cp user-data.sample cluster/user-data-worker
2533
cp user-data.sample cluster/user-data-controller
2634
sed -i.bak -e '/node-role.kubernetes.io\/master/d' cluster/user-data-worker

hack/quickstart/init-master.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CLUSTER_DIR=${CLUSTER_DIR:-cluster}
88
IDENT=${IDENT:-${HOME}/.ssh/id_rsa}
99
SSH_OPTS=${SSH_OPTS:-}
1010
SELF_HOST_ETCD=${SELF_HOST_ETCD:-false}
11+
CALICO_NETWORK_POLICY=${CALICO_NETWORK_POLICY:-false}
1112
CLOUD_PROVIDER=${CLOUD_PROVIDER:-}
1213

1314
function usage() {
@@ -56,8 +57,15 @@ function init_master_node() {
5657
etcd_render_flags="--etcd-servers=https://${COREOS_PRIVATE_IPV4}:2379"
5758
fi
5859

60+
if [ "$CALICO_NETWORK_POLICY" = true ]; then
61+
echo "WARNING: THIS IS EXPERIMENTAL SUPPORT FOR NETWORK POLICY"
62+
cnp_render_flags="--experimental-calico-network-policy"
63+
else
64+
cnp_render_flags=""
65+
fi
66+
5967
# Render cluster assets
60-
/home/${REMOTE_USER}/bootkube render --asset-dir=/home/${REMOTE_USER}/assets ${etcd_render_flags} --experimental-calico-network-policy \
68+
/home/${REMOTE_USER}/bootkube render --asset-dir=/home/${REMOTE_USER}/assets ${etcd_render_flags} ${cnp_render_flags} \
6169
--api-servers=https://${COREOS_PUBLIC_IPV4}:443,https://${COREOS_PRIVATE_IPV4}:443
6270

6371
# Move the local kubeconfig into expected location
@@ -101,7 +109,7 @@ if [ "${REMOTE_HOST}" != "local" ]; then
101109

102110
# Copy self to remote host so script can be executed in "local" mode
103111
scp -i ${IDENT} -P ${REMOTE_PORT} ${SSH_OPTS} ${BASH_SOURCE[0]} ${REMOTE_USER}@${REMOTE_HOST}:/home/${REMOTE_USER}/init-master.sh
104-
ssh -i ${IDENT} -p ${REMOTE_PORT} ${SSH_OPTS} ${REMOTE_USER}@${REMOTE_HOST} "sudo REMOTE_USER=${REMOTE_USER} CLOUD_PROVIDER=${CLOUD_PROVIDER} SELF_HOST_ETCD=${SELF_HOST_ETCD} /home/${REMOTE_USER}/init-master.sh local"
112+
ssh -i ${IDENT} -p ${REMOTE_PORT} ${SSH_OPTS} ${REMOTE_USER}@${REMOTE_HOST} "sudo REMOTE_USER=${REMOTE_USER} CLOUD_PROVIDER=${CLOUD_PROVIDER} SELF_HOST_ETCD=${SELF_HOST_ETCD} CALICO_NETWORK_POLICY=${CALICO_NETWORK_POLICY} /home/${REMOTE_USER}/init-master.sh local"
105113

106114
# Copy assets from remote host to a local directory. These can be used to launch additional nodes & contain TLS assets
107115
mkdir ${CLUSTER_DIR}

hack/single-node/bootkube-up

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,17 @@ else
1717
etcd_render_flags=""
1818
fi
1919

20+
CALICO_NETWORK_POLICY=${CALICO_NETWORK_POLICY:-false}
21+
if [ ${CALICO_NETWORK_POLICY} = "true" ]; then
22+
echo "WARNING: THIS IS EXPERIMENTAL SUPPORT FOR NETWORK POLICY"
23+
cnp_render_flags="--experimental-calico-network-policy"
24+
else
25+
cnp_render_flags=""
26+
fi
27+
2028
# Render assets
2129
if [ ! -d "cluster" ]; then
22-
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.100:443 ${etcd_render_flags} --experimental-calico-network-policy
30+
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.100:443 ${etcd_render_flags} ${cnp_render_flags}
2331
cp user-data.sample cluster/user-data
2432
if [ ${SELF_HOST_ETCD} = "false" ]; then
2533
cat user-data-etcd.sample >> cluster/user-data

hack/terraform-quickstart/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ output "master_ips" {
1313
output "self_host_etcd" {
1414
value = "${var.self_host_etcd}"
1515
}
16+
17+
output "calico_network_policy" {
18+
value = "${var.calico_network_policy}"
19+
}

hack/terraform-quickstart/start-cluster.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export BOOTSTRAP_IP=`terraform output bootstrap_node_ip`
55
export WORKER_IPS=`terraform output -json worker_ips | jq -r '.value[]'`
66
export MASTER_IPS=`terraform output -json master_ips | jq -r '.value[]'`
77
export SELF_HOST_ETCD=`terraform output self_host_etcd`
8+
export CALICO_NETWORK_POLICY=`terraform output calico_network_policy`
89
export SSH_OPTS=${SSH_OPTS:-}" -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
910
export CLOUD_PROVIDER=${CLOUD_PROVIDER:-aws}
1011

hack/terraform-quickstart/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ variable "self_host_etcd" {
2727
default = "true"
2828
}
2929

30+
variable "calico_network_policy" {
31+
type = "string"
32+
default = "true"
33+
}
34+
3035
variable "num_workers" {
3136
description = "number of worker nodes"
3237
type = "string"

0 commit comments

Comments
 (0)