Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crd: add status sub resource #3

Merged
merged 1 commit into from
Sep 18, 2023
Merged

crd: add status sub resource #3

merged 1 commit into from
Sep 18, 2023

Conversation

maiqueb
Copy link
Collaborator

@maiqueb maiqueb commented Sep 1, 2023

An approach with a status sub-resource would be interesting for scenarios where a separate IPAMLease controller operates as an IPAM controller; the client workload controllers (e.g. KubeVirt) would:

  • create an IPAMLease object
  • the IPAMLease controller would see this CR being created, generate an IP for it, and update its status
  • the client workload controller would see the IPAMLease update (i.e. the IP allocation) and be able to template the pod object requesting this static IP address.

Differentiating between resource and sub-resource at Roles allows having distinct authorization scopes; meaning users can be granted full write access to spec and read-only access to status, while relevant controllers are granted read-only access to spec but full write access to status.

Thus, assuming KubeVirt would be "the" reference client, we would have the KubeVirt controller as having write access to spec and read-only to status, while the IPAM CNI would have read-only access to the spec stanza, while having full write access to the status sub-resource.

@maiqueb
Copy link
Collaborator Author

maiqueb commented Sep 1, 2023

/cc @qinqon

Copy link
Member

@qinqon qinqon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the fact that we can differenciate between resource and subresource at Roles is an important feature so for example a user that creates the CRD can read the status.IPs but not modify it.

From k8s docs

Types with both spec and status stanzas can (and usually should) have distinct authorization scopes for them. This allows users to be granted full write access to spec and read-only access to status, while relevant controllers are granted read-only access to spec but full write access to status.

Can you add this as a bullet at PR/commit description ?

@maiqueb maiqueb requested a review from qinqon September 18, 2023 08:53
An approach with a status sub-resource would be interesting for
scenarios where a separate `IPAMLease` controller operates as an IPAM
controller; the client workload controllers (e.g. KubeVirt) would:
- create an IPAMLease object
- the IPAMLease controller would see this CR being created, generate an
  IP for it, and update its status
- the client workload controller would see the IPAMLease update (i.e.
  the IP allocation) and be able to template the pod object requesting
  this static IP address.

Thus, the workload controller - e.g. KubeVirt - would have write access to spec
and read-only to status, while the IPAM CNI would have read-only access to the
spec while having full write access to the status sub-resource.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
@maiqueb maiqueb merged commit 544ceb7 into main Sep 18, 2023
1 check passed
@maiqueb maiqueb deleted the add-status-subresource branch September 18, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants