You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`crds.install`: Install MetricCollector and MetricCollectorReport CRDs (default: true)
58
+
The controller watches for:
59
+
-`ApprovalRequest` (namespaced)
60
+
-`ClusterApprovalRequest` (cluster-scoped)
65
61
66
-
## Development
62
+
Both resources from kubefleet are monitored, and the controller creates `MetricCollector` resources on appropriate member clusters based on the staged update configuration.
67
63
68
-
### Build
64
+
### Health Check Interval
69
65
70
-
```bash
71
-
make docker-build
66
+
The controller checks workload health every **15 seconds**. This interval is configurable via the `reconcileInterval` parameter in the Helm chart.
67
+
68
+
## API Reference
69
+
70
+
### WorkloadTracker
71
+
72
+
`WorkloadTracker` is a cluster-scoped custom resource that defines which workloads the approval controller should monitor for health metrics before auto-approving staged rollouts.
73
+
74
+
#### Example: Single Workload
75
+
76
+
```yaml
77
+
apiVersion: placement.kubernetes-fleet.io/v1beta1
78
+
kind: WorkloadTracker
79
+
metadata:
80
+
name: sample-workload-tracker
81
+
workloads:
82
+
- name: sample-metric-app
83
+
namespace: test-ns
72
84
```
73
85
74
-
### Test Locally
86
+
#### Example: Multiple Workloads
87
+
88
+
```yaml
89
+
apiVersion: placement.kubernetes-fleet.io/v1beta1
90
+
kind: WorkloadTracker
91
+
metadata:
92
+
name: multi-workload-tracker
93
+
workloads:
94
+
- name: frontend
95
+
namespace: production
96
+
- name: backend-api
97
+
namespace: production
98
+
- name: worker-service
99
+
namespace: production
100
+
```
75
101
76
-
```bash
77
-
go run ./cmd/approvalrequestcontroller/main.go
102
+
#### Usage Notes
103
+
104
+
- **Cluster-scoped:** WorkloadTracker is a cluster-scoped resource, not namespaced
105
+
- **Optional:** If no WorkloadTracker exists, the controller will skip health checks and won't auto-approve
106
+
- **Single instance:** The controller expects one WorkloadTracker per cluster and uses the first one found
107
+
- **Health criteria:** All workloads listed must report healthy (metric value = 1.0) before approval
108
+
- **Prometheus metrics:** Each workload should expose `workload_health` metrics that the MetricCollector can query
109
+
110
+
For a complete example, see: [`./examples/workloadtracker/workloadtracker.yaml`](./examples/workloadtracker/workloadtracker.yaml)
111
+
112
+
## Additional Resources
113
+
114
+
- **Main Tutorial:** See [`../README.md`](../README.md) for a complete end-to-end tutorial on setting up automated staged rollouts with approval automation
115
+
- **Metric Collector:** See [`../metric-collector/README.md`](../metric-collector/README.md) for details on the metric collection component that runs on member clusters
0 commit comments