@@ -32,7 +32,7 @@ This solution introduces three new CRDs that work together with KubeFleet's nati
32323 . ** ClusterStagedWorkloadTracker** (cluster-scoped)
3333 - Defines which workloads to monitor for a ClusterStagedUpdateRun
3434 - The name must match the ClusterStagedUpdateRun name
35- - Specifies namespace, workload name, and expected health status
35+ - Specifies workload's name, namespace and expected health status
3636 - Used by approval-request-controller to determine if stage is ready for approval
3737
38384 . ** StagedWorkloadTracker** (namespaced)
@@ -49,7 +49,7 @@ This solution introduces three new CRDs that work together with KubeFleet's nati
4949 - The ApprovalRequest enters "Pending" state, waiting for approval
5050
51512 . ** Metric Collector Deployment**
52- - Approval-request-controller watches the CAR
52+ - Approval-request-controller watches the ` ClusterApprovalRequest ` , ` ApprovalRequest ` objects
5353 - Creates a ` MetricCollector ` resource on the hub (cluster-scoped)
5454 - Creates a ` ClusterResourceOverride ` with per-cluster customization rules
5555 - Each cluster gets a unique ` reportNamespace ` : ` fleet-member-<cluster-name> `
@@ -127,6 +127,8 @@ cd approval-controller-metric-collector/approval-request-controller
127127kubectl config use-context kind-hub
128128
129129# Register member clusters with the hub
130+ # This creates MemberCluster resources for kind-cluster-1, kind-cluster-2, and kind-cluster-3
131+ # Each MemberCluster resource contains the API endpoint and credentials for the member cluster
130132kubectl apply -f ./examples/membercluster/
131133
132134# Verify clusters are registered
@@ -151,7 +153,12 @@ Create the prometheus namespace and deploy Prometheus for metrics collection:
151153# Create prometheus namespace
152154kubectl create ns prometheus
153155
154- # Deploy Prometheus (ConfigMap, Deployment, Service, RBAC)
156+ # Deploy Prometheus (ConfigMap, Deployment, Service, RBAC, and CRP)
157+ # - ConfigMap: Contains Prometheus scrape configuration
158+ # - Deployment: Runs Prometheus server
159+ # - Service: Exposes Prometheus on port 9090
160+ # - RBAC: ServiceAccount, ClusterRole, and ClusterRoleBinding for pod discovery
161+ # - CRP: ClusterResourcePlacement to propagate Prometheus to all member clusters
155162kubectl apply -f ./examples/prometheus/
156163```
157164
@@ -165,7 +172,9 @@ Create the test namespace and deploy the sample application:
165172# Create test namespace
166173kubectl create ns test-ns
167174
168- # Deploy sample metric app (this will be propagated to member clusters)
175+ # Deploy sample metric app
176+ # This creates a Deployment with a simple Go app that exposes a /metrics endpoint
177+ # The app reports workload_health=1.0 (healthy) by default
169178kubectl apply -f ./examples/sample-metric-app/
170179```
171180
@@ -193,15 +202,19 @@ Apply the appropriate workload tracker based on which type of staged update you'
193202
194203``` bash
195204# Apply ClusterStagedWorkloadTracker
196- # Important: The name must match your ClusterStagedUpdateRun name
205+ # This defines which workloads to monitor for the staged rollout
206+ # The name "example-cluster-staged-run" must match the ClusterStagedUpdateRun name
207+ # Tracks: sample-metric-app in test-ns namespace
197208kubectl apply -f ./examples/workloadtracker/clusterstagedworkloadtracker.yaml
198209```
199210
200211#### For Namespace-Scoped Updates (StagedUpdateRun):
201212
202213``` bash
203214# Apply StagedWorkloadTracker
204- # Important: The name and namespace must match your StagedUpdateRun name and namespace
215+ # This defines which workloads to monitor for the namespace-scoped staged rollout
216+ # The name "example-staged-run" and namespace "test-ns" must match the StagedUpdateRun
217+ # Tracks: sample-metric-app in test-ns namespace
205218kubectl apply -f ./examples/workloadtracker/stagedworkloadtracker.yaml
206219```
207220
@@ -243,9 +256,13 @@ cd ../approval-request-controller
243256kubectl config use-context kind-hub
244257
245258# Apply ClusterStagedUpdateStrategy
259+ # Defines the stages for the rollout: staging (cluster-1) -> prod (cluster-2, cluster-3)
260+ # Each stage requires approval before proceeding
246261kubectl apply -f ./examples/updateRun/example-csus.yaml
247262
248- # Apply ClusterResourcePlacement
263+ # Apply ClusterResourcePlacement for sample-metric-app
264+ # This is the resource that will be updated across stages
265+ # Selects the sample-metric-app deployment in test-ns namespace
249266kubectl apply -f ./examples/updateRun/example-crp.yaml
250267
251268# Verify CRP is created
@@ -261,6 +278,9 @@ prometheus-crp 1 True 1 True 1
261278
262279``` bash
263280# Apply ClusterStagedUpdateRun to start the staged rollout
281+ # This creates the actual update run that progresses through the defined stages
282+ # Name: example-cluster-staged-run (must match ClusterStagedWorkloadTracker)
283+ # References the ClusterResourcePlacement (example-crp) and ClusterStagedUpdateStrategy
264284kubectl apply -f ./examples/updateRun/example-csur.yaml
265285
266286# Check the staged update run status
@@ -286,6 +306,9 @@ kubectl config use-context kind-hub
286306
287307``` bash
288308# Apply namespace-scoped ClusterResourcePlacement
309+ # This CRP is configured to only place resources in the test-ns namespace
310+ # This resource is needed because we cannot propagate Namespace which is a
311+ # cluster-scoped resource via RP
289312kubectl apply -f ./examples/updateRun/example-ns-only-crp.yaml
290313
291314kubectl get crp -A
@@ -295,15 +318,18 @@ Output:
295318``` bash
296319NAME GEN SCHEDULED SCHEDULED-GEN AVAILABLE AVAILABLE-GEN AGE
297320ns-only-crp 1 True 1 True 1 5s
298- proemetheus -crp 1 True 1 True 1 2m34s
321+ prometheus -crp 1 True 1 True 1 2m34s
299322```
300323
301324``` bash
302- # Apply StagedUpdateStrategy
325+ # Apply StagedUpdateStrategy (namespace-scoped)
326+ # Defines the stages: staging (cluster-1) -> prod (cluster-2, cluster-3)
327+ # Each stage requires approval before proceeding
303328kubectl apply -f ./examples/updateRun/example-sus.yaml
304329
305- ` ` ` bash
306- # Apply ResourcePlacement
330+ # Apply ResourcePlacement (namespace-scoped)
331+ # This is the namespace-scoped version that works with the test-ns namespace
332+ # References the ns-only-crp ClusterResourcePlacement
307333kubectl apply -f ./examples/updateRun/example-rp.yaml
308334
309335# Verify RP is created
@@ -317,7 +343,11 @@ test-ns example-rp 1 True 1
317343```
318344
319345``` bash
320- # Apply StagedUpdateRun to start the staged rollout
346+ # Apply StagedUpdateRun to start the staged rollout (namespace-scoped)
347+ # This creates the actual update run that progresses through the defined stages
348+ # Name: example-staged-run (must match StagedWorkloadTracker)
349+ # Namespace: test-ns (must match StagedWorkloadTracker namespace)
350+ # References the ResourcePlacement (example-rp)
321351kubectl apply -f ./examples/updateRun/example-sur.yaml
322352
323353# Check the staged update run status
@@ -389,13 +419,6 @@ fleet-member-kind-cluster-1 mc-example-staged-run-staging 1 27s
389419```
390420
391421The approval controller will automatically approve stages when the metric collectors report that workloads are healthy.
392- 1. Builds the ` metric-collector:latest` image
393- 2. Builds the ` metric-app:local` image
394- 3. Loads both images into each kind cluster
395- 4. Creates hub token secret with proper RBAC
396- 5. Installs the metric-collector via Helm
397-
398- 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.
399422
400423## Verification
401424
0 commit comments