blob: c99abe304a49473af8717ed9c5f33e34a7d912bd [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
Andy Bavier802cce52021-07-29 12:15:15 -0700109Get access to encrypted files in aether-pod-configs repository
110--------------------------------------------------------------
111
Andy Bavier718fd902021-07-30 10:10:55 -0700112`git-crypt <https://github.com/AGWA/git-crypt>`_ is used to securely store encrypted files
113in the aether-pod-configs repository. Before proceeding, (1) install git-crypt and `gpg <https://gnupg.org/>`_,
Andy Bavier802cce52021-07-29 12:15:15 -0700114(2) create a GPG keypair, and (3) ask a member of the Aether OPs team add your public key
115to the aether-pod-configs keyring. To create the keypair follow these steps:
116
117.. code-block:: shell
118
119 $ gpg --full-generate-key
120 $ gpg --output <key-name>.gpg --armor --export <your-email-address>
121
Zack Williams794532a2021-03-18 17:38:36 -0700122.. _update_global_resource:
123
124Update global resource maps
125---------------------------
126
Hyunsun Moona703edf2021-07-29 15:55:15 -0700127Download aether-pod-configs repository.
128
129.. code-block:: shell
130
131 $ cd $WORKDIR
132 $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs"
Andy Bavier802cce52021-07-29 12:15:15 -0700133 $ git-crypt unlock
Hyunsun Moona703edf2021-07-29 15:55:15 -0700134
Zack Williams794532a2021-03-18 17:38:36 -0700135Add a new ACE information at the end of the following global resource maps.
136
137* ``user_map.tfvars``
138* ``cluster_map.tfvars``
139* ``vpn_map.tfvars``
140
141As a note, you can find several other global resource maps under the
Hyunsun Moona703edf2021-07-29 15:55:15 -0700142``production`` directory. Resource definitions that need to be shared among
Zack Williams794532a2021-03-18 17:38:36 -0700143clusters or are better managed in a single file to avoid configuration
144conflicts are maintained in this way.
145
146.. code-block:: diff
147
148 $ cd $WORKDIR/aether-pod-configs/production
149 $ vi user_map.tfvars
150
151 # Add the new cluster admin user at the end of the map
152 $ git diff user_map.tfvars
153 --- a/production/user_map.tfvars
154 +++ b/production/user_map.tfvars
155 @@ user_map = {
156 username = "menlo"
157 password = "changeme"
158 global_roles = ["user-base", "catalogs-use"]
159 + },
160 + test_admin = {
161 + username = "test"
162 + password = "changeme"
163 + global_roles = ["user-base", "catalogs-use"]
164 }
165 }
166
167.. code-block:: diff
168
169 $ cd $WORKDIR/aether-pod-configs/production
170 $ vi cluster_map.tfvars
171
172 # Add the new K8S cluster information at the end of the map
173 $ git diff cluster_map.tfvars
174 --- a/production/cluster_map.tfvars
175 +++ b/production/cluster_map.tfvars
176 @@ cluster_map = {
177 kube_dns_cluster_ip = "10.53.128.10"
178 cluster_domain = "prd.menlo.aetherproject.net"
179 calico_ip_detect_method = "can-reach=www.google.com"
180 + },
181 + ace-test = {
182 + cluster_name = "ace-test"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700183 + management_subnets = ["10.32.4.0/24"]
Zack Williams794532a2021-03-18 17:38:36 -0700184 + k8s_version = "v1.18.8-rancher1-1"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700185 + k8s_pod_range = "10.33.0.0/17"
186 + k8s_cluster_ip_range = "10.33.128.0/17"
187 + kube_dns_cluster_ip = "10.33.128.10"
Zack Williams794532a2021-03-18 17:38:36 -0700188 + cluster_domain = "prd.test.aetherproject.net"
189 + calico_ip_detect_method = "can-reach=www.google.com"
190 }
191 }
192 }
193
194.. code-block:: diff
195
196 $ cd $WORKDIR/aether-pod-configs/production
197 $ vi vpn_map.tfvars
198
199 # Add VPN and tunnel information at the end of the map
200 $ git diff vpn_map.tfvars
201 --- a/production/vpn_map.tfvars
202 +++ b/production/vpn_map.tfvars
203 @@ vpn_map = {
204 bgp_peer_ip_address_1 = "169.254.0.6"
205 bgp_peer_ip_range_2 = "169.254.1.5/30"
206 bgp_peer_ip_address_2 = "169.254.1.6"
207 + },
208 + ace-test = {
209 + peer_name = "production-ace-test"
Hyunsun Moona703edf2021-07-29 15:55:15 -0700210 + peer_vpn_gateway_address = "66.201.42.222"
Zack Williams794532a2021-03-18 17:38:36 -0700211 + tunnel_shared_secret = "UMAoZA7blv6gd3IaArDqgK2s0sDB8mlI"
212 + bgp_peer_asn = "65003"
213 + bgp_peer_ip_range_1 = "169.254.0.9/30"
214 + bgp_peer_ip_address_1 = "169.254.0.10"
215 + bgp_peer_ip_range_2 = "169.254.1.9/30"
216 + bgp_peer_ip_address_2 = "169.254.1.10"
217 }
218 }
219
220.. note::
221 Unless you have a specific requirement, set ASN and BGP addresses to the next available values in the map.
222
223
224Create ACE specific configurations
225----------------------------------
226
227In this step, we will create a directory under `production` with the same name
228as ACE, and add several Terraform configurations and Ansible inventory needed
229to configure a VPN connection.
Zack Williams794532a2021-03-18 17:38:36 -0700230Throughout the deployment procedure, this directory will contain all ACE
231specific configurations.
232
233Run the following commands to auto-generate necessary files under the target
234ACE directory.
235
236.. code-block:: shell
237
238 $ cd $WORKDIR/aether-pod-configs/tools
Hyunsun Moona703edf2021-07-29 15:55:15 -0700239 $ cp ace_config.yaml.example ace_config.yaml
240 $ vi ace_config.yaml
241 # Set all values
Zack Williams794532a2021-03-18 17:38:36 -0700242
Zack Williams794532a2021-03-18 17:38:36 -0700243 $ make vpn
244 Created ../production/ace-test
Hyunsun Moon049b5052021-07-30 12:41:03 -0700245 Created ../production/ace-test/provider.tf
246 Created ../production/ace-test/cluster.tf
Zack Williams794532a2021-03-18 17:38:36 -0700247 Created ../production/ace-test/gcp_ha_vpn.tf
Hyunsun Moon049b5052021-07-30 12:41:03 -0700248 Created ../production/ace-test/gcp_fw.tf
Zack Williams794532a2021-03-18 17:38:36 -0700249 Created ../production/ace-test/backend.tf
250 Created ../production/ace-test/cluster_val.tfvars
Hyunsun Moon049b5052021-07-30 12:41:03 -0700251 Created ../production/ace-test/ansible
Zack Williams794532a2021-03-18 17:38:36 -0700252 Created ../production/ace-test/ansible/hosts.ini
253 Created ../production/ace-test/ansible/extra_vars.yml
254
Zack Williams794532a2021-03-18 17:38:36 -0700255
Hyunsun Moon2b2bf9a2021-08-01 05:29:48 -0700256Submit your change
Hyunsun Moona703edf2021-07-29 15:55:15 -0700257------------------
Zack Williams794532a2021-03-18 17:38:36 -0700258
259.. code-block:: shell
260
261 $ cd $WORKDIR/aether-pod-configs/production
262 $ git status
263 On branch tools
264 Changes not staged for commit:
265
266 modified: cluster_map.tfvars
267 modified: user_map.tfvars
268 modified: vpn_map.tfvars
269
270 Untracked files:
271 (use "git add <file>..." to include in what will be committed)
272
273 ace-test/
274
275 $ git add .
276 $ git commit -m "Add test ACE"
277 $ git review
278
279Once the review request is accepted and merged,
Hyunsun Moona703edf2021-07-29 15:55:15 -0700280the post-merge job will create VPN tunnels on both GCP and the management node.
Zack Williams794532a2021-03-18 17:38:36 -0700281
282Verify VPN connection
283---------------------
284
285You can verify the VPN connections after successful post-merge job by checking
286the routing table on the management node and trying to ping to one of the
287central cluster VMs.
288
289Make sure two tunnel interfaces, `gcp_tunnel1` and `gcp_tunnel2`, exist
290and three additional routing entries via one of the tunnel interfaces.
291
292.. code-block:: shell
293
294 # Verify routings
295 $ netstat -rn
296 Kernel IP routing table
297 Destination Gateway Genmask Flags MSS Window irtt Iface
Hyunsun Moona703edf2021-07-29 15:55:15 -0700298 0.0.0.0 66.201.42.209 0.0.0.0 UG 0 0 0 eno1
299 10.32.4.0 0.0.0.0 255.255.255.128 U 0 0 0 eno2
300 10.32.4.128 0.0.0.0 255.255.255.128 U 0 0 0 mgmt800
Zack Williams794532a2021-03-18 17:38:36 -0700301 10.45.128.0 169.254.0.9 255.255.128.0 UG 0 0 0 gcp_tunnel1
302 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 -0700303 10.33.128.0 10.32.4.138 255.255.128.0 UG 0 0 0 mgmt800
Zack Williams794532a2021-03-18 17:38:36 -0700304 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 -0700305 66.201.42.208 0.0.0.0 255.255.252.0 U 0 0 0 eno1
Zack Williams794532a2021-03-18 17:38:36 -0700306 169.254.0.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel1
307 169.254.1.8 0.0.0.0 255.255.255.252 U 0 0 0 gcp_tunnel2
308
309 # Verify ACC VM access
310 $ ping 10.168.0.6
311
Hyunsun Moona703edf2021-07-29 15:55:15 -0700312 # Verify ACC K8S Service access
Zack Williams794532a2021-03-18 17:38:36 -0700313 $ nslookup kube-dns.kube-system.svc.prd.acc.gcp.aetherproject.net 10.52.128.10
314
315You can further verify whether the ACE routes are propagated well to GCP
316by checking GCP dashboard **VPC Network > Routes > Dynamic**.
317
318
319Post VPN setup
320--------------
321
322Once you verify the VPN connections, please update `ansible` directory name to
323`_ansible` to prevent the ansible playbook from running again. Note that it is
324no harm to re-run the ansible playbook but not recommended.
325
326.. code-block:: shell
327
328 $ cd $WORKDIR/aether-pod-configs/production/$ACE_NAME
329 $ mv ansible _ansible
330 $ git add .
Hyunsun Moona703edf2021-07-29 15:55:15 -0700331 $ git commit -m "Ansible done for test ACE"
Zack Williams794532a2021-03-18 17:38:36 -0700332 $ git review
333
334.. _add_ace_to_vpn:
335
336Add another ACE to an existing VPN connection
337"""""""""""""""""""""""""""""""""""""""""""""
338
339VPN connections can be shared when there are multiple ACE clusters in a site.
340In order to add ACE to an existing VPN connection, you'll have to SSH into the
341management node and manually update BIRD configuration.
342
343.. note::
344
345 This step needs improvements in the future.
346
347.. code-block:: shell
348
349 $ sudo vi /etc/bird/bird.conf
350 protocol static {
Hyunsun Moona703edf2021-07-29 15:55:15 -0700351 # Routings for the existing cluster
Zack Williams794532a2021-03-18 17:38:36 -0700352 ...
Hyunsun Moona703edf2021-07-29 15:55:15 -0700353 route 10.33.128.0/17 via 10.32.4.138;
Zack Williams794532a2021-03-18 17:38:36 -0700354
355 # Add routings for the new ACE's K8S cluster IP range via cluster nodes
356 # TODO: Configure iBGP peering with Calico nodes and dynamically learn these routings
357 route <NEW-ACE-CLUSTER-IP> via <SERVER1>
358 route <NEW-ACE-CLUSTER-IP> via <SERVER2>
359 route <NEW-ACE-CLUSTER-IP> via <SERVER3>
360 }
361
362 filter gcp_tunnel_out {
363 # 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 -0700364 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 -0700365 else reject;
366 }
367 # Save and exit
368
369 $ sudo birdc configure
370
371 # Confirm the static routes are added
372 $ sudo birdc show route
373