Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Read-only mode implemented with read-only client #198

Closed
erikgb opened this issue Apr 14, 2022 · 2 comments · Fixed by #206
Closed

Read-only mode implemented with read-only client #198

erikgb opened this issue Apr 14, 2022 · 2 comments · Fixed by #206
Assignees
Milestone

Comments

@erikgb
Copy link
Contributor

erikgb commented Apr 14, 2022

The newly introduced read-only mode to make HNC more highly available is currently implemented with a ReadOnly field on all reconcilers, and every write operation must guarded with a check on the value of this field. This is not robust enough IMO, and should be improved. Contributors not aware of this feature could easily forget adding this guard, leaving it up to reviewers to catch it - creating a troublesome contributor process with a high risk of errors being introduced in HNC. As an example, I dumped into the following code today, which misses this guard:

https://github.com/kubernetes-sigs/hierarchical-namespaces/blob/c5662040fb67c72a22085f50653cf74a1317d5f2/internal/hierarchyconfig/reconciler.go#L141

I suggest to instead implement the read-only mode by supplying the reconcilers with a delegating client, where all writes are implemented as a no-op. A bit like controller-runtime does for their caching client.

@adrianludwin
Copy link
Contributor

+1, I had a similar idea. This would be a great improvement.

@erikgb
Copy link
Contributor Author

erikgb commented Apr 23, 2022

/assign

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants