Skip to content

feat[compositions]: realtime compositor – part 1: changes to compositions#4582

Merged
phisco merged 3 commits intocrossplane:masterfrom
sttts:sttts-realtime-compositions
Sep 26, 2023
Merged

feat[compositions]: realtime compositor – part 1: changes to compositions#4582
phisco merged 3 commits intocrossplane:masterfrom
sttts:sttts-realtime-compositions

Conversation

@sttts
Copy link
Copy Markdown
Contributor

@sttts sttts commented Sep 6, 2023

Description of your changes

This PR makes the compositor (= the controller for the XR) to watch CompositionRevisions too, and run the compositor on CompositionRevision creation for the relevant XRs, in order to select the new revision in automatic mode, and to reapply the new manifests.

This speeds up the inner loop for composition authors to be realtime.

Demo (left changing the composition, top right the composition revision being created, middle right the revision is selected for the XR, bottom right the effect on the MR):
2023-09-06 18 47 44

I have:

  • Read and followed Crossplane's contribution process.
  • Added or updated unit and E2E tests for my change.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR, if necessary.
  • Opened a PR updating the docs, if necessary.

@sttts sttts requested review from a team and turkenh as code owners September 6, 2023 15:34
@sttts sttts requested a review from jbw976 September 6, 2023 15:34
@negz negz marked this pull request as draft September 6, 2023 18:26
@sttts
Copy link
Copy Markdown
Contributor Author

sttts commented Sep 9, 2023

@jbw976 @negz I would like to see some initial review from you. Anything blocking?

Clearly, some (unit) tests are necessary.

@sttts sttts force-pushed the sttts-realtime-compositions branch from 9209c6f to 3dce52d Compare September 11, 2023 06:40
@sttts sttts changed the title WIP: Realtime compositor Realtime compositor Sep 11, 2023
@sttts sttts marked this pull request as ready for review September 11, 2023 06:41
@sttts sttts force-pushed the sttts-realtime-compositions branch from 0bb7327 to 3dce52d Compare September 11, 2023 21:05
@sttts sttts force-pushed the sttts-realtime-compositions branch from 3dce52d to 4c9382a Compare September 12, 2023 18:02
@negz
Copy link
Copy Markdown
Member

negz commented Sep 15, 2023

@sttts +1 for adding this functionality. Good idea. As to the implementation, it mostly looks great. My only thought is whether it makes sense for NewReconciler to return the EventHandler. It seems like it's plumbing up types that are passed into NewReconciler. Could you export EnqueueForCompositionRevisionFunc and call that from definition/reconciler.go?

@sttts sttts force-pushed the sttts-realtime-compositions branch from 4c9382a to 629c52a Compare September 18, 2023 08:02
@sttts
Copy link
Copy Markdown
Contributor Author

sttts commented Sep 18, 2023

My only thought is whether it makes sense for NewReconciler to return the EventHandler. It seems like it's plumbing up types that are passed into NewReconciler. Could you export EnqueueForCompositionRevisionFunc and call that from definition/reconciler.go?

Done. You were right, looks better now.

@sttts sttts force-pushed the sttts-realtime-compositions branch 2 times, most recently from 9d0b1eb to 341efb8 Compare September 18, 2023 08:30
@sttts sttts force-pushed the sttts-realtime-compositions branch from 341efb8 to 09f4113 Compare September 18, 2023 11:06
@sttts sttts force-pushed the sttts-realtime-compositions branch 2 times, most recently from 9b580c7 to fb5f576 Compare September 18, 2023 13:01
if !ok {
t.Errorf("list was not an UnstructuredList")
} else if u.GroupVersionKind() != dogList {
t.Errorf("list was not an UnstructuredList")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the error here is not about wron GVK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed in next push.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@sttts sttts force-pushed the sttts-realtime-compositions branch from fb5f576 to 79366fd Compare September 19, 2023 08:01
@sttts sttts changed the title Realtime compositor feat[compositions]: realtime compositor Sep 19, 2023
@sttts sttts changed the title feat[compositions]: realtime compositor feat[compositions]: realtime compositor – part 1: changes to compositions Sep 19, 2023
@sttts sttts force-pushed the sttts-realtime-compositions branch 2 times, most recently from 40089b8 to 523061b Compare September 19, 2023 09:19
@sttts
Copy link
Copy Markdown
Contributor Author

sttts commented Sep 19, 2023

Usage flake

@sttts sttts force-pushed the sttts-realtime-compositions branch from 523061b to eb6c803 Compare September 19, 2023 16:50
@sttts
Copy link
Copy Markdown
Contributor Author

sttts commented Sep 19, 2023

Have added an e2e test.

@sttts
Copy link
Copy Markdown
Contributor Author

sttts commented Sep 20, 2023

@pedjak @negz ptal

Copy link
Copy Markdown
Contributor

@pedjak pedjak left a comment

Choose a reason for hiding this comment

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

lgtm, a few non-blocking questions only.

xrs.SetGroupVersionKind(schema.GroupVersionKind(of))
xrs.SetKind(schema.GroupVersionKind(of).Kind + "List")
if err := list(ctx, &xrs); err != nil {
log.Debug("cannot list in CompositionRevision handler", "type", schema.GroupVersionKind(of).String(), "error", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this log line get a bit more attention, i.e. be Info, if such error does not happen often?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that's a more general question (out of scope here): should we log serious problems above debug if they most likely show a logic problem in code, but the end user cannot do anything with them. IMO we should. Got told elsewhere that debug is the right level. I disagree.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this is a new piece of code, I think we could go with Info here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@sttts sttts force-pushed the sttts-realtime-compositions branch from eb6c803 to 18f5367 Compare September 21, 2023 12:34
Copy link
Copy Markdown
Contributor

@phisco phisco left a comment

Choose a reason for hiding this comment

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

LGTM! just a minor nit comment

@sttts
Copy link
Copy Markdown
Contributor Author

sttts commented Sep 26, 2023

@phisco merged your suggestion.

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
…sion is created

Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
@sttts sttts force-pushed the sttts-realtime-compositions branch from e8f198f to 15dcd77 Compare September 26, 2023 14:22
@jbw976 jbw976 removed their request for review September 26, 2023 14:58
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@upbound.io>
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.

4 participants