Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve tutorial #947

Merged
merged 23 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
162d325
move interfaces.go from interfaces to authtoken/providers directory a…
jamyct Oct 28, 2024
19ad9c2
Edit comments
jamyct Oct 28, 2024
78d0797
Rename structs, add periods to comments and update AuthToken comment
jamyct Oct 28, 2024
d989f31
remove pkg/interfaces to be copied from go source
jamyct Oct 28, 2024
f88c62e
Ran goimports -w on files in pkg/authtoken/providers/ directory
jamyct Oct 28, 2024
dee5042
Elaborate commenting for documentation
jamyct Oct 28, 2024
b7bfee7
Reorder imports by moving fleet pkgs to the bottom
jamyct Oct 28, 2024
10c7119
add test files
jamyct Nov 8, 2024
fd2e413
fix instructions to use crp-availability.yaml instead of crp.yaml
jamyct Nov 8, 2024
8382017
Merge branch 'main' into improve-tutorial
jamyct Nov 8, 2024
475a773
Add links to test files in tutorial
jamyct Nov 8, 2024
8bb76ac
Merge branch 'improve-tutorial' of github.com:jamyct/fleet into impro…
jamyct Nov 8, 2024
ceb1b92
add links to created test files where referenced in tutorial
jamyct Nov 8, 2024
c86070d
fix hyperlinks
jamyct Nov 8, 2024
cfd87ba
re-fix hyperlinks
jamyct Nov 8, 2024
394ce7c
re-fix hyperlinks
jamyct Nov 8, 2024
ca04ebb
re-fix hyperlinks directory spelling
jamyct Nov 8, 2024
0af9dee
Update docs/tutorials/MigrationWithOverrideDR.md
jamyct Nov 8, 2024
51db268
Update docs/tutorials/MigrationWithOverrideDR.md
jamyct Nov 8, 2024
fc88007
Update docs/tutorials/MigrationWithOverrideDR.md
jamyct Nov 8, 2024
9cf4699
use original crp
jamyct Nov 8, 2024
6e693b4
Merge branch 'improve-tutorial' of github.com:jamyct/fleet into impro…
jamyct Nov 8, 2024
ab28161
Add CR Override link and add extra lines at end of yaml files
jamyct Nov 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions docs/tutorials/MigrationWithOverrideDR.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Due to a sudden increase in traffic and resource demands in your WestUS clusters
The following resources are currently deployed in the WestUS clusters:

#### Service

> Note: Service test file located [here](./testfiles/nginx-service.yaml).

```yaml
apiVersion: v1
kind: Service
Expand All @@ -36,6 +39,9 @@ Summary:
- It targets pods with the label app: nginx and forwards traffic to port 80 on the pods.

#### Deployment

> Note: Deployment test file located [here](./testfiles/nginx-deployment.yaml).

```yaml
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -67,6 +73,9 @@ Summary:
- The pods are labeled with `app: nginx` and expose port 80.

#### ClusterResourcePlacement

> Note: CRP Availability test file located [here](./testfiles/crp-availability.yaml)

```yaml
apiVersion: placement.kubernetes-fleet.io/v1
kind: ClusterResourcePlacement
Expand Down Expand Up @@ -261,6 +270,9 @@ When the clusters in WestUS are nearing capacity limits and risk becoming overlo
For this tutorial, we will move them to WestEurope.

## Create Resource Override

> Note: Cluster resource override test file located [here](./testfiles/ro-1.yaml)

To scale up during migration, apply this override before updating crp:
```yaml
apiVersion: placement.kubernetes-fleet.io/v1alpha1
Expand Down Expand Up @@ -318,13 +330,13 @@ spec:
strategy:
type: RollingUpdate
```
Update the `crp.yaml` to reflect selecting clusters with higher node-count and apply it:
Update the [`crp-availability.yaml`](./testfiles/crp-availability.yaml) to reflect selecting clusters with higher node-count and apply it:
```bash
kubectl apply -f crp.yaml
kubectl apply -f crp-availability.yaml
```

### Results
After applying the updated `crp.yaml`, the Fleet will schedule the application on the available clusters in WestEurope as they each have 3 nodes.
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.
You can check the status of the CRP to ensure that the application has been successfully migrated and is running in the new region:
```bash
kubectl get crp crp-availability -o yaml
Expand Down
23 changes: 23 additions & 0 deletions docs/tutorials/testfiles/crp-availability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: placement.kubernetes-fleet.io/v1
kind: ClusterResourcePlacement
metadata:
name: crp-availability
spec:
policy:
affinity:
clusterAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
clusterSelectorTerms:
- labelSelector:
matchLabels:
fleet.azure.com/location: westus
numberOfClusters: 2
placementType: PickN
resourceSelectors:
- group: ""
kind: Namespace
name: test-app
version: v1
revisionHistoryLimit: 10
strategy:
type: RollingUpdate
20 changes: 20 additions & 0 deletions docs/tutorials/testfiles/nginx-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: test-app
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.16.1
ports:
- containerPort: 80
13 changes: 13 additions & 0 deletions docs/tutorials/testfiles/nginx-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: test-app
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
23 changes: 23 additions & 0 deletions docs/tutorials/testfiles/ro-1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: placement.kubernetes-fleet.io/v1alpha1
kind: ResourceOverride
metadata:
name: ro-1
namespace: test-app
spec:
resourceSelectors:
- group: apps
kind: Deployment
version: v1
name: nginx-deployment
policy:
overrideRules:
- clusterSelector:
clusterSelectorTerms:
- labelSelector:
matchLabels:
fleet.azure.com/location: westeurope
jsonPatchOverrides:
- op: replace
path: /spec/replicas
value:
4