Skip to content

Commit 0604dcf

Browse files
author
Arvind Thirumurugan
committed
improve README
Signed-off-by: Arvind Thirumurugan <arvindth@microsoft.com>
1 parent dda210a commit 0604dcf

File tree

1 file changed

+39
-8
lines changed
  • approval-controller-metric-collector

1 file changed

+39
-8
lines changed

approval-controller-metric-collector/README.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ cd approval-controller-metric-collector/approval-request-controller
127127
kubectl 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
130132
kubectl 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
152154
kubectl 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
155162
kubectl apply -f ./examples/prometheus/
156163
```
157164

@@ -165,7 +172,10 @@ Create the test namespace and deploy the sample application:
165172
# Create test namespace
166173
kubectl 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
178+
# Includes annotations for Prometheus scraping: prometheus.io/scrape: "true"
169179
kubectl apply -f ./examples/sample-metric-app/
170180
```
171181

@@ -193,15 +203,19 @@ Apply the appropriate workload tracker based on which type of staged update you'
193203

194204
```bash
195205
# Apply ClusterStagedWorkloadTracker
196-
# Important: The name must match your ClusterStagedUpdateRun name
206+
# This defines which workloads to monitor for the staged rollout
207+
# The name "example-cluster-staged-run" must match the ClusterStagedUpdateRun name
208+
# Tracks: sample-metric-app in test-ns namespace
197209
kubectl apply -f ./examples/workloadtracker/clusterstagedworkloadtracker.yaml
198210
```
199211

200212
#### For Namespace-Scoped Updates (StagedUpdateRun):
201213

202214
```bash
203215
# Apply StagedWorkloadTracker
204-
# Important: The name and namespace must match your StagedUpdateRun name and namespace
216+
# This defines which workloads to monitor for the namespace-scoped staged rollout
217+
# The name "example-staged-run" and namespace "test-ns" must match the StagedUpdateRun
218+
# Tracks: sample-metric-app in test-ns namespace
205219
kubectl apply -f ./examples/workloadtracker/stagedworkloadtracker.yaml
206220
```
207221

@@ -243,9 +257,13 @@ cd ../approval-request-controller
243257
kubectl config use-context kind-hub
244258

245259
# Apply ClusterStagedUpdateStrategy
260+
# Defines the stages for the rollout: staging (cluster-1) -> prod (cluster-2, cluster-3)
261+
# Each stage requires approval before proceeding
246262
kubectl apply -f ./examples/updateRun/example-csus.yaml
247263

248-
# Apply ClusterResourcePlacement
264+
# Apply ClusterResourcePlacement for sample-metric-app
265+
# This is the resource that will be updated across stages
266+
# Selects the sample-metric-app deployment in test-ns namespace
249267
kubectl apply -f ./examples/updateRun/example-crp.yaml
250268

251269
# Verify CRP is created
@@ -261,6 +279,9 @@ prometheus-crp 1 True 1 True 1
261279

262280
```bash
263281
# Apply ClusterStagedUpdateRun to start the staged rollout
282+
# This creates the actual update run that progresses through the defined stages
283+
# Name: example-cluster-staged-run (must match ClusterStagedWorkloadTracker)
284+
# References the ClusterResourcePlacement (example-crp) and ClusterStagedUpdateStrategy
264285
kubectl apply -f ./examples/updateRun/example-csur.yaml
265286

266287
# Check the staged update run status
@@ -286,6 +307,8 @@ kubectl config use-context kind-hub
286307

287308
``` bash
288309
# Apply namespace-scoped ClusterResourcePlacement
310+
# This CRP is configured to only place resources in the test-ns namespace
311+
# Uses namespaceSelector instead of resourceSelector for namespace-scoped propagation
289312
kubectl apply -f ./examples/updateRun/example-ns-only-crp.yaml
290313

291314
kubectl get crp -A
@@ -299,10 +322,14 @@ prometheus-crp 1 True 1 True 1 2
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
303328
kubectl apply -f ./examples/updateRun/example-sus.yaml
304329

305-
# 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
306333
kubectl apply -f ./examples/updateRun/example-rp.yaml
307334

308335
# Verify RP is created
@@ -316,7 +343,11 @@ test-ns example-rp 1 True 1
316343
```
317344

318345
```bash
319-
# 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)
320351
kubectl apply -f ./examples/updateRun/example-sur.yaml
321352

322353
# Check the staged update run status

0 commit comments

Comments
 (0)