-
Notifications
You must be signed in to change notification settings - Fork 56
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
Watch Program and Flux sources and run a Stack when they change #348
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
squaremo
force-pushed
the
watch-sources
branch
from
October 19, 2022 17:00
65bf460
to
2401cf5
Compare
squaremo
changed the title
Watch Program sources and run a Stack when they change
Watch Program and Flux sources and run a Stack when they change
Oct 20, 2022
squaremo
commented
Oct 24, 2022
lblackstone
approved these changes
Oct 24, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional changes LGTM. Just a couple small items
squaremo
force-pushed
the
watch-sources
branch
from
October 25, 2022 13:54
2960a27
to
b018080
Compare
The default for a configuration item is optional; but the type is (via an alias) apiextensionsv1.JSON, which is a struct. The zero value serialises to `null`, which makes the Pulumi YAML engine balk. Making this pointer typed means if it's absent, it'll be left out of the serialisation, and Pulumi YAML won't disagree with it. Signed-off-by: Michael Bridgen <mbridgen@pulumi.com>
At present the controller will notice changes to a Program object when it reruns a Stack that refers to that object, either because it failed the previous time, or because it requeued it on a schedule. This adds an index keeping track of which Stacks reference which Programs, and a watch that will requeue all the Stacks referring to a Program when that program changes. Signed-off-by: Michael Bridgen <mbridgen@pulumi.com>
A Stack can refer to a Flux source by (arbitrary) API version, kind, and name. This gives forward-compatibility with new and third-party sources -- but it makes it a bit trickier to detect when they have changed, because the kinds to watch aren't known until they're seen by the controller. The scheme to do so here is: 1. index the Stack against the type {group, version, kind} and name of the source they reference. This lets us look up the referencing stacks, when we see a source has been updated. 2. whenever a source is successfully retrieved (during Stack reconciliation), ensure that its kind is being watched; 3. the watchers installed in 2.) use the index in 1.) to look up the stacks using a source by type and name; then enqueue any such stacks to be reconciled. Signed-off-by: Michael Bridgen <mbridgen@pulumi.com>
When a flux Source is missing, we can now wait for the watch to fire when it appears, rather than retrying. The same is true when the source is marked as unready. Signed-off-by: Michael Bridgen <mbridgen@pulumi.com>
Signed-off-by: Michael Bridgen <mbridgen@pulumi.com>
squaremo
force-pushed
the
watch-sources
branch
from
October 25, 2022 13:58
08007cf
to
b30c8e6
Compare
Thank you @roothorp and @lblackstone for looking over this ⭐ |
This was referenced Jan 3, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This uses the usual controller-runtime machinery to watch Program and Flux resources, and rerun any Stack that refers to a Program when it's changed.
In passing, I've fixed a problem with
Program.program.configuration.default
-- it wasn't properly optional.Fixes #343.