Skip to content

Commit df285c7

Browse files
author
Jill Grant
authored
Merge pull request #247564 from DannyMassa/patch-2
Patch 2
2 parents 1a1493f + 052cc5b commit df285c7

File tree

1 file changed

+126
-56
lines changed

1 file changed

+126
-56
lines changed

articles/operator-nexus/howto-run-instance-readiness-testing.md

Lines changed: 126 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,71 +18,141 @@ Instance Readiness Testing (IRT) is a framework built to orchestrate real-world
1818
- A Linux environment (Ubuntu suggested) capable of calling Azure APIs
1919
- Knowledge of networks to use for the test
2020
* Networks to use for the test are specified in a "networks-blueprint.yml" file, see [Input Configuration](#input-configuration).
21-
- curl or wget to download IRT package
22-
23-
## Before execution
24-
25-
1. From your Linux environment, download nexus-irt.tar.gz from aka.ms/nexus-irt `curl -Lo nexus-irt.tar.gz aka.ms/nexus-irt`.
26-
1. Extract the tarball to the local file system: `mkdir -p irt && tar xf nexus-irt.tar.gz --directory ./irt`.
27-
1. Switch to the new directory `cd irt`.
28-
1. The `setup.sh` script is provided to aid in the initial set up of an environment.
29-
* `setup.sh` assumes a nonroot user and attempts to use `sudo`, which installs:
30-
1. `jq` version 1.6
31-
1. `yq` version 4.33
32-
1. `azcopy` version 10
33-
1. `az` Azure CLI minimum version not known, stay up to date.
34-
1. `elinks` for viewing html files on the command line
35-
1. `tree` for viewing directory structures
36-
1. `moreutils` utilities for viewing progress from the ACI container
37-
1. [Optional] Set up a storage account to archive test results over time. For help, see the [instructions](#uploading-results-to-your-own-archive).
38-
1. Log into Azure, if not already logged in: `az login --use-device`.
39-
* User should have `Contributor` role
40-
1. Create an Azure Managed Identity for the container to use.
41-
* Using the provided script: `MI_RESOURCE_GROUP="<your resource group> MI_NAME="<managed identity name>" SUBSCRIPTION="<subscription>" ./create-managed-identity.sh`
42-
* Can be created manually via the Azure portal, refer to the script for needed permissions
43-
1. Create a service principal and security group. The service principal is used as the executor of the test. The group informs the kubernetes cluster of valid users. The service principal must be a part of the security group, so it has the ability to log into the cluster.
44-
* You can provide your own, or use our provided script, here's an example of how it could be executed; `AAD_GROUP_NAME=external-test-aad-group-8 SERVICE_PRINCIPAL_NAME=external-test-sp-8 ./irt/create-service-principal.sh`.
45-
* This script prints four key/value pairs for you to include in your input file.
46-
1. If necessary, create the isolation domains required to execute the tests. They aren't lifecycled as part of this test scenario.
47-
* **Note:** If deploying isolation domains, your network blueprint must define at least one external network per isolation domain. see `networks-blueprint.example.yml` for help with configuring your network blueprint.
48-
* `create-l3-isolation-domains.sh` takes one parameter, a path to your networks blueprint file; here's an example of the script being invoked:
49-
* `create-l3-isolation-domains.sh ./networks-blueprint.yml`
50-
51-
### Input configuration
52-
53-
1. Build your input file. The IRT tarball provides `irt-input.example.yml` as an example. These values **will not work for all instances**, they need to be manually changed and the file also needs to be renamed to `irt-input.yml`.
54-
1. define the values of networks-blueprint input, an example of this file is given in networks-blueprint.example.yml.
55-
56-
The network blueprint input schema for IRT is defined in the networks-blueprint.example.yml. Currently IRT has the following network requirements. The networks are created as part of the test, provide network details that aren't in use.
57-
58-
1. Three (3) L3 Networks
21+
- curl to download IRT package
22+
- The User Access Admin & Contributor roles for the execution subscription
23+
- The ability to create security groups in your Active Directory tenant
5924

25+
## Input configuration
26+
27+
Build your input file. The IRT tarball provides `irt-input.example.yml` as an example, follow the [instructions](#download-irt) to download the tarball. These values **will not work for your instances**, they need to be manually changed and the file should also be renamed to `irt-input.yml`. The example input file is provided as a stub to aid in configuring new input files. Overridable values and their usage are outlined in the example. The **[One Time Setup](#one-time-setup) assists in setting input values by writing key/value pairs to the config file as they execute.**
28+
29+
The network information is provided in either a `networks-blueprint.yml` file, similar to the `networks-blueprint.example.yml` that is provided, or appended to the `irt-input.yml` file. The schema for IRT is defined in the `networks-blueprint.example.yml`. The networks are created as part of the test, provide network details that aren't in use. Currently IRT has the following network requirements:
30+
31+
* Three (3) L3 Networks
6032
* Two of them with MTU 1500
61-
* One of them with MTU 9000 and shouldn't have fabric_asn definition
33+
* One of them with MTU 9000 and shouldn't have a fabric_asn attribute
34+
* One (1) Trunked Network
35+
* All vlans should be greater than 500
36+
37+
## One Time Setup
38+
39+
### Download IRT
40+
IRT is distributed via tarball, download it, extract it, and navigate to the `irt` directory
41+
1. From your Linux environment, download nexus-irt.tar.gz from aka.ms/nexus-irt `curl -Lo nexus-irt.tar.gz aka.ms/nexus-irt`
42+
1. Extract the tarball to the local file system: `mkdir -p irt && tar xf nexus-irt.tar.gz --directory ./irt`
43+
1. Switch to the new directory `cd irt`
44+
45+
46+
### Install dependencies
47+
There are multiple dependencies expected to be available during execution. Review this list;
48+
49+
* `jq` version 1.6 or greater
50+
* `yq` version 4.33 or greater
51+
* `azcopy` version 10 or greater
52+
* `az` Azure CLI minimum version not known, stay up to date.
53+
* `elinks` - for viewing html files on the command line
54+
* `tree` - for viewing directory structures
55+
* `moreutils` - for viewing progress from the ACI container
56+
57+
The `setup.sh` script is provided to aid with installing the listed dependencies. It installs any dependencies that aren't available in PATH. It doesn't upgrade any dependencies that don't meet the minimum required versions.
58+
59+
> [!NOTE]
60+
> `setup.sh` assumes a nonroot user and attempts to use `sudo`
61+
62+
### All in one setup
63+
64+
`all-in-one-setup.sh` is provided to create all of the Azure resources required to run IRT. This process includes creating a managed identity, a service principal, a security group, isolation domains, and a storage account to archive the test results. These resources can be created during the all in one script, or they can be created step by step per the instructions in this document. Each of the script, individually and via the all in one script, writes updates to your `irt-input.yml` file with the key value pairs needed to utilize the resources you created. Review the `irt-input.example.yml` file for the required inputs needed for the script(s), regardless of the methodology you pursue. All of the scripts are idempotent, and also allow you to use existing resources if desired.
65+
66+
### Step-by-Step setup
67+
68+
> [!NOTE]
69+
> Only use this section if you're NOT using `all-in-one.sh`
70+
71+
If your workflow is incompatible with `all-in-one.sh`, each resource needed for IRT can be created manually with each supplemental script. Like `all-in-one.sh`, running these scripts writes key/value pairs to your `irt-input.yml` for you to use during your run. These five scripts make up the `all-in-one.sh`.
72+
73+
IRT makes commands against your resources, and needs permission to do so. IRT requires a Managed Identity and a Service Principal to execute. It also requires that the service principal is a member of the Azure AD Security Group that is also provided as input.
74+
75+
#### Create managed identity
76+
A managed identity with the following role assignments is needed to execute tests. The supplemental script, `create-managed-identity.sh` creates a managed identity with these role assignments.
77+
* `Contributor` - For creating and manipulating resources
78+
* `Storage Blob Data Contributor` - For reading from and writing to the storage blob container
79+
* `Log Analytics Reader` - For reading metadata about the LAW
80+
81+
82+
Executing `create-managed-identity.sh` requires the following environment variables to be set;
83+
* **MI_RESOURCE_GROUP** - The resource group the Managed Identity is created in. The resource group is created in `eastus` if the resource group provided doesn't yet exist.
84+
* **MI_NAME** - The name of the Managed Identity to be created.
85+
* **[Optional] SUBSCRIPTION** - to set the subscription. Alternatively, the script uses az CLI context to look up the subscription.
86+
87+
```bash
88+
# Example execution of the script
89+
MI_RESOURCE_GROUP="<your resource group>" MI_NAME="<your managed identity name>" SUBSCRIPTION="<your subscription ID>" ./create-managed-identity.sh
90+
```
91+
92+
**RESULT:** This script prints a value for `MANAGED_IDENTITY_ID`. This key/value pair should be recorded in the irt-input.yml for use. See [Input Configuration](#input-configuration).
93+
94+
95+
#### Create service principal and security group
96+
A service principal with the following role assignments. The supplemental script, `create-service-principal.sh` creates a service principal with these role assignments, or add role assignments to an existing service principal.
97+
* `Contributor` - For creating and manipulating resources
98+
* `Storage Blob Data Contributor` - For reading from and writing to the storage blob container
99+
* `Azure ARC Kubernetes Admin` - For ARC enrolling the NAKS cluster
100+
101+
Additionally, the script creates the necessary security group, and adds the service principal to the security group. If the security group exists, it adds the service principal to the existing security group.
102+
103+
Executing `create-service-principal.sh` requires the following environment variables to be set:
104+
* SERVICE_PRINCIPAL_NAME - The name of the service principal, created with the `az ad sp create-for-rbac` command.
105+
* AAD_GROUP_NAME - The name of the security group.
106+
107+
```bash
108+
# Example execution of the script
109+
SERVICE_PRINCIPAL_NAME="<your service principal name>" AAD_GROUP_NAME="<your security group name>" ./create-service-principal.sh
110+
```
111+
112+
**RESULT:** This script prints values for `AAD_GROUP_ID`, `SP_ID`, `SP_PASSWORD`, and `SP_TENANT`. This key/value pair should be recorded in irt-input.yml for use. See [Input Configuration](#input-configuration).
113+
114+
115+
#### Create isolation domains
116+
The testing framework doesn't create, destroy, or manipulate isolation domains. Therefore, existing Isolation Domains can be used. Each Isolation Domain requires at least one external network. The supplemental script, `create-l3-isolation-domains.sh`. Internal networks are created, manipulated, and destroy through the course of testing. They're created using the data provided in the networks blueprint.
117+
118+
Executing `create-l3-isolation-domains.sh` requires one **parameter**, a path to your networks blueprint file:
119+
120+
```bash
121+
# Example of the script being invoked:
122+
./create-l3-isolation-domains.sh ./networks-blueprint.yml
123+
```
124+
125+
#### Create archive storage
126+
IRT creates an html test report after running a test scenario. These reports can optionally be uploaded to a blob storage container. the supplementary script `create-archive-storage.sh` to create a storage container, storage account, and resource group if they don't already exist.
127+
128+
129+
Executing `create-managed-identity.sh` requires the following environment variables to be set:
130+
* **RESOURCE_GROUP** - The resource group the Managed Identity is created in. The resource group is created in `eastus` if the resource group provided doesn't yet exist.
131+
* **STORAGE_ACCOUNT_NAME** - The name of the Azure storage account to be created.
132+
* **STORAGE_CONTAINER_NAME** - The name of the blob storage container to be created.
133+
* **[Optional] SUBSCRIPTION** - to set the subscription. Alternatively, the script uses the az CLI context to look up the subscription.
134+
135+
136+
```bash
137+
# Example execution of the script
138+
RESOURCE_GROUP="<your resource group>" STORAGE_ACCOUNT_NAME="<your storage account name>" STORAGE_CONTAINER_NAME="<your container name>" ./create-archive-storage.sh
139+
```
140+
141+
**RESULT:** This script prints a value for `PUBLISH_RESULTS_TO`. This key/value pair should be recorded in irt-input.yml for use. See [Input Configuration](#input-configuration).
62142

63-
1. One (1) Trunked Network
64-
1. All vlans should be greater than 500
65143

66144
## Execution
67145

68-
1. Execute: `./irt.sh irt-input.yml`
69-
* Assumes irt-input.yml is in the same location as irt.sh. If in a different location provides the full file path.
146+
* Execute. This example assumes irt-input.yml is in the same location as irt.sh. If your file is located in a different directory, provide the full file path.
147+
148+
```bash
149+
./irt.sh irt-input.yml
150+
```
70151

71152
## Results
72153

73154
1. A file named `summary-<cluster_name>-<timestamp>.html` is downloaded at the end of the run and contains the testing results. It can be viewed:
74155
1. From any browser
75156
1. Using elinks or lynx to view from the command line; for example:
76-
1. `elinks summary-<cluster_name>-<timestamp>..html`
77-
1. When an SAS Token is provided for the `PUBLISH_RESULTS_TO` parameter the results are uploaded to the blob container you specified. It can be previewed by navigating to the link presented to you at the end of the IRT run.
78-
79-
### Uploading results to your own archive
80-
81-
1. We offer a supplementary script, `create-archive-storage.sh` to allow you to set up a storage container to store your results. The script generates an SAS Token for a storage container that is valid for three days. The script creates a storage container, storage account, and resource group if they don't already exist.
82-
1. The script expects the following environment variables to be defined:
83-
1. RESOURCE_GROUP
84-
1. SUBSCRIPTION
85-
1. STORAGE_ACCOUNT_NAME
86-
1. STORAGE_CONTAINER_NAME
87-
1. Copy the last output from the script, into your IRT YAML input. The output looks like this:
88-
* `PUBLISH_RESULTS_TO="<sas-token>"`
157+
1. `elinks summary-<cluster_name>-<timestamp>.html`
158+
1. If the `PUBLISH_RESULTS_TO` parameter was provided, the results are uploaded to the blob container you specified. It can be previewed by navigating to the link presented to you at the end of the IRT run.

0 commit comments

Comments
 (0)