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

✨ Add workspace mount battery & controller #3058

Merged
merged 6 commits into from
Mar 9, 2024

Conversation

mjudeikis
Copy link
Contributor

@mjudeikis mjudeikis commented Dec 9, 2023

Summary

Add workspace mounts battery and loose coupling controller which checks workspace annotations, dynamically watches mount objects, and updates workspace annotations accordingly with updated status

Related issue(s)

Fixes #

Release Notes

Add experimental workspace mount reconciler

@kcp-ci-bot kcp-ci-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Dec 9, 2023
@kcp-ci-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kcp-ci-bot kcp-ci-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 9, 2023
@kcp-ci-bot kcp-ci-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 25, 2023
@mjudeikis mjudeikis force-pushed the mjudeikis/mount.controllers branch 2 times, most recently from 01c282a to 1fd5801 Compare December 25, 2023 16:26
@kcp-ci-bot kcp-ci-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 25, 2023
@mjudeikis mjudeikis marked this pull request as ready for review December 25, 2023 16:28
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 25, 2023
@mjudeikis mjudeikis changed the title ✨ Add workspace mount battery + controller ✨ Add workspace mount battery & controller Dec 25, 2023
@mjudeikis
Copy link
Contributor Author

@sttts updated

// workspace based on the mount status.
func (c *Controller) reconcile(ctx context.Context, ws *tenancyv1alpha1.Workspace) (bool, error) {
getMountObjectFunc := func(ctx context.Context, cluster logicalcluster.Path, ref *v1.ObjectReference) (*unstructured.Unstructured, error) {
resourceName := strings.ToLower(ref.Kind) + "s"
Copy link
Member

Choose a reason for hiding this comment

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

should we maybe reference resources? This logic here will break if somebody has custom plural.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to avoid hardcoding and make a generic one.
Alternative is either hardcode in the core, which I tried to avoid so code does not need to be changed when new mount implementation is done.
Not sure if there is another easy'ish alternative?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idea was if you use Plural already - that's kinda wrong naming

Copy link
Member

Choose a reason for hiding this comment

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

true. This really needs a rest mapper, but a per-workspace rest mapper is also ugly 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this gives us a path forward, for now, we can change this later while we iterate.

@mjudeikis mjudeikis force-pushed the mjudeikis/mount.controllers branch 2 times, most recently from 7ad1b7c to b99e2db Compare March 7, 2024 18:00
@mjudeikis mjudeikis force-pushed the mjudeikis/mount.controllers branch 3 times, most recently from 874c3f9 to ba8474b Compare March 9, 2024 11:00
@mjudeikis mjudeikis force-pushed the mjudeikis/mount.controllers branch from ba8474b to 8ed8e3d Compare March 9, 2024 11:21
@mjudeikis
Copy link
Contributor Author

/hold

@kcp-ci-bot kcp-ci-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2024
return false, nil
}

workspaceOwnerRaw, ok := u.GetAnnotations()[tenancyv1alpha1.ExperimentalWorkspaceOwnerAnnotationKey]
Copy link
Member

Choose a reason for hiding this comment

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

the use of this annotation irritates me. We usually use it to store the userInfo of the user that created a workspace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we add a dedicated one?
experimental.tenancy.kcp.io/owning-workspace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. lets move to index post kubecon? Else I need to redo our demo env :D

reconciler/tenancy/workspacemounts: simplify with only one type of keys in queue
@kcp-ci-bot kcp-ci-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 9, 2024
@sttts
Copy link
Member

sttts commented Mar 9, 2024

Clearly experimental. We will come back.

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2024
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 5417454bcf0bc370dc38501c0d574a1b50d0cf6a

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 9, 2024
@mjudeikis
Copy link
Contributor Author

/test pull-kcp-test-e2e-shared

@mjudeikis
Copy link
Contributor Author

/hold cancel

@kcp-ci-bot kcp-ci-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2024
@kcp-ci-bot kcp-ci-bot merged commit 39c8843 into kcp-dev:main Mar 9, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants