Skip to content

Commit 3cb2de9

Browse files
jamyctbritaniar
andauthored
docs: Improve tutorial (#947)
Co-authored-by: Britania Rodriguez Reyes <[email protected]>
1 parent d75bd45 commit 3cb2de9

File tree

5 files changed

+94
-3
lines changed

5 files changed

+94
-3
lines changed

docs/tutorials/MigrationWithOverrideDR.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Due to a sudden increase in traffic and resource demands in your WestUS clusters
1515
The following resources are currently deployed in the WestUS clusters:
1616

1717
#### Service
18+
19+
> Note: Service test file located [here](./testfiles/nginx-service.yaml).
20+
1821
```yaml
1922
apiVersion: v1
2023
kind: Service
@@ -36,6 +39,9 @@ Summary:
3639
- It targets pods with the label app: nginx and forwards traffic to port 80 on the pods.
3740

3841
#### Deployment
42+
43+
> Note: Deployment test file located [here](./testfiles/nginx-deployment.yaml).
44+
3945
```yaml
4046
apiVersion: apps/v1
4147
kind: Deployment
@@ -67,6 +73,9 @@ Summary:
6773
- The pods are labeled with `app: nginx` and expose port 80.
6874

6975
#### ClusterResourcePlacement
76+
77+
> Note: CRP Availability test file located [here](./testfiles/crp-availability.yaml)
78+
7079
```yaml
7180
apiVersion: placement.kubernetes-fleet.io/v1
7281
kind: ClusterResourcePlacement
@@ -261,6 +270,9 @@ When the clusters in WestUS are nearing capacity limits and risk becoming overlo
261270
For this tutorial, we will move them to WestEurope.
262271

263272
## Create Resource Override
273+
274+
> Note: Cluster resource override test file located [here](./testfiles/ro-1.yaml)
275+
264276
To scale up during migration, apply this override before updating crp:
265277
```yaml
266278
apiVersion: placement.kubernetes-fleet.io/v1alpha1
@@ -318,13 +330,13 @@ spec:
318330
strategy:
319331
type: RollingUpdate
320332
```
321-
Update the `crp.yaml` to reflect selecting clusters with higher node-count and apply it:
333+
Update the [`crp-availability.yaml`](./testfiles/crp-availability.yaml) to reflect selecting clusters with higher node-count and apply it:
322334
```bash
323-
kubectl apply -f crp.yaml
335+
kubectl apply -f crp-availability.yaml
324336
```
325337

326338
### Results
327-
After applying the updated `crp.yaml`, the Fleet will schedule the application on the available clusters in WestEurope as they each have 3 nodes.
339+
After applying the updated [`crp-availability.yaml`](./testfiles/crp-availability.yaml), the Fleet will schedule the application on the available clusters in WestEurope as they each have 3 nodes.
328340
You can check the status of the CRP to ensure that the application has been successfully migrated and is running in the new region:
329341
```bash
330342
kubectl get crp crp-availability -o yaml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: placement.kubernetes-fleet.io/v1
2+
kind: ClusterResourcePlacement
3+
metadata:
4+
name: crp-availability
5+
spec:
6+
policy:
7+
affinity:
8+
clusterAffinity:
9+
requiredDuringSchedulingIgnoredDuringExecution:
10+
clusterSelectorTerms:
11+
- labelSelector:
12+
matchLabels:
13+
fleet.azure.com/location: westus
14+
numberOfClusters: 2
15+
placementType: PickN
16+
resourceSelectors:
17+
- group: ""
18+
kind: Namespace
19+
name: test-app
20+
version: v1
21+
revisionHistoryLimit: 10
22+
strategy:
23+
type: RollingUpdate
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: nginx-deployment
5+
namespace: test-app
6+
spec:
7+
selector:
8+
matchLabels:
9+
app: nginx
10+
replicas: 2
11+
template:
12+
metadata:
13+
labels:
14+
app: nginx
15+
spec:
16+
containers:
17+
- name: nginx
18+
image: nginx:1.16.1
19+
ports:
20+
- containerPort: 80
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: nginx-service
5+
namespace: test-app
6+
spec:
7+
selector:
8+
app: nginx
9+
ports:
10+
- protocol: TCP
11+
port: 80
12+
targetPort: 80
13+
type: LoadBalancer

docs/tutorials/testfiles/ro-1.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: placement.kubernetes-fleet.io/v1alpha1
2+
kind: ResourceOverride
3+
metadata:
4+
name: ro-1
5+
namespace: test-app
6+
spec:
7+
resourceSelectors:
8+
- group: apps
9+
kind: Deployment
10+
version: v1
11+
name: nginx-deployment
12+
policy:
13+
overrideRules:
14+
- clusterSelector:
15+
clusterSelectorTerms:
16+
- labelSelector:
17+
matchLabels:
18+
fleet.azure.com/location: westeurope
19+
jsonPatchOverrides:
20+
- op: replace
21+
path: /spec/replicas
22+
value:
23+
4

0 commit comments

Comments
 (0)