Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 1 | .. |
| 2 | SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 5 | SDFabric Deployment |
| 6 | =================== |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 7 | |
| 8 | Update aether-pod-config |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 9 | ------------------------ |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 10 | |
| 11 | Aether-pod-configs is a git project hosted on **gerrit.opencord.org** and we placed the following materials in it. |
| 12 | |
| 13 | - Terraform scripts to install TOST applications on Rancher, including ONOS, Stratum and Telegraf. |
| 14 | - Customized configuration for each application (helm values). |
| 15 | - Application specific configuration files, including ONOS network configuration and Stratum chassis config. |
| 16 | |
| 17 | Here is an example folder structure: |
| 18 | |
| 19 | .. code-block:: console |
| 20 | |
| 21 | ╰─$ tree staging/ace-menlo/tost |
| 22 | staging/ace-menlo/tost |
| 23 | ├── app_map.tfvars |
| 24 | ├── backend.tf |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 25 | ├── deepinsight |
| 26 | │ ├── README.md |
| 27 | │ ├── deepinsight-topo.json |
| 28 | │ └── deepinsight-topo.json.license |
| 29 | ├── main.tf -> ../../../common/tost/main.tf |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 30 | ├── onos |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 31 | │ ├── app_map.tfvars |
| 32 | │ ├── backend.tf |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 33 | │ ├── kubeconfig -> ../../../../common/tost/apps/onos/kubeconfig/ |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 34 | │ ├── main.tf -> ../../../../common/tost/apps/onos/main.tf |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 35 | │ ├── onos.yaml |
| 36 | │ └── variables.tf -> ../../../../common/tost/apps/onos/variables.tf |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 37 | ├── stratum |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 38 | │ ├── app_map.tfvars |
| 39 | │ ├── backend.tf |
| 40 | │ ├── main.tf -> ../../../../common/tost/apps/stratum/main.tf |
| 41 | │ ├── menlo-staging-leaf-1-chassis-config.pb.txt |
| 42 | │ ├── menlo-staging-leaf-2-chassis-config.pb.txt |
| 43 | │ ├── menlo-staging-spine-1-chassis-config.pb.txt |
| 44 | │ ├── menlo-staging-spine-2-chassis-config.pb.txt |
| 45 | │ ├── stratum.yaml |
| 46 | │ ├── tost-dev-chassis-config.pb.txt |
| 47 | │ └── variables.tf -> ../../../../common/tost/apps/stratum/variables.tf |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 48 | ├── telegraf |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 49 | │ ├── app_map.tfvars |
| 50 | │ ├── backend.tf |
| 51 | │ ├── main.tf -> ../../../../common/tost/apps/telegraf/main.tf |
| 52 | │ ├── telegraf.yaml |
| 53 | │ └── variables.tf -> ../../../../common/tost/apps/telegraf/variables.tf |
| 54 | └── variables.tf -> ../../../common/tost/variables.tf |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 55 | |
| 56 | There are four Terraform scripts inside **tost** directory and are responsible for managing each service. |
| 57 | |
| 58 | Root folder |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 59 | """"""""""" |
| 60 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 61 | Terraform reads **app_map.tfvars** to know which application will be installed on Rancher |
| 62 | and which version and customized values need to apply to. |
| 63 | |
Hyunsun Moon | fc751aa | 2020-11-11 18:49:47 -0800 | [diff] [blame] | 64 | Here is the example of **app_map.tfvars** which defines prerequisite apps for TOST |
| 65 | as well as project and namespace in which TOST apps will be provisioned. |
| 66 | Note that currently we don't have any prerequisite so we left this blank intentionally. |
| 67 | It can be used to specify prerequisites in the future. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 68 | |
| 69 | .. code-block:: |
| 70 | |
| 71 | project_name = "tost" |
| 72 | namespace_name = "tost" |
| 73 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 74 | |
| 75 | ONOS folder |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 76 | """"""""""" |
| 77 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 78 | All files under **onos** directory are related to ONOS application. |
Hyunsun Moon | fc751aa | 2020-11-11 18:49:47 -0800 | [diff] [blame] | 79 | The **app_map.tfvars** in this folder describes the information about ONOS helm chart. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 80 | |
| 81 | In this example, we specify the **onos-tost** helm chart version to **0.1.18** and load **onos.yaml** |
| 82 | as custom value files. |
| 83 | |
| 84 | .. code-block:: |
| 85 | |
| 86 | apps = ["onos"] |
| 87 | |
| 88 | app_map = { |
| 89 | onos = { |
| 90 | app_name = "onos-tost" |
| 91 | project_name = "tost" |
| 92 | target_namespace = "onos-tost" |
| 93 | catalog_name = "onos" |
| 94 | template_name = "onos-tost" |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 95 | template_version = "0.1.40" |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 96 | values_yaml = ["onos.yaml"] |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | **onos.yaml** used to custom your ONOS-tost Helm chart values and please pay attention to the last section, config. |
| 101 | |
| 102 | .. code-block:: yaml |
| 103 | |
| 104 | onos-classic: |
| 105 | image: |
| 106 | tag: master |
| 107 | pullPolicy: Always |
| 108 | replicas: 1 |
| 109 | atomix: |
| 110 | replicas: 1 |
| 111 | logging: |
| 112 | config: | |
| 113 | # Common pattern layout for appenders |
| 114 | log4j2.stdout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable |
| 115 | |
| 116 | # Root logger |
| 117 | log4j2.rootLogger.level = INFO |
| 118 | |
| 119 | # OSGi appender |
| 120 | log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi |
| 121 | log4j2.appender.osgi.type = PaxOsgi |
| 122 | log4j2.appender.osgi.name = PaxOsgi |
| 123 | log4j2.appender.osgi.filter = * |
| 124 | |
| 125 | # stdout appender |
| 126 | log4j2.rootLogger.appenderRef.Console.ref = Console |
| 127 | log4j2.appender.console.type = Console |
| 128 | log4j2.appender.console.name = Console |
| 129 | log4j2.appender.console.layout.type = PatternLayout |
| 130 | log4j2.appender.console.layout.pattern = ${log4j2.stdout.pattern} |
| 131 | |
| 132 | # SSHD logger |
| 133 | log4j2.logger.sshd.name = org.apache.sshd |
| 134 | log4j2.logger.sshd.level = INFO |
| 135 | |
| 136 | # Spifly logger |
| 137 | log4j2.logger.spifly.name = org.apache.aries.spifly |
| 138 | log4j2.logger.spifly.level = WARN |
| 139 | |
| 140 | # SegmentRouting logger |
| 141 | log4j2.logger.segmentrouting.name = org.onosproject.segmentrouting |
| 142 | log4j2.logger.segmentrouting.level = DEBUG |
| 143 | |
| 144 | config: |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 145 | netcfg: > |
| 146 | { |
| 147 | "devices": { |
| 148 | "device:leaf1": { |
| 149 | "segmentrouting": { |
| 150 | "ipv4NodeSid": 201, |
| 151 | "ipv4Loopback": "10.128.100.38", |
| 152 | "routerMac": "00:00:0A:80:64:26", |
| 153 | "isEdgeRouter": true, |
| 154 | "adjacencySids": [] |
| 155 | }, |
| 156 | } |
| 157 | } |
| 158 | } |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 159 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 160 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 161 | **config.netcfg** is environment dependent and please change it to fit your environment. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 162 | |
| 163 | .. |
| 164 | TODO: Add an example based on the recommended topology |
| 165 | |
| 166 | Stratum folder |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 167 | """""""""""""" |
| 168 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 169 | Stratum uses a similar directory structure as ONOS for Terraform and its configuration files. |
| 170 | |
| 171 | The customize value file is named **stratum.yaml** |
| 172 | |
| 173 | .. code-block:: |
| 174 | |
| 175 | app_map = { |
| 176 | stratum= { |
| 177 | app_name = "stratum" |
| 178 | project_name = "tost" |
| 179 | target_namespace = "stratum" |
| 180 | catalog_name = "stratum" |
| 181 | template_name = "stratum" |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 182 | template_version = "0.1.13" |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 183 | values_yaml = ["stratum.yaml"] |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | Like ONOS, **stratum.yaml** used to customize Stratum Helm Chart and please pay attention to the config section. |
| 188 | |
| 189 | .. code-block:: yaml |
| 190 | |
| 191 | image: |
| 192 | registry: registry.aetherproject.org |
| 193 | repository: tost/stratum-bfrt |
| 194 | tag: 9.2.0-4.14.49 |
| 195 | pullPolicy: Always |
| 196 | pullSecrets: |
| 197 | - aether-registry-credential |
| 198 | |
| 199 | extraParams: |
| 200 | - "-max_log_size=0" |
| 201 | - '-write_req_log_file=""' |
| 202 | - '-read_req_log_file=""' |
| 203 | - "-v=0" |
| 204 | - "-stderrthreshold=0" |
| 205 | - "-bf_switchd_background=false" |
| 206 | |
| 207 | nodeSelector: |
| 208 | node-role.aetherproject.org: switch |
| 209 | |
| 210 | tolerations: |
| 211 | - effect: NoSchedule |
| 212 | value: switch |
| 213 | key: node-role.aetherproject.org |
| 214 | |
| 215 | config: |
| 216 | server: gerrit.opencord.org |
| 217 | repo: aether-pod-configs |
| 218 | folder: staging/ace-onf-menlo/tost/stratum |
| 219 | |
| 220 | Stratum has the same deployment workflow as ONOS. |
| 221 | Once it is deployed to Kubernetes, it will read switch-dependent config files from the aether-pod-configs repo. |
| 222 | The key folder indicates that relative path of configs. |
| 223 | |
| 224 | .. attention:: |
| 225 | |
| 226 | The switch-dependent config file should be named as **${hostname}-chassis-config.pb.txt**. |
| 227 | For example, if the host name of your Tofino switch is **my-leaf**, please name config file **my-leaf-config.pb.txt**. |
| 228 | |
| 229 | .. |
| 230 | TODO: Add an example based on the recommended topology |
| 231 | |
| 232 | Telegraf folder |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 233 | """"""""""""""" |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 234 | |
| 235 | The app_map.tfvars specify the Helm Chart version and the filename of the custom Helm value file. |
| 236 | |
| 237 | .. code-block:: |
| 238 | |
| 239 | apps=["telegraf"] |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 240 | app_map = { |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 241 | telegraf = { |
| 242 | app_name = "telegraf" |
| 243 | project_name = "tost" |
| 244 | target_namespace = "tost" |
| 245 | catalog_name = "aether" |
| 246 | template_name = "tost-telegraf" |
| 247 | template_version = "0.1.1" |
| 248 | values_yaml = ["telegraf.yaml"] |
| 249 | } |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 250 | } |
| 251 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 252 | The **telegraf.yaml** used to override the ONOS-Telegraf Helm Chart and its environment-dependent. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 253 | Please pay attention to the **inputs.addresses** section. |
| 254 | Telegraf will read data from stratum so we need to specify all Tofino switch’s IP addresses here. |
| 255 | Taking Menlo staging pod as example, there are four switches so we fill out 4 IP addresses. |
| 256 | |
| 257 | .. code-block:: yaml |
| 258 | |
| 259 | podAnnotations: |
| 260 | field.cattle.io/workloadMetrics: '[{"path":"/metrics","port":9273,"schema":"HTTP"}]' |
| 261 | |
| 262 | config: |
| 263 | outputs: |
| 264 | - prometheus_client: |
| 265 | metric_version: 2 |
| 266 | listen: ":9273" |
| 267 | inputs: |
| 268 | - cisco_telemetry_gnmi: |
| 269 | addresses: |
| 270 | - 10.92.1.81:9339 |
| 271 | - 10.92.1.82:9339 |
| 272 | - 10.92.1.83:9339 |
| 273 | - 10.92.1.84:9339 |
| 274 | redial: 10s |
| 275 | - cisco_telemetry_gnmi.subscription: |
| 276 | name: stratum_counters |
| 277 | origin: openconfig-interfaces |
| 278 | path: /interfaces/interface[name=*]/state/counters |
| 279 | sample_interval: 5000ns |
| 280 | subscription_mode: sample |
| 281 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 282 | |
| 283 | Create Your Own Configs |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 284 | """"""""""""""""""""""" |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 285 | |
| 286 | The easiest way to create your own configs is running the template script. |
| 287 | |
| 288 | Assumed we would like to set up the **ace-example** pod in the production environment. |
| 289 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 290 | 1. open the **tools/ace_config.yaml** (You should already have this file when you finish VPN bootstrap stage) |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 291 | 2. fill out all required variables |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 292 | 3. perform the makefile command to generate configuration and directory for TOST |
| 293 | 4. update **onos.yaml** for ONOS |
| 294 | 5. update **${hostname}-chassis-config.pb.txt** for Stratum |
| 295 | 6. commit your change and open the Gerrit patch |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 296 | |
| 297 | .. code-block:: console |
| 298 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 299 | vim tools/ace_config.yaml |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 300 | make -C tools/ tost |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 301 | vim production/ace-example/tost/onos/onos.yaml |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 302 | vim production/ace-example/tost/stratum/*${hostname}-chassis-config.pb.txt** |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 303 | git add commit |
| 304 | git review |
| 305 | |
| 306 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 307 | Quick recap |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 308 | """"""""""" |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 309 | |
| 310 | To recap, most of the files in **tost** folder can be copied from existing examples. |
| 311 | However, there are a few files we need to pay extra attentions to. |
| 312 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 313 | - **onos.yaml** in **onos** folder |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 314 | - Chassis config in **stratum** folder |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 315 | There should be one chassis config for each switch. The file name needs to be |
| 316 | **${hostname}-chassis-config.pb.txt** |
| 317 | - **telegraf.yaml** in **telegraf** folder need to be updated with all switch |
| 318 | IP addresses |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 319 | |
| 320 | Double check these files and make sure they have been updated accordingly. |
| 321 | |
| 322 | |
| 323 | Create a review request |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 324 | """"""""""""""""""""""" |
| 325 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 326 | We also need to create a gerrit review request, similar to what we have done in |
| 327 | the **Aether Runtime Deployment**. |
| 328 | |
| 329 | Please refer to :doc:`Aether Runtime Deployment <runtime_deployment>` to |
| 330 | create a review request. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 331 | |
| 332 | |
| 333 | Create TOST deployment job in Jenkins |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 334 | ------------------------------------- |
| 335 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 336 | There are three major components in the Jenkins system, the Jenkins pipeline |
| 337 | and Jenkins Job Builder and Jenkins Job. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 338 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 339 | We follow the Infrastructure as Code principle to place three major components |
| 340 | in a Git repo, ``aether-ci-management`` |
| 341 | |
| 342 | Download the ``aether-ci-management`` repository. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 343 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 344 | .. code-block:: shell |
| 345 | |
| 346 | $ cd $WORKDIR |
| 347 | $ git clone "ssh://[username]@gerrit.opencord.org:29418/aether-ci-management" |
| 348 | |
| 349 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 350 | Here is the example of folder structure, we put everything related to three |
| 351 | major components under the jjb folder. |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 352 | |
| 353 | .. code-block:: console |
| 354 | |
| 355 | $ tree -d jjb |
| 356 | jjb |
| 357 | ├── ci-management |
| 358 | ├── global |
| 359 | │ ├── jenkins-admin -> ../../global-jjb/jenkins-admin |
| 360 | │ ├── jenkins-init-scripts -> ../../global-jjb/jenkins-init-scripts |
| 361 | │ ├── jjb -> ../../global-jjb/jjb |
| 362 | │ └── shell -> ../../global-jjb/shell |
| 363 | ├── pipeline |
| 364 | ├── repos |
| 365 | ├── shell |
| 366 | └── templates |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 367 | |
| 368 | |
| 369 | Jenkins pipeline |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 370 | """""""""""""""" |
| 371 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 372 | Jenkins pipeline runs the Terraform scripts to install desired applications |
| 373 | into the specified Kubernetes cluster. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 374 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 375 | Both ONOS and Stratum will read configuration files (network config, chassis |
| 376 | config) from aether-pod-config. |
| 377 | |
| 378 | The default git branch is master. For testing purpose, we also provide two |
| 379 | parameters to specify the number of reviews and patchset. |
| 380 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 381 | We will explain more in the next section. |
| 382 | |
| 383 | .. note:: |
| 384 | |
| 385 | Currently, we don’t perform the incremental upgrade for TOST application. |
| 386 | Instead, we perform the clean installation. |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 387 | In the pipeline script, Terraform will destroy all existing resources and |
| 388 | then create them again. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 389 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 390 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 391 | We put all pipeline scripts under the pipeline directory, the language of the |
| 392 | pipeline script is groovy. |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 393 | |
| 394 | .. code-block:: console |
| 395 | |
| 396 | $ tree pipeline |
| 397 | pipeline |
| 398 | ├── aether-in-a-box.groovy |
| 399 | ├── artifact-release.groovy |
| 400 | ├── cd-pipeline-charts-postrelease.groovy |
| 401 | ├── cd-pipeline-dockerhub-postrelease.groovy |
| 402 | ├── cd-pipeline-postrelease.groovy |
| 403 | ├── cd-pipeline-terraform.groovy |
| 404 | ├── docker-publish.groovy |
| 405 | ├── ng40-func.groovy |
| 406 | ├── ng40-scale.groovy |
| 407 | ├── reuse-scan-gerrit.groovy |
| 408 | ├── reuse-scan-github.groovy |
| 409 | ├── tost-onos.groovy |
| 410 | ├── tost-stratum.groovy |
| 411 | ├── tost-telegraf.groovy |
| 412 | └── tost.groovy |
| 413 | |
| 414 | Currently, we had four pipeline scripts for TOST deployment. |
| 415 | |
| 416 | 1. tost-onos.groovy |
| 417 | 2. tost-stratum.groovy |
| 418 | 3. tost-telegraf.groovy |
| 419 | 4. tost.groovy |
| 420 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 421 | tost-[onos/stratum/telegraf].groovy are used to deploy the individual |
| 422 | application respectively, and tost.groovy is a high level script, used to |
| 423 | deploy the TOST application, it will execute the above three scripts in its |
| 424 | pipeline script. |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 425 | |
| 426 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 427 | Jenkins jobs |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 428 | """""""""""" |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 429 | |
| 430 | Jenkins job is the task unit in the Jenkins system. A Jenkins job contains the following information: |
| 431 | |
| 432 | - Jenkins pipeline |
| 433 | - Parameters for Jenkins pipeline |
| 434 | - Build trigger |
| 435 | - Source code management |
| 436 | |
| 437 | We created one Jenkins job for each TOST component, per Aether edge. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 438 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 439 | We have four Jenkins jobs (HostPath provisioner, ONOS, Stratum and Telegraf) |
| 440 | for each edge as of today. |
| 441 | |
| 442 | There are 10+ parameters in Jenkins jobs and they can be divided into two |
| 443 | parts, cluster-level and application-level. |
| 444 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 445 | Here is an example of supported parameters. |
| 446 | |
| 447 | .. image:: images/jenkins-onos-params.png |
| 448 | :width: 480px |
| 449 | |
| 450 | Application level |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 451 | ''''''''''''''''' |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 452 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 453 | - **GERRIT_CHANGE_NUMBER/GERRIT_PATCHSET_NUMBER**: tell the pipeline script to read |
| 454 | the config for aether-pod-configs repo from a specified gerrit review, instead of the |
| 455 | HEAD branch. It’s good for developer to test its change before merge. |
| 456 | - **onos_user**: used to login ONOS controller |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 457 | - **git_repo/git_server/git_user/git_password_env**: information of git |
| 458 | repository, **git_password_env** is a key for Jenkins Credential system. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 459 | |
| 460 | Cluster level |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 461 | ''''''''''''' |
| 462 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 463 | - **gcp_credential**: Google Cloud Platform credential for remote storage, used |
| 464 | by Terraform. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 465 | - **terraform_dir**: The root directory of the TOST directory. |
| 466 | - **rancher_cluster**: target Rancher cluster name. |
| 467 | - **rancher_api_env**: Rancher credential to access Rancher, used by Terraform. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 468 | |
| 469 | .. note:: |
| 470 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 471 | Typically, developer only focus on **GERRIT_CHANGE_NUMBER** and **GERRIT_PATCHSET_NUMBER**. The rest of them are managed by OPs. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 472 | |
| 473 | Jenkins Job Builder (JJB) |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 474 | """"""""""""""""""""""""" |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 475 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 476 | We prefer to apply the IaC (Infrastructure as Code) for everything. We use the |
| 477 | JJB (Jenkins Job Builder) to create new Jenkins Job, including the Jenkins |
| 478 | pipeline. We need to clone a set of Jenkins jobs when a new edge is deployed. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 479 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 480 | In order to provide the flexibility and avoid re-inventing the wheel, we used |
| 481 | the job template to declare your job. Thanks to the JJB, we can use the |
| 482 | parameters in the job template to render different kinds of jobs easily. |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 483 | |
| 484 | All the template files are placed under templates directory. |
| 485 | |
| 486 | .. code-block:: console |
| 487 | |
| 488 | ╰─$ tree templates |
| 489 | templates |
| 490 | ├── aether-in-a-box.yaml |
| 491 | ├── archive-artifacts.yaml |
| 492 | ├── artifact-release.yml |
| 493 | ├── cd-pipeline-terraform.yaml |
| 494 | ├── docker-publish-github.yaml |
| 495 | ├── docker-publish.yaml |
| 496 | ├── helm-lint.yaml |
| 497 | ├── make-test.yaml |
| 498 | ├── ng40-nightly.yaml |
| 499 | ├── ng40-test.yaml |
| 500 | ├── private-docker-publish.yaml |
| 501 | ├── private-make-test.yaml |
| 502 | ├── publish-helm-repo.yaml |
| 503 | ├── reuse-gerrit.yaml |
| 504 | ├── reuse-github.yaml |
| 505 | ├── sync-dir.yaml |
| 506 | ├── tost.yaml |
| 507 | ├── verify-licensed.yaml |
| 508 | └── versioning.yaml |
| 509 | |
Zack Williams | 794532a | 2021-03-18 17:38:36 -0700 | [diff] [blame] | 510 | We defined all TOST required job templates in tost.yaml and here is its partial |
| 511 | content. |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 512 | |
| 513 | .. code-block:: yaml |
| 514 | |
| 515 | - job-template: |
| 516 | name: "{name}-onos" |
| 517 | id: "deploy-onos" |
| 518 | project-type: pipeline |
| 519 | dsl: !include-raw-escape: jjb/pipeline/tost-onos.groovy |
| 520 | triggers: |
| 521 | - onf-infra-tost-gerrit-trigger: |
| 522 | gerrit-server-name: '{gerrit-server-name}' |
| 523 | trigger_command: "apply" |
| 524 | pattern: "{terraform_dir}/tost/onos/.*" |
| 525 | logrotate: |
| 526 | daysToKeep: 7 |
| 527 | numToKeep: 10 |
| 528 | artifactDaysToKeep: 7 |
| 529 | artifactNumToKeep: 10 |
| 530 | parameters: |
| 531 | - string: |
| 532 | name: gcp_credential |
| 533 | default: "{google_bucket_access}" |
| 534 | - string: |
| 535 | name: rancher_cluster |
| 536 | default: "{rancher_cluster}" |
| 537 | - string: |
| 538 | name: rancher_api_env |
| 539 | default: "{rancher_api}" |
| 540 | - string: |
| 541 | name: git_repo |
| 542 | default: "aether-pod-configs" |
| 543 | - string: |
| 544 | name: git_server |
| 545 | default: "gerrit.opencord.org" |
| 546 | - string: |
| 547 | name: git_ssh_user |
| 548 | default: "jenkins" |
| 549 | |
| 550 | |
| 551 | |
| 552 | |
| 553 | Once we have the job template, we need to tell the JJB, we want to use the job template to create our own jobs. |
| 554 | Here comes the concept of project, you need to define job templates you want to use and the values of all parameters. |
| 555 | |
| 556 | |
| 557 | We put all project yaml files under the repo directory and here is the example |
| 558 | |
| 559 | .. code-block:: console |
| 560 | |
| 561 | ╰─$ tree repos 130 ↵ |
| 562 | repos |
| 563 | ├── aether-helm-charts.yaml |
| 564 | ├── aether-in-a-box.yaml |
| 565 | ├── cd-pipeline-terraform.yaml |
| 566 | ├── ng40-test.yaml |
| 567 | ├── spgw.yaml |
| 568 | └── tost.yaml |
| 569 | |
| 570 | |
| 571 | Following is the example of tost projects, we defined three projects here, and each project has different |
| 572 | parameters and Jenkins jobs it wants to use. |
| 573 | |
| 574 | .. code-block:: yaml |
| 575 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 576 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 577 | - project: |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 578 | name: deploy-tucson-pairedleaves-dev |
| 579 | rancher_cluster: "dev-pairedleaves-tucson" |
| 580 | terraform_dir: "staging/dev-pairedleaves-tucson" |
| 581 | rancher_api: "{rancher_staging_access}" |
| 582 | properties: |
| 583 | - onf-infra-onfstaff-private |
| 584 | jobs: |
| 585 | - "deploy" |
| 586 | - "deploy-onos" |
| 587 | - "deploy-stratum" |
| 588 | - "deploy-telegraf" |
| 589 | - "debug-tost" |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 590 | |
| 591 | |
| 592 | Create Your Own Jenkins Job |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 593 | """"""""""""""""""""""""""" |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 594 | |
| 595 | Basically, if you don't need to customize the Jenkins pipeline script and the job configuration, the only thing |
| 596 | you need to do is modify the repos/tost.yaml to add your project. |
| 597 | |
| 598 | For example, we would like to deploy the TOST to our production pod, let's assume it named "tost-example". |
| 599 | Add the following content into repos/tost.yaml |
| 600 | |
| 601 | .. code-block:: yaml |
| 602 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 603 | |
Hung-Wei Chiu | d06947b | 2021-08-10 16:10:07 -0700 | [diff] [blame] | 604 | - project: |
| 605 | name: deploy-tost-example-production |
| 606 | rancher_cluster: "ace-test-example" |
| 607 | terraform_dir: "production/tost-example" |
| 608 | rancher_api: "{rancher_production_access}" |
| 609 | properties: |
| 610 | - onf-infra-onfstaff-private |
| 611 | jobs: |
| 612 | - "deploy" |
| 613 | - "deploy-onos" |
| 614 | - "deploy-stratum" |
| 615 | - "deploy-telegraf" |
| 616 | - "debug-tost" |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 617 | |
| 618 | .. note:: |
| 619 | |
| 620 | The **terraform_dir** indicates the directory location in aether-pod-configs repo, please ensure your Terraform scripts |
| 621 | already there before running the Jenkins job. |
| 622 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 623 | |
| 624 | Trigger TOST deployment in Jenkins |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 625 | ---------------------------------- |
| 626 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 627 | Whenever a change is merged into **aether-pod-config**, |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 628 | the Jenkins job should be triggered automatically to (re)deploy TOST. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 629 | |
Hung-Wei Chiu | f7cadb3 | 2020-11-19 04:49:35 +0000 | [diff] [blame] | 630 | You can also type the comment **apply** in the Gerrit patch, it will trigger Jenkins jobs to deploy TOST for you. |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 631 | |
Charles Chan | 2cb05c7 | 2020-12-09 16:31:20 -0800 | [diff] [blame] | 632 | |
| 633 | Verification |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 634 | ------------ |
| 635 | |
Charles Chan | 2cb05c7 | 2020-12-09 16:31:20 -0800 | [diff] [blame] | 636 | Fabric connectivity should be fully ready at this point. |
| 637 | We should verify that **all servers**, including compute nodes and the management server, |
| 638 | have an IP address and are **able to reach each other via fabric interface** before continuing the next step. |
| 639 | |
| 640 | This can be simply done by running a **ping** command from one server to another server's fabric IP. |
| 641 | |
| 642 | |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 643 | Troubleshooting |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 644 | --------------- |
Charles Chan | 4a10722 | 2020-10-30 17:23:48 -0700 | [diff] [blame] | 645 | |
| 646 | The deployment process involves the following steps: |
| 647 | |
| 648 | 1. Jenkins Job |
| 649 | 2. Jenkins Pipeline |
| 650 | 3. Clone Git Repository |
| 651 | 4. Execute Terraform scripts |
| 652 | 5. Rancher start to install applications |
| 653 | 6. Applications be deployed into Kubernetes cluster |
| 654 | 7. ONOS/Stratum will read the configuration (network config, chassis config) |
| 655 | 8. Pod become running |
| 656 | |
| 657 | Taking ONOS as an example, here's what you can do to troubleshoot. |
| 658 | |
| 659 | You can see the log message of the first 4 steps in Jenkins console. |
| 660 | If something goes wrong, the status of the Jenkins job will be in red. |
| 661 | If Jenkins doesn't report any error message, the next step is going to Rancher's portal |
| 662 | to ensure the Answers is same as the *onos.yaml* in *aether-pod-configs*. |
Zack Williams | bcc4c2b | 2021-04-07 16:58:03 -0700 | [diff] [blame] | 663 | |
| 664 | Accessing the Stratum CLI |
| 665 | """"""""""""""""""""""""" |
| 666 | |
| 667 | You can login to the Stratum container running on a switch using this script: |
| 668 | |
| 669 | .. code-block:: sh |
| 670 | |
| 671 | #!/bin/bash |
| 672 | echo 'Attaching to Stratum container. Ctrl-P Ctrl-Q to exit' |
| 673 | echo 'Press Enter to continue...' |
| 674 | DOCKER_ID=`docker ps | grep stratum-bf | awk '{print $1}'` |
| 675 | docker attach $DOCKER_ID |
| 676 | |
| 677 | You should then see the bf_sde prompt: |
| 678 | |
| 679 | .. code-block:: sh |
| 680 | |
| 681 | bf_sde> pm |
| 682 | bf_sde.pm> show -a |
| 683 | |
| 684 | Accessing the ONOS CLI |
| 685 | """""""""""""""""""""" |
| 686 | |
| 687 | After setting up kubectl to access the TOST pods, run: |
| 688 | |
| 689 | .. code-block:: sh |
| 690 | |
| 691 | $ kubectl get pods -n tost |
| 692 | |
| 693 | Pick a TOST pod, and make a port forward to it, then login to it with the |
| 694 | ``onos`` CLI tool: |
| 695 | |
| 696 | .. code-block:: sh |
| 697 | |
| 698 | $ kubectl -n tost port-forward onos-tost-onos-classic-0 8181 8101 |
| 699 | $ onos karaf@localhost |
| 700 | |
| 701 | In some rare cases, you may need to access the ONOS master instance CLI, in |
| 702 | which case you can run ``roles``: |
| 703 | |
| 704 | .. code-block:: sh |
| 705 | |
| 706 | karaf@root > roles |
| 707 | device:devswitch1: master=onos-tost-onos-classic-1, standbys=[ onos-tost-onos-classic-0 ] |
| 708 | |
| 709 | Above lines show that ``onos-tost-onos-classic-1`` is the master. So switch to |
| 710 | that by killing the port forward, starting a new one pointing at the master, |
| 711 | then logging into that one: |
| 712 | |
| 713 | .. code-block:: sh |
| 714 | |
| 715 | $ ps ax | grep -i kubectl |
| 716 | # returns kubectl commands running, pick the port-forward one and kill it |
| 717 | $ kill 0123 |
| 718 | $ kubectl -n tost port-forward onos-tost-onos-classic-1 8181 8101 |
| 719 | $ onos karaf@localhost |
| 720 | |