You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/book/src/developers/development.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -507,6 +507,8 @@ To run E2E locally, set `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRI
507
507
./scripts/ci-e2e.sh
508
508
```
509
509
510
+
Note: Users that have a restrictive environment and want to leverage API Server ILB in their flavors and to run e2e tests locally should refer to the detailed explanation in [running e2e tests locally leveraging apiserver ilb solution](./tilt-with-aks-as-mgmt-ilb.md#running-e2e-tests-locally-using-api-server-ilbs-networking-solution)
Copy file name to clipboardExpand all lines: docs/book/src/developers/tilt-with-aks-as-mgmt-ilb.md
+151Lines changed: 151 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,3 +124,154 @@ Once the tilt UI is up and running
124
124
- Flavors that leverage internal load balancer are:
125
125
-`apiserver-ilb`
126
126
-`windows-apiserver-ilb`
127
+
128
+
### Running e2e tests locally using API Server ILB's networking solution
129
+
130
+
Building upon the [challenges and solutions](#challenges-and-solutions) from above, running an e2e test locally in a restricted environment calls for some workarounds in the prow templates and the e2e test itself.
131
+
132
+
1. We need to add the apiserver ILB with private endpoints and opinionated CIDRs to the workload cluster's VNet & Subnets, and pre-kubeadm commands updating the `/etc/hosts` file of the nodes of the workload cluster.
133
+
134
+
2. Once the template has been modified to be run in local environment using AKS as management cluster, we need to be able to peer the vnets, create private DNS zone for the FQDN of the workload cluster and re-enable blocked NSG ports.
135
+
136
+
**Note:**
137
+
138
+
- The following guidance is only for testing, and is not a recommendation for any production environment.
139
+
140
+
- The below steps are for self-managed templates only and do not apply to AKS workload clusters.
141
+
142
+
- If you are going to run the local tests from a dev machine in Azure, you will have to use user-assigned managed identity and assign it to the management cluster. Follow the below steps before proceeding.
143
+
1. Create a user-assigned managed identity
144
+
2. Assign that managed identity a contributor role to your subscription
145
+
3. Set `AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY`, `AZURE_OBJECT_ID_USER_ASSIGNED_IDENTITY`, and `AZURE_USER_ASSIGNED_IDENTITY_RESOURCE_ID` to the user-assigned managed identity.
146
+
147
+
#### Update prow template with apiserver ILB networking solution
148
+
149
+
There are three sections of a prow template that need an update.
150
+
151
+
1. AzureCluster
152
+
-`/spec/networkSpec/apiServerLB`
153
+
- Add FrontendIP
154
+
- Add an associated private IP to be leveraged by an internal ILB
155
+
-`/spec/networkSpec/vnet/cidrBlocks`
156
+
- Add VNet CIDR
157
+
-`/spec/networkSpec/subnets/0/cidrBlocks`
158
+
- Add Subnet CIDR for the control plane
159
+
-`/spec/networkSpec/subnets/1/cidrBlocks`
160
+
- Add Subnet CIDR for the worker node
161
+
2.`KubeadmConfigTemplate` - linux node; Identifiable by `name: .*-md-0`
162
+
-`/spec/template/spec/preKubeadmCommands/0`
163
+
- Add a prekubeadm command updating the `/etc/hosts` of worker nodes of type "linux".
164
+
3.`KubeadmConfigTemplate` - windows node; Identifiable by `name: .*-md-win`
165
+
-`/spec/template/spec/preKubeadmCommands/0`
166
+
- Add a prekubeadm command updating the `/etc/hosts` of worker nodes of type "windows".
167
+
168
+
A sample kustomize command for updating a prow template via its kustomization.yaml is pasted below.
#### Peer Vnets of the management cluster and the workload cluster
232
+
233
+
Peering VNets, creating a private DNS zone with the FQDN of the workload cluster, and updating NSGs of the management and workload clusters can be achieved by running `scripts/peer-vnets.sh`.
234
+
235
+
This script, `scripts/peer-vnets.sh`, should be run after triggering the test run locally and in a separate terminal.
236
+
237
+
#### Running the test locally
238
+
239
+
We recommend running the test individually while debugging the test failure. This implies that `GINKGO_FOCUS` as unique as possible. So for instance if you want to run `periodic-cluster-api-provider-azure-e2e-main`'s "With 3 control-plane nodes and 2 Linux and 2 Windows worker nodes" test,
240
+
241
+
1. We first need to add the following environment variables to the test itself. For example:
The above lines should be added before the `clusterctl.ApplyClusterTemplateAndWait()` is invoked.
252
+
253
+
254
+
2. Open the terminal and run the below command:
255
+
256
+
```bash
257
+
GINKGO_FOCUS="With 3 control-plane nodes and 2 Linux and 2 Windows worker nodes" USE_LOCAL_KIND_REGISTRY=false SKIP_CLEANUP="true" SKIP_LOG_COLLECTION="true" REGISTRY="<>" MGMT_CLUSTER_TYPE="aks" EXP_APISERVER_ILB=true AZURE_LOCATION="<>" ARCH="amd64" scripts/ci-e2e.sh
258
+
```
259
+
260
+
**Note:**
261
+
262
+
- Set `MGMT_CLUSTER_TYPE` to `"aks"` to leverage `AKS` as the management cluster.
263
+
- Set `EXP_APISERVER_ILB` to `true` to enable the API Server ILB feature gate.
264
+
- Set `AZURE_CLIENT_ID_USER_ASSIGNED_IDENTITY`, `AZURE_OBJECT_ID_USER_ASSIGNED_IDENTITY` and `AZURE_USER_ASSIGNED_IDENTITY_RESOURCE_ID` to use the user-assigned managed identity instead of the AKS-created managed identity.
265
+
266
+
3. In a new terminal, wait for AzureClusters to be created by the above command. Check it using `kubectl get AzureClusters -A`. Note that this command will fail or will not output anything unless the above command, `GINKGO_FOCUS...`, has deployed the worker template and initiated workload cluster creation.
267
+
268
+
Once the worker cluster has been created, `export` the `CLUSTER_NAME` and `CLUSTER_NAMESPACE`.
269
+
It is recommended that `AZURE_INTERNAL_LB_PRIVATE_IP` is set an IP of `10.0.0.x`, say `10.0.0.101`, to avoid any test updates.
270
+
271
+
Then open a new terminal at the root of the cluster api provider azure repo and run the below command.
272
+
273
+
```bash
274
+
AZURE_INTERNAL_LB_PRIVATE_IP="<IP of your choice>" CLUSTER_NAME="<e2e workload cluster name>" CLUSTER_NAMESPACE="<e2e cluster namespace>" ./scripts/peer-vnets.sh ./tilt-settings.yaml
275
+
```
276
+
277
+
You will see that the test progresses in the first terminal window that invoked `GINKGO_FOCUS=....`
0 commit comments