blob: 08041d9d1edf552aab70a4590f22e143a24d381b [file] [log] [blame]
Zack Williams794532a2021-03-18 17:38:36 -07001..
2 SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
3 SPDX-License-Identifier: Apache-2.0
4
5VPN Bootstrap
6=============
7
Hyunsun Moona703edf2021-07-29 15:55:15 -07008This section guides you through setting up a VPN connection between Aether Central in GCP and ACE.
Hyunsun Moon049b5052021-07-30 12:41:03 -07009We will be using GitOps based Aether CI/CD system for this and what you need to do is
10create a patch to Aether GitOps repository, **aether-pod-configs**, with the edge specific information.
Hyunsun Moona703edf2021-07-29 15:55:15 -070011Note that some of the steps described here are not directly related to setting up a VPN,
Zack Williams794532a2021-03-18 17:38:36 -070012but rather are a prerequisite for adding a new ACE.
13
Hyunsun Moon049b5052021-07-30 12:41:03 -070014.. _add_deployment_jobs:
15
Hyunsun Moona703edf2021-07-29 15:55:15 -070016Add deployment jobs
17-------------------
Hyunsun Moon049b5052021-07-30 12:41:03 -070018First, you need to add Jenkins to the CI/CD system that build and apply infrastructure change
19plans for the new edge. This can be done by creating a patch to **aether-ci-management** repository.
Zack Williams794532a2021-03-18 17:38:36 -070020
Hyunsun Moona703edf2021-07-29 15:55:15 -070021Download **aether-ci-management** repository.
Zack Williams794532a2021-03-18 17:38:36 -070022
Hyunsun Moona703edf2021-07-29 15:55:15 -070023.. code-block:: shell
24
25 $ cd $WORKDIR
26 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management"
27
28Add the jobs for the new cluster at the end of the `cd-pipeline-terraform-ace` project job list.
29Make sure to add both pre-merge and post-merge jobs.
30Note that the cluster name specified here will be used in the rest of the deployment procedure.
31
32.. code-block:: diff
33
34 $ cd $WORKDIR/aether-ci-management
35 $ vi jjb/repos/cd-pipeline-terraform.yaml
36
37 # Add jobs for the new cluster
38 diff jjb/repos/cd-pipeline-terraform.yamll
39 --- a/jjb/repos/cd-pipeline-terraform.yaml
40 +++ b/jjb/repos/cd-pipeline-terraform.yaml
41 @@ -227,3 +227,9 @@
42 - 'cd-pipeline-terraform-postmerge-cluster':
43 pod: 'production'
44 cluster: 'ace-eks'
45 + - 'cd-pipeline-terraform-premerge-cluster':
46 + pod: 'production'
47 + cluster: 'ace-test'
48 + - 'cd-pipeline-terraform-postmerge-cluster':
49 + pod: 'production'
50 + cluster: 'ace-test'
51
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -070052Submit your change and wait for the jobs you just added available in Aether Jenkins.
Hyunsun Moona703edf2021-07-29 15:55:15 -070053
54.. code-block:: shell
55
56 $ git status
57 Changes not staged for commit:
58
59 modified: jjb/repos/cd-pipeline-terraform.yaml
60
61 $ git add .
62 $ git commit -m "Add test ACE deployment job"
63 $ git review
64
65Gather VPN information
66----------------------
Zack Williams794532a2021-03-18 17:38:36 -070067
68* Make sure firewall in front of ACE allows UDP port 500, UDP port 4500, and
69 ESP packets from **gcpvpn1.infra.aetherproject.net(35.242.47.15)** and
70 **gcpvpn2.infra.aetherproject.net(34.104.68.78)**
71
72* Make sure that the external IP on ACE side is owned by or routed to the
73 management node
74
75To help your understanding, the following sample ACE environment will be used
76in the rest of this section. Make sure to replace the sample values when you
77actually create a review request.
78
79+-----------------------------+----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070080| Management node external IP | 66.201.42.222 |
Zack Williams794532a2021-03-18 17:38:36 -070081+-----------------------------+----------------------------------+
82| ASN | 65003 |
83+-----------------------------+----------------------------------+
84| GCP BGP IP address | Tunnel 1: 169.254.0.9/30 |
85| +----------------------------------+
86| | Tunnel 2: 169.254.1.9/30 |
87+-----------------------------+----------------------------------+
88| ACE BGP IP address | Tunnel 1: 169.254.0.10/30 |
89| +----------------------------------+
90| | Tunnel 2: 169.254.1.10/30 |
91+-----------------------------+----------------------------------+
92| PSK | UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI |
93+-----------------------------+----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070094| Management Subnet | 10.32.4.0/24 |
Zack Williams794532a2021-03-18 17:38:36 -070095+-----------------------------+----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070096| K8S Subnet | Pod IP: 10.33.0.0/17 |
Zack Williams794532a2021-03-18 17:38:36 -070097| +----------------------------------+
Hyunsun Moona703edf2021-07-29 15:55:15 -070098| | Cluster IP: 10.33.128.0/17 |
Zack Williams794532a2021-03-18 17:38:36 -070099+-----------------------------+----------------------------------+
100
Hyunsun Moona703edf2021-07-29 15:55:15 -0700101.. note::
102 Use `this site <https://cloud.google.com/network-connectivity/docs/vpn/how-to/generating-pre-shared-key/>`_ to generate a new strong pre-shared key.
Zack Williams794532a2021-03-18 17:38:36 -0700103
Hyunsun Moona703edf2021-07-29 15:55:15 -0700104.. attention::
Zack Williams794532a2021-03-18 17:38:36 -0700105
Hyunsun Moona703edf2021-07-29 15:55:15 -0700106 If you are adding another ACE to an existing VPN connection, go to
107 :ref:`Add ACE to an existing VPN connection <add_ace_to_vpn>`
Zack Williams794532a2021-03-18 17:38:36 -0700108
109.. _update_global_resource:
110
111Update global resource maps
112---------------------------
113
Hyunsun Moona703edf2021-07-29 15:55:15 -0700114Download aether-pod-configs repository.
115
116.. code-block:: shell
117
118 $ cd $WORKDIR
119 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs"
120
Zack Williams794532a2021-03-18 17:38:36 -0700121Add a new ACE information at the end of the following global resource maps.
122
123* ``user_map.tfvars``
124* ``cluster_map.tfvars``
125* ``vpn_map.tfvars``
126
127As a note, you can find several other global resource maps under the
Hyunsun Moona703edf2021-07-29 15:55:15 -0700128``production`` directory. Resource definitions that need to be shared among
Zack Williams794532a2021-03-18 17:38:36 -0700129clusters or are better managed in a single file to avoid configuration
130conflicts are maintained in this way.
131
132.. code-block:: diff
133
134 $ cd $WORKDIR/aether-pod-configs/production
135 $ vi user_map.tfvars
136
137 # Add the new cluster admin user at the end of the map
138 $ git diff user_map.tfvars
139 --- a/production/user_map.tfvars
140 +++ b/production/user_map.tfvars
141 @@ user_map = {
142 username = "menlo"
143 password = "changeme"
144 global_roles = ["user-base", "catalogs-use"]
145 + },
146 + test_admin = {
147 + username = "test"
148 + password = "changeme"
149 + global_roles = ["user-base", "catalogs-use"]
150 }
151 }
152
153.. code-block:: diff
154
155 $ cd $WORKDIR/aether-pod-configs/production
156 $ vi cluster_map.tfvars
157
158 # Add the new K8S cluster information at the end of the map
159 $ git diff cluster_map.tfvars
160 --- a/production/cluster_map.tfvars
161 +++ b/production/cluster_map.tfvars
162 @@ cluster_map = {
163 kube_dns_cluster_ip = "10.53.128.10"
164 cluster_domain = "prd.menlo.aetherproject.net"
165 calico_ip_detect_method = "can-reach=www.google.com"
166 + },
167 + ace-test = {
168 + cluster_name = "ace-test"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700169 + management_subnets = ["10.32.4.0/24"]
Zack Williams794532a2021-03-18 17:38:36 -0700170 + k8s_version = "v1.18.8-rancher1-1"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700171 + k8s_pod_range = "10.33.0.0/17"
172 + k8s_cluster_ip_range = "10.33.128.0/17"
173 + kube_dns_cluster_ip = "10.33.128.10"
Zack Williams794532a2021-03-18 17:38:36 -0700174 + cluster_domain = "prd.test.aetherproject.net"
175 + calico_ip_detect_method = "can-reach=www.google.com"
176 }
177 }
178 }
179
180.. code-block:: diff
181
182 $ cd $WORKDIR/aether-pod-configs/production
183 $ vi vpn_map.tfvars
184
185 # Add VPN and tunnel information at the end of the map
186 $ git diff vpn_map.tfvars
187 --- a/production/vpn_map.tfvars
188 +++ b/production/vpn_map.tfvars
189 @@ vpn_map = {
190 bgp_peer_ip_address_1 = "169.254.0.6"
191 bgp_peer_ip_range_2 = "169.254.1.5/30"
192 bgp_peer_ip_address_2 = "169.254.1.6"
193 + },
194 + ace-test = {
195 + peer_name = "production-ace-test"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700196 + peer_vpn_gateway_address = "66.201.42.222"
Zack Williams794532a2021-03-18 17:38:36 -0700197 + tunnel_shared_secret = "UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI"
198 + bgp_peer_asn = "65003"
199 + bgp_peer_ip_range_1 = "169.254.0.9/30"
200 + bgp_peer_ip_address_1 = "169.254.0.10"
201 + bgp_peer_ip_range_2 = "169.254.1.9/30"
202 + bgp_peer_ip_address_2 = "169.254.1.10"
203 }
204 }
205
206.. note::
207 Unless you have a specific requirement, set ASN and BGP addresses to the next available values in the map.
208
209
210Create ACE specific configurations
211----------------------------------
212
213In this step, we will create a directory under `production` with the same name
214as ACE, and add several Terraform configurations and Ansible inventory needed
215to configure a VPN connection.
Zack Williams794532a2021-03-18 17:38:36 -0700216Throughout the deployment procedure, this directory will contain all ACE
217specific configurations.
218
219Run the following commands to auto-generate necessary files under the target
220ACE directory.
221
222.. code-block:: shell
223
224 $ cd $WORKDIR/aether-pod-configs/tools
Hyunsun Moona703edf2021-07-29 15:55:15 -0700225 $ cp ace_config.yaml.example ace_config.yaml
226 $ vi ace_config.yaml
227 # Set all values
Zack Williams794532a2021-03-18 17:38:36 -0700228
Zack Williams794532a2021-03-18 17:38:36 -0700229 $ make vpn
230 Created ../production/ace-test
Hyunsun Moon049b5052021-07-30 12:41:03 -0700231 Created ../production/ace-test/provider.tf
232 Created ../production/ace-test/cluster.tf
Zack Williams794532a2021-03-18 17:38:36 -0700233 Created ../production/ace-test/gcp_ha_vpn.tf
Hyunsun Moon049b5052021-07-30 12:41:03 -0700234 Created ../production/ace-test/gcp_fw.tf
Zack Williams794532a2021-03-18 17:38:36 -0700235 Created ../production/ace-test/backend.tf
236 Created ../production/ace-test/cluster_val.tfvars
Hyunsun Moon049b5052021-07-30 12:41:03 -0700237 Created ../production/ace-test/ansible
Zack Williams794532a2021-03-18 17:38:36 -0700238 Created ../production/ace-test/ansible/hosts.ini
239 Created ../production/ace-test/ansible/extra_vars.yml
240
Zack Williams794532a2021-03-18 17:38:36 -0700241
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700242Submit your change
Hyunsun Moona703edf2021-07-29 15:55:15 -0700243------------------
Zack Williams794532a2021-03-18 17:38:36 -0700244
245.. code-block:: shell
246
247 $ cd $WORKDIR/aether-pod-configs/production
248 $ git status
249 On branch tools
250 Changes not staged for commit:
251
252 modified: cluster_map.tfvars
253 modified: user_map.tfvars
254 modified: vpn_map.tfvars
255
256 Untracked files:
257 (use "git add <file>..." to include in what will be committed)
258
259 ace-test/
260
261 $ git add .
262 $ git commit -m "Add test ACE"
263 $ git review
264
265Once the review request is accepted and merged,
Hyunsun Moona703edf2021-07-29 15:55:15 -0700266the post-merge job will create VPN tunnels on both GCP and the management node.
Zack Williams794532a2021-03-18 17:38:36 -0700267
268Verify VPN connection
269---------------------
270
271You can verify the VPN connections after successful post-merge job by checking
272the routing table on the management node and trying to ping to one of the
273central cluster VMs.
274
275Make sure two tunnel interfaces, `gcp_tunnel1` and `gcp_tunnel2`, exist
276and three additional routing entries via one of the tunnel interfaces.
277
278.. code-block:: shell
279
280 # Verify routings
281 $ netstat -rn
282 Kernel IP routing table
283 Destination Gateway Genmask Flags MSS Window irtt Iface
Hyunsun Moona703edf2021-07-29 15:55:15 -0700284 0.0.0.0 66.201.42.209 0.0.0.0 UG 0 0 0 eno1
285 10.32.4.0 0.0.0.0 255.255.255.128 U 0 0 0 eno2
286 10.32.4.128 0.0.0.0 255.255.255.128 U 0 0 0 mgmt800
Zack Williams794532a2021-03-18 17:38:36 -0700287 10.45.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
288 10.52.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
Hyunsun Moona703edf2021-07-29 15:55:15 -0700289 10.33.128.0 10.32.4.138 255.255.128.0 UG 0 0 0 mgmt800
Zack Williams794532a2021-03-18 17:38:36 -0700290 10.168.0.0 169.254.0.9 255.255.240.0 UG 0 0 0 gcp_tunnel1
Hyunsun Moona703edf2021-07-29 15:55:15 -0700291 66.201.42.208 0.0.0.0 255.255.252.0 U 0 0 0 eno1
Zack Williams794532a2021-03-18 17:38:36 -0700292 169.254.0.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel1
293 169.254.1.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel2
294
295 # Verify ACC VM access
296 $ ping 10.168.0.6
297
Hyunsun Moona703edf2021-07-29 15:55:15 -0700298 # Verify ACC K8S Service access
Zack Williams794532a2021-03-18 17:38:36 -0700299 $ nslookup kube-dns.kube-system.svc.prd.acc.gcp.aetherproject.net 10.52.128.10
300
301You can further verify whether the ACE routes are propagated well to GCP
302by checking GCP dashboard **VPC Network > Routes > Dynamic**.
303
304
305Post VPN setup
306--------------
307
308Once you verify the VPN connections, please update `ansible` directory name to
309`_ansible` to prevent the ansible playbook from running again. Note that it is
310no harm to re-run the ansible playbook but not recommended.
311
312.. code-block:: shell
313
314 $ cd $WORKDIR/aether-pod-configs/production/$ACE_NAME
315 $ mv ansible _ansible
316 $ git add .
Hyunsun Moona703edf2021-07-29 15:55:15 -0700317 $ git commit -m "Ansible done for test ACE"
Zack Williams794532a2021-03-18 17:38:36 -0700318 $ git review
319
320.. _add_ace_to_vpn:
321
322Add another ACE to an existing VPN connection
323"""""""""""""""""""""""""""""""""""""""""""""
324
325VPN connections can be shared when there are multiple ACE clusters in a site.
326In order to add ACE to an existing VPN connection, you'll have to SSH into the
327management node and manually update BIRD configuration.
328
329.. note::
330
331 This step needs improvements in the future.
332
333.. code-block:: shell
334
335 $ sudo vi /etc/bird/bird.conf
336 protocol static {
Hyunsun Moona703edf2021-07-29 15:55:15 -0700337 # Routings for the existing cluster
Zack Williams794532a2021-03-18 17:38:36 -0700338 ...
Hyunsun Moona703edf2021-07-29 15:55:15 -0700339 route 10.33.128.0/17 via 10.32.4.138;
Zack Williams794532a2021-03-18 17:38:36 -0700340
341 # Add routings for the new ACE's K8S cluster IP range via cluster nodes
342 # TODO: Configure iBGP peering with Calico nodes and dynamically learn these routings
343 route <NEW-ACE-CLUSTER-IP> via <SERVER1>
344 route <NEW-ACE-CLUSTER-IP> via <SERVER2>
345 route <NEW-ACE-CLUSTER-IP> via <SERVER3>
346 }
347
348 filter gcp_tunnel_out {
349 # Add the new ACE's K8S cluster IP range and the management subnet if required to the list
Hyunsun Moona703edf2021-07-29 15:55:15 -0700350 if (net ~ [ 10.32.4.0/24, 10.33.128.0/17, <NEW-ACE-CLUSTER-MGMT-SUBNET>, <NEW-ACE-CLUSTER-IP-RANGE> ]) then accept;
Zack Williams794532a2021-03-18 17:38:36 -0700351 else reject;
352 }
353 # Save and exit
354
355 $ sudo birdc configure
356
357 # Confirm the static routes are added
358 $ sudo birdc show route
359