Skip to content

Commit e4f8936

Browse files
author
Arvind Thirumurugan
committed
update README
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
1 parent dc873f2 commit e4f8936

File tree

1 file changed

+107
-24
lines changed
  • approval-controller-metric-collector

1 file changed

+107
-24
lines changed

approval-controller-metric-collector/README.md

Lines changed: 107 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,15 @@ The script performs the following for each member cluster:
203203
4. Creates hub token secret with proper RBAC
204204
5. Installs the metric-collector via Helm
205205

206-
The `metric-app:local` image is pre-loaded so it's available when you propagate the sample-metric-app deployment from hub to member clusters.
206+
The `metric-app:local` image is loaded so it's available when you propagate the sample-metric-app deployment from hub to member clusters.
207207

208208
### 8. Create Staged Update
209209

210-
Switch back to hub cluster and create a staged update run:
210+
You can create staged updates using either cluster-scoped or namespace-scoped resources:
211+
212+
#### Option A: Cluster-Scoped Staged Update (ClusterStagedUpdateRun)
213+
214+
Switch back to hub cluster and create a cluster-scoped staged update run:
211215

212216
```bash
213217
# Switch to hub cluster
@@ -220,63 +224,156 @@ kubectl apply -f ./examples/updateRun/example-csus.yaml
220224

221225
# Apply ClusterResourcePlacement
222226
kubectl apply -f ./examples/updateRun/example-crp.yaml
223-
```
224227

225-
```bash
226228
# Verify CRP is created
227229
kubectl get crp -A
228230
```
229231

232+
Output:
230233
```bash
231234
NAME GEN SCHEDULED SCHEDULED-GEN AVAILABLE AVAILABLE-GEN AGE
232235
example-crp 1 True 1 4s
233-
proemetheus-crp 1 True 1 True 1 3m1s
236+
prometheus-crp 1 True 1 True 1 3m1s
234237
```
235238

236239
```bash
237240
# Apply ClusterStagedUpdateRun to start the staged rollout
238241
kubectl apply -f ./examples/updateRun/example-csur.yaml
239242

240-
```bashubec
241243
# Check the staged update run status
242244
kubectl get csur -A
243245
```
244246

247+
Output:
245248
```bash
246249
NAME PLACEMENT RESOURCE-SNAPSHOT-INDEX POLICY-SNAPSHOT-INDEX INITIALIZED PROGRESSING SUCCEEDED AGE
247250
example-cluster-staged-run example-crp 0 0 True True 5s
248251
```
249252

253+
#### Option B: Namespace-Scoped Staged Update (StagedUpdateRun)
254+
255+
Alternatively, you can use namespace-scoped resources:
256+
257+
```bash
258+
# Switch to hub cluster
259+
kubectl config use-context kind-hub
260+
261+
cd ../approval-request-controller
262+
```
263+
264+
``` bash
265+
# Apply namespace-scoped ClusterResourcePlacement
266+
kubectl apply -f ./examples/updateRun/example-ns-only-crp.yaml
267+
268+
kubectl get crp -A
269+
```
270+
271+
Output:
272+
```bash
273+
NAME GEN SCHEDULED SCHEDULED-GEN AVAILABLE AVAILABLE-GEN AGE
274+
ns-only-crp 1 True 1 True 1 5s
275+
proemetheus-crp 1 True 1 True 1 2m34s
276+
```
277+
278+
```bash
279+
# Apply StagedUpdateStrategy
280+
kubectl apply -f ./examples/updateRun/example-sus.yaml
281+
282+
# Verify SUS is created
283+
kubectl get sus -A
284+
```
285+
286+
Output:
287+
```bash
288+
NAMESPACE NAME AGE
289+
test-ns example-staged-strategy 4s
290+
```
291+
292+
```bash
293+
# Apply ResourcePlacement
294+
kubectl apply -f ./examples/updateRun/example-rp.yaml
295+
296+
# Verify RP is created
297+
kubectl get rp -A
298+
```
299+
300+
Output:
301+
```bash
302+
NAMESPACE NAME GEN SCHEDULED SCHEDULED-GEN AVAILABLE AVAILABLE-GEN AGE
303+
test-ns example-rp 1 True 1 35s
304+
```
305+
306+
```bash
307+
# Apply StagedUpdateRun to start the staged rollout
308+
kubectl apply -f ./examples/updateRun/example-sur.yaml
309+
310+
# Check the staged update run status
311+
kubectl get sur -A
312+
```
313+
314+
Output:
315+
```bash
316+
NAMESPACE NAME PLACEMENT RESOURCE-SNAPSHOT-INDEX POLICY-SNAPSHOT-INDEX INITIALIZED PROGRESSING SUCCEEDED AGE
317+
test-ns example-staged-run example-rp 0 0 True True 5s
318+
```
319+
250320
### 9. Monitor the Staged Rollout
251321

252322
Watch the staged update progress:
253323

324+
#### For Cluster-Scoped Updates:
325+
254326
```bash
255327
# Check the staged update run status
256328
kubectl get csur -A
257-
```
258329

259-
```bash
260330
# Check approval requests (should be auto-approved based on metrics)
261331
kubectl get clusterapprovalrequest -A
262332
```
263333

334+
Output:
264335
```bash
265336
NAME UPDATE-RUN STAGE APPROVED AGE
266-
example-cluster-staged-run-after-prod example-cluster-staged-run prod True 2m9s
337+
example-cluster-staged-run-after-staging example-cluster-staged-run staging True 2m9s
267338
```
268339

269340
```bash
270341
# Check metric collector reports
271342
kubectl get metriccollectorreport -A
272343
```
273344

345+
Output:
274346
```bash
275347
NAMESPACE NAME WORKLOADS LAST-COLLECTION AGE
276348
fleet-member-kind-cluster-1 mc-example-cluster-staged-run-staging 1 27s 2m57s
277349
```
278350

279-
Eventually all the approval requests are approved for the updateRun.
351+
#### For Namespace-Scoped Updates:
352+
353+
```bash
354+
# Check the staged update run status
355+
kubectl get sur -A
356+
357+
# Check approval requests (should be auto-approved based on metrics)
358+
kubectl get approvalrequest -A
359+
```
360+
361+
Output:
362+
```bash
363+
NAMESPACE NAME UPDATE-RUN STAGE APPROVED AGE
364+
test-ns example-staged-run-after-staging example-staged-run staging True 64s
365+
```
366+
367+
```bash
368+
# Check metric collector reports
369+
kubectl get metriccollectorreport -A
370+
```
371+
372+
Output:
373+
```bash
374+
NAMESPACE NAME WORKLOADS LAST-COLLECTION AGE
375+
fleet-member-kind-cluster-1 mc-example-staged-run-staging 1 27s 57s
376+
```
280377

281378
The approval controller will automatically approve stages when the metric collectors report that workloads are healthy.
282379
1. Builds the `metric-collector:latest` image
@@ -319,20 +416,6 @@ kubectl config use-context kind-hub
319416
kubectl get metriccollectorreport -A
320417
```
321418

322-
### Monitor Staged Update Progress
323-
324-
Watch the approval process:
325-
```bash
326-
# Watch staged update run status
327-
kubectl get csur -A -w
328-
329-
# Check cluster approval requests
330-
kubectl get clusterapprovalrequest -A
331-
332-
# View approval request details
333-
kubectl describe clusterapprovalrequest <approval-request-name>
334-
```
335-
336419
## Configuration
337420

338421
### Approval Request Controller

0 commit comments

Comments
 (0)