Skip to content

Commit 89b354a

Browse files
authored
Merge pull request #2666 from nojnhuh/tilt-settings-yaml
read tilt-settings.yaml
2 parents d28ff9a + a13acb2 commit 89b354a

File tree

6 files changed

+102
-122
lines changed

6 files changed

+102
-122
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ bazel-*
5656
.tiltbuild
5757
/tilt.d
5858
tilt-settings.json
59+
tilt-settings.yaml
5960
tilt_config.json
6061

6162
# e2e output

Tiltfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ settings = {
2828
keys = ["AZURE_SUBSCRIPTION_ID", "AZURE_TENANT_ID", "AZURE_CLIENT_SECRET", "AZURE_CLIENT_ID"]
2929

3030
# global settings
31-
settings.update(read_json(
32-
"tilt-settings.json",
31+
tilt_file = "./tilt-settings.yaml" if os.path.exists("./tilt-settings.yaml") else "./tilt-settings.json"
32+
settings.update(read_yaml(
33+
tilt_file,
3334
default = {},
3435
))
3536

docs/book/src/developers/development.md

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,15 @@ development will span both CAPZ and CAPI, then follow the [CAPI and CAPZ instruc
148148

149149
If you want to develop in CAPZ and get a local development cluster working quickly, this is the path for you.
150150

151-
From the root of the CAPZ repository and after configuring the environment variables, you can run the following to generate your `tilt-settings.json` file:
151+
From the root of the CAPZ repository and after configuring the environment variables, you can run the following to generate your `tilt-settings.yaml` file:
152152

153153
```shell
154-
cat <<EOF > tilt-settings.json
155-
{
156-
"kustomize_substitutions": {
157-
"AZURE_SUBSCRIPTION_ID_B64": "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')",
158-
"AZURE_TENANT_ID_B64": "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')",
159-
"AZURE_CLIENT_SECRET_B64": "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')",
160-
"AZURE_CLIENT_ID_B64": "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
161-
}
162-
}
154+
cat <<EOF > tilt-settings.yaml
155+
kustomize_substitutions:
156+
AZURE_SUBSCRIPTION_ID_B64: "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')"
157+
AZURE_TENANT_ID_B64: "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
158+
AZURE_CLIENT_SECRET_B64: "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')"
159+
AZURE_CLIENT_ID_B64: "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
163160
EOF
164161
```
165162

@@ -187,7 +184,7 @@ To use [Tilt](https://tilt.dev/) for a simplified development workflow, follow t
187184

188185
> you may wish to checkout out the correct version of CAPI to match the [version used in CAPZ][go.mod]
189186
190-
Note that `tilt up` will be run from the `cluster-api repository` directory and the `tilt-settings.json` file will point back to the `cluster-api-provider-azure` repository directory. Any changes you make to the source code in `cluster-api` or `cluster-api-provider-azure` repositories will automatically redeployed to the `kind` cluster.
187+
Note that `tilt up` will be run from the `cluster-api repository` directory and the `tilt-settings.yaml` file will point back to the `cluster-api-provider-azure` repository directory. Any changes you make to the source code in `cluster-api` or `cluster-api-provider-azure` repositories will automatically redeployed to the `kind` cluster.
191188

192189
After you have cloned both repositories, your folder structure should look like:
193190

@@ -196,21 +193,23 @@ After you have cloned both repositories, your folder structure should look like:
196193
|-- src/cluster-api (run `tilt up` here)
197194
```
198195

199-
After configuring the environment variables, run the following to generate your `tilt-settings.json` file:
196+
After configuring the environment variables, run the following to generate your `tilt-settings.yaml` file:
200197

201198
```shell
202-
cat <<EOF > tilt-settings.json
203-
{
204-
"default_registry": "${REGISTRY}",
205-
"provider_repos": ["../cluster-api-provider-azure"],
206-
"enable_providers": ["azure", "docker", "kubeadm-bootstrap", "kubeadm-control-plane"],
207-
"kustomize_substitutions": {
208-
"AZURE_SUBSCRIPTION_ID_B64": "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')",
209-
"AZURE_TENANT_ID_B64": "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')",
210-
"AZURE_CLIENT_SECRET_B64": "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')",
211-
"AZURE_CLIENT_ID_B64": "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
212-
}
213-
}
199+
cat <<EOF > tilt-settings.yaml
200+
default_registry: "${REGISTRY}"
201+
provider_repos:
202+
- ../cluster-api-provider-azure
203+
enable_providers:
204+
- azure
205+
- docker
206+
- kubeadm-bootstrap
207+
- kubeadm-control-plane
208+
kustomize_substitutions:
209+
AZURE_SUBSCRIPTION_ID_B64: "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')"
210+
AZURE_TENANT_ID_B64: "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
211+
AZURE_CLIENT_SECRET_B64: "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')"
212+
AZURE_CLIENT_ID_B64: "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
214213
EOF
215214
```
216215

@@ -270,26 +269,26 @@ To view cluster resources using the [Cluster API Visualizer](https://github.com/
270269

271270
#### Debugging
272271

273-
You can debug CAPZ (or another provider / core CAPI) by running the controllers with delve. When developing using Tilt this is easily done by using the **debug** configuration section in your **tilt-settings.json** file. For example:
274-
275-
```json
276-
{
277-
"default_registry": "${REGISTRY}",
278-
"provider_repos": ["../cluster-api-provider-azure"],
279-
"enable_providers": ["azure", "kubeadm-bootstrap", "kubeadm-control-plane"],
280-
"kustomize_substitutions": {
281-
"AZURE_SUBSCRIPTION_ID_B64": "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')",
282-
"AZURE_TENANT_ID_B64": "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')",
283-
"AZURE_CLIENT_SECRET_B64": "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')",
284-
"AZURE_CLIENT_ID_B64": "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
285-
},
286-
"debug": {
287-
"azure": {
288-
"continue": true,
289-
"port": 30000
290-
}
291-
}
292-
}
272+
You can debug CAPZ (or another provider / core CAPI) by running the controllers with delve. When developing using Tilt this is easily done by using the **debug** configuration section in your **tilt-settings.yaml** file. For example:
273+
274+
```yaml
275+
default_registry: "${REGISTRY}"
276+
provider_repos:
277+
- ../cluster-api-provider-azure
278+
enable_providers:
279+
- azure
280+
- docker
281+
- kubeadm-bootstrap
282+
- kubeadm-control-plane
283+
kustomize_substitutions:
284+
AZURE_SUBSCRIPTION_ID_B64: "$(echo "${AZURE_SUBSCRIPTION_ID}" | tr -d '\n' | base64 | tr -d '\n')"
285+
AZURE_TENANT_ID_B64: "$(echo "${AZURE_TENANT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
286+
AZURE_CLIENT_SECRET_B64: "$(echo "${AZURE_CLIENT_SECRET}" | tr -d '\n' | base64 | tr -d '\n')"
287+
AZURE_CLIENT_ID_B64: "$(echo "${AZURE_CLIENT_ID}" | tr -d '\n' | base64 | tr -d '\n')"
288+
debug:
289+
azure:
290+
continue: true
291+
port: 30000
293292
```
294293
295294
> Note you can list multiple controllers or **core** CAPI and expose metrics as well in the debug section. Full details of the options can be seen [here](https://cluster-api.sigs.k8s.io/developer/tilt.html).

hack/observability/opentelemetry/readme.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ for "Instrumentation Key".
3232
![Instrumentation Key](assets/portal_instrumentation_key.png)
3333

3434
Paste the Instrumentation Key from the portal as `AZURE_INSTRUMENTATION_KEY`
35-
in `tilt-settings.json`:
36-
37-
```json
38-
{
39-
"kustomize_substitutions": {
40-
"AZURE_INSTRUMENTATION_KEY": "12345678-1234-1234-1234-1234567890abc"
41-
}
42-
}
35+
in `tilt-settings.yaml`:
36+
37+
```yaml
38+
kustomize_substitutions:
39+
AZURE_INSTRUMENTATION_KEY: "12345678-1234-1234-1234-1234567890abc"
4340
```
4441
4542
Once your management cluster is up, search for recent traces on the "Transaction search" page.

hack/observability/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ the screen.
1919

2020
To access traces in
2121
[Application Insights](https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview),
22-
specify an `AZURE_INSTRUMENTATION_KEY` in your `tilt-settings.json`, then navigate to the
22+
specify an `AZURE_INSTRUMENTATION_KEY` in your `tilt-settings.yaml`, then navigate to the
2323
App Insights resource in the Azure Portal and choose "Transaction search" to query for traces. See
2424
the tracing docs for more detail.
2525

templates/flavors/README.md

Lines changed: 49 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,88 +22,70 @@ To generate all CAPZ flavors, run `make generate-flavors`.
2222
Tilt will auto-detect all available flavors from the `templates` directory.
2323

2424
#### Requirements
25-
Please note your tilt-settings.json must contain at minimum the following fields when using tilt resources to deploy cluster flavors:
26-
```json
27-
{
28-
"kustomize_substitutions": {
29-
"AZURE_SUBSCRIPTION_ID": "******",
30-
"AZURE_TENANT_ID": "******",
31-
"AZURE_CLIENT_SECRET": "******",
32-
"AZURE_CLIENT_ID": "******"
33-
}
34-
}
25+
Please note your tilt-settings.yaml must contain at minimum the following fields when using tilt resources to deploy cluster flavors:
26+
```yaml
27+
kustomize_substitutions:
28+
AZURE_SUBSCRIPTION_ID: "******"
29+
AZURE_TENANT_ID: "******"
30+
AZURE_CLIENT_SECRET: "******"
31+
AZURE_CLIENT_ID: "******"
3532
```
36-
After updating tilt-settings.json, follow these two steps to deploy a workload cluster:
33+
After updating tilt-settings.yaml, follow these two steps to deploy a workload cluster:
3734
38-
1. Run ``make tilt up`` in the root of cluster-api-provider-azure repo. Note that the tilt-settings.json also resides here in the
35+
1. Run ``make tilt up`` in the root of cluster-api-provider-azure repo. Note that the tilt-settings.yaml also resides here in the
3936
root of this repo. After tilt has initialized, press `space` to open the tilt web UI in a browser. See the following example:
4037
![plot](../../docs/book/theme/tilt-up.png)
4138
2. Once your browser is open, click the clockwise arrow icon ⟳ on a resource listed. For example, `default` to deploy a default flavor.
4239
![plot](../../docs/book/theme/flavour-deploy-from-ui.png)
4340
#### Defining Variable Overrides
44-
If you wish to override the default variables for flavor workers, you can specify them as part of your tilt-settings.json as seen in the example below. Please note, the precedence of variables is as follows:
41+
If you wish to override the default variables for flavor workers, you can specify them as part of your tilt-settings.yaml as seen in the example below. Please note, the precedence of variables is as follows:
4542

4643
1. explicitly defined vars for each flavor i.e. worker-templates.flavors[0].AZURE_VNET_NAME
4744
2. vars defined at 'metadata' level-- spans workers i.e. metadata.AZURE_VNET_NAME
4845
3. programmatically defined default vars i.e. everything except azure tenant, client, subscription
4946

5047

51-
```json
52-
{
53-
"kustomize_substitutions": {
54-
"AZURE_SUBSCRIPTION_ID": "****",
55-
"AZURE_TENANT_ID": "****",
56-
"AZURE_CLIENT_SECRET": "****",
57-
"AZURE_CLIENT_ID": "****"
58-
},
59-
"worker-templates": {
60-
"flavors": {
61-
"default": {
62-
"CLUSTER_NAME": "example-default-cluster-name",
63-
"AZURE_VNET_NAME": "example-vnet-one"
64-
},
65-
"system-assigned-identity": {
66-
"CLUSTER_NAME": "example-SAI-cluster-name",
67-
"AZURE_LOCATION": "westus",
68-
"AZURE_VNET_NAME": "example-vnet-two"
69-
}
70-
},
71-
"metadata": {
72-
"AZURE_LOCATION": "eastus",
73-
"AZURE_RESOURCE_GROUP": "test-resource-group-name",
74-
"CONTROL_PLANE_MACHINE_COUNT": "1",
75-
"KUBERNETES_VERSION": "v1.22.1",
76-
"AZURE_CONTROL_PLANE_MACHINE_TYPE": "Standard_D2s_v3",
77-
"WORKER_MACHINE_COUNT": "2",
78-
"AZURE_NODE_MACHINE_TYPE": "Standard_D2s_v3"
79-
}
80-
}
81-
}
48+
```yaml
49+
kustomize_substitutions:
50+
AZURE_SUBSCRIPTION_ID: "****"
51+
AZURE_TENANT_ID: "****"
52+
AZURE_CLIENT_SECRET: "****"
53+
AZURE_CLIENT_ID: "****"
54+
worker-templates:
55+
flavors:
56+
default:
57+
CLUSTER_NAME: example-default-cluster-name
58+
AZURE_VNET_NAME: example-vnet-one
59+
system-assigned-identity:
60+
CLUSTER_NAME: example-SAI-cluster-name
61+
AZURE_LOCATION: westus
62+
AZURE_VNET_NAME: example-vnet-two
63+
metadata:
64+
AZURE_LOCATION: eastus
65+
AZURE_RESOURCE_GROUP: test-resource-group-name
66+
CONTROL_PLANE_MACHINE_COUNT: "1"
67+
KUBERNETES_VERSION: v1.22.1
68+
AZURE_CONTROL_PLANE_MACHINE_TYPE: Standard_D2s_v3
69+
WORKER_MACHINE_COUNT: "2"
70+
AZURE_NODE_MACHINE_TYPE: Standard_D2s_v3
8271
```
8372

8473
Here is a practical example: creating a GPU-enabled cluster requires N-series nodes. You can set an
85-
N-series node type just for the `nvidia-gpu` flavor in `tilt-settings.json` to override any default:
74+
N-series node type just for the `nvidia-gpu` flavor in `tilt-settings.yaml` to override any default:
8675

87-
```json
88-
{
89-
"kustomize_substitutions": {
90-
"AZURE_SUBSCRIPTION_ID": "****",
91-
"AZURE_TENANT_ID": "****",
92-
"AZURE_CLIENT_SECRET": "****",
93-
"AZURE_CLIENT_ID": "****"
94-
},
95-
"worker-templates": {
96-
"flavors": {
97-
"nvidia-gpu": {
98-
"AZURE_NODE_MACHINE_TYPE": "Standard_NC6s_v3"
99-
}
100-
},
101-
"metadata": {
102-
"AZURE_CONTROL_PLANE_MACHINE_TYPE": "Standard_D2s_v3",
103-
"AZURE_LOCATION": "southcentralus",
104-
"KUBERNETES_VERSION": "v1.22.1",
105-
"WORKER_MACHINE_COUNT": "1"
106-
}
107-
}
108-
}
76+
```yaml
77+
kustomize_substitutions:
78+
AZURE_SUBSCRIPTION_ID: "****"
79+
AZURE_TENANT_ID: "****"
80+
AZURE_CLIENT_SECRET: "****"
81+
AZURE_CLIENT_ID: "****"
82+
worker-templates:
83+
flavors:
84+
nvidia-gpu:
85+
AZURE_NODE_MACHINE_TYPE: Standard_NC6s_v3
86+
metadata:
87+
AZURE_CONTROL_PLANE_MACHINE_TYPE: Standard_D2s_v3
88+
AZURE_LOCATION: southcentralus
89+
KUBERNETES_VERSION: v1.22.1
90+
WORKER_MACHINE_COUNT: "1"
10991
```

0 commit comments

Comments
 (0)