Hyunsun Moon | d1e8733 | 2022-02-18 15:07:20 -0800 | [diff] [blame] | 1 | .. |
| 2 | SPDX-FileCopyrightText: © 2022 Open Networking Foundation <support@opennetworking.org> |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | Site Removal |
| 6 | ============ |
| 7 | |
| 8 | This section describes how to remove an existing Aether Edge site. |
| 9 | |
| 10 | Remove cluster and GCP resources |
| 11 | -------------------------------- |
| 12 | |
| 13 | Clone ``aether-pod-configs`` repository. |
| 14 | |
| 15 | .. code-block:: shell |
| 16 | |
| 17 | $ cd $WORKDIR |
| 18 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-pod-configs" |
| 19 | |
| 20 | Move the directory to the site you want to delete, ``ace-test`` in this example, |
| 21 | and remove all files under the directory except for the following three: |
| 22 | |
| 23 | * `backend.tf` |
| 24 | * `cluster_val.tf` |
| 25 | * `provider.tf` |
| 26 | |
| 27 | .. code-block:: shell |
| 28 | |
| 29 | $ cd $WORKDIR/aether-pod-configs/production/ace-test |
| 30 | $ rm <files> |
| 31 | $ ls |
| 32 | backend.tf cluster_val.tfvars provider.tf |
| 33 | $ cd ../ |
| 34 | |
| 35 | Next, in the parent directory edit ``cluster_map.tfvars`` and |
| 36 | ``vpn_map.tfvars`` to remove the configurations related to the site. |
| 37 | |
| 38 | .. code-block:: diff |
| 39 | |
| 40 | $ git diff cluster_map.tfvars |
| 41 | diff --git a/production/cluster_map.tfvars b/production/cluster_map.tfvars |
| 42 | --- a/production/cluster_map.tfvars |
| 43 | +++ b/production/cluster_map.tfvars |
| 44 | @@ -43,16 +43,6 @@ cluster_map = { |
| 45 | cluster_domain = "prd.tucson.aetherproject.net" |
| 46 | calico_ip_detect_method = "can-reach=www.google.com" |
| 47 | }, |
| 48 | - ace-test = { |
| 49 | - cluster_name = "ace-test" |
| 50 | - management_subnets = ["10.32.4.0/24"] |
| 51 | - k8s_version = "v1.18.8-rancher1-1" |
| 52 | - k8s_pod_range = "10.33.0.0/17" |
| 53 | - k8s_cluster_ip_range = "10.33.128.0/17" |
| 54 | - kube_dns_cluster_ip = "10.33.128.10" |
| 55 | - cluster_domain = "prd.test.aetherproject.net" |
| 56 | - calico_ip_detect_method = "can-reach=www.google.com" |
| 57 | - }, |
| 58 | ace-stanford1 = { |
| 59 | cluster_name = "ace-stanford1" |
| 60 | |
| 61 | $ git diff vpn_map.tfvars |
| 62 | diff --git a/production/vpn_map.tfvars b/production/vpn_map.tfvars |
| 63 | --- a/production/vpn_map.tfvars |
| 64 | +++ b/production/vpn_map.tfvars |
| 65 | @@ -16,16 +16,6 @@ vpn_map = { |
| 66 | bgp_peer_ip_range_2 = "169.254.1.1/30" |
| 67 | bgp_peer_ip_address_2 = "169.254.1.2" |
| 68 | }, |
| 69 | - ace-test = { |
| 70 | - peer_name = "production-ace-test" |
| 71 | - peer_vpn_gateway_address = "66.201.42.222" |
| 72 | - tunnel_shared_secret = "<Secret text here>" |
| 73 | - bgp_peer_asn = "65003" |
| 74 | - bgp_peer_ip_range_1 = "169.254.0.9/30" |
| 75 | - bgp_peer_ip_address_1 = "169.254.0.10" |
| 76 | - bgp_peer_ip_range_2 = "169.254.1.9/30" |
| 77 | - bgp_peer_ip_address_2 = "169.254.1.10" |
| 78 | - }, |
| 79 | ace-stanford1 = { |
| 80 | peer_name = "production-ace-stanford1" |
| 81 | peer_vpn_gateway_address = "171.64.74.233" |
| 82 | |
| 83 | Create a review request with the above changes. |
| 84 | |
| 85 | .. code-block:: shell |
| 86 | |
| 87 | $ git status |
| 88 | Changes not staged for commit: |
| 89 | |
| 90 | deleted: ace-test/_ansible/extra_vars.yml |
| 91 | deleted: ace-test/ansible/hosts.ini |
| 92 | deleted: ace-test/ddon-manifests.yml.tpl |
| 93 | deleted: ace-test/luster.tf |
| 94 | deleted: ace-test/cp_classic_vpn.tf |
| 95 | deleted: ace-test/cp_fw.tf |
| 96 | deleted: ace-test/ember.tf |
| 97 | deleted: ace-test/roject.tf |
| 98 | deleted: ace-test/ke-bare-metal.tf |
| 99 | modified: cluster_map.tfvars |
| 100 | modified: vpn_map.tfvars |
| 101 | |
| 102 | $ git add . |
| 103 | $ git commit -m "Remove test ACE runtime and VPN configs" |
| 104 | $ git review |
| 105 | |
| 106 | Once your review request is accepted and merged, Aether CI/CD system starts to |
| 107 | destroy K8S cluster in Rancher and VPN, router, and FW resources in GCP. |
| 108 | |
| 109 | .. attention:: |
| 110 | |
| 111 | Destroying K8S cluster does not clean up the nodes. |
| 112 | |
| 113 | Delete deployment jobs |
| 114 | ---------------------- |
| 115 | |
| 116 | Clone ``aether-ci-management`` repository. |
| 117 | |
| 118 | .. code-block:: shell |
| 119 | |
| 120 | $ cd $WORKDIR |
| 121 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management" |
| 122 | |
| 123 | Edit ``cd-pipeline-terraform.yaml`` and delete both pre-merge and post-merge jobs. |
| 124 | |
| 125 | .. code-block:: diff |
| 126 | |
| 127 | $ cd $WORKDIR/aether-ci-management |
| 128 | $ vi jjb/repos/cd-pipeline-terraform.yaml |
| 129 | |
| 130 | diff --git a/jjb/repos/cd-pipeline-terraform.yaml b/jjb/repos/cd-pipeline-terraform.yaml |
| 131 | --- a/jjb/repos/cd-pipeline-terraform.yaml |
| 132 | +++ b/jjb/repos/cd-pipeline-terraform.yaml |
| 133 | @@ -206,10 +206,6 @@ |
| 134 | cluster: 'ace-tucson' |
| 135 | - - 'cd-pipeline-terraform-premerge-cluster': |
| 136 | - cluster: 'ace-test' |
| 137 | - - 'cd-pipeline-terraform-postmerge-cluster': |
| 138 | - cluster: 'ace-test' |
| 139 | - 'cd-pipeline-terraform-premerge-cluster': |
| 140 | cluster: 'ace-stanford1' |
| 141 | |
| 142 | Submit your change and wait for the post-merge job completes. |
| 143 | |
| 144 | .. code-block:: shell |
| 145 | |
| 146 | $ git add . |
| 147 | $ git commit -m "Remove test ACE deployment jobs" |
| 148 | $ git review |
| 149 | |
| 150 | Delete site directory |
| 151 | --------------------- |
| 152 | |
| 153 | Finally, delete the remaining site directory from ``aether-pod-configs``. |
| 154 | |
| 155 | .. code-block:: shell |
| 156 | |
| 157 | $ cd $WORKDIR/aether-pod-configs/production |
| 158 | $ rm -rf ace-test |
| 159 | |
| 160 | Create a review request. |
| 161 | |
| 162 | .. code-block:: shell |
| 163 | |
| 164 | $ git status |
| 165 | Changes not staged for commit: |
| 166 | |
| 167 | deleted: ace-test/backend.tf |
| 168 | deleted: ace-test/cluster_val.tf |
| 169 | deleted: ace-test/provider.tf |
| 170 | |
| 171 | $ git add . |
| 172 | $ git commit -m "Clean up test ACE configs" |
| 173 | $ git review |
| 174 | |
| 175 | .. note:: |
| 176 | |
| 177 | Terraform state file may still exist in the cloud storage. A new job is |
| 178 | required to clean up the state file. |