-
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
[V2] Program controller and file server for program objects #673
Conversation
53191e3
to
a0d0eef
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2 #673 +/- ##
==========================================
- Coverage 33.25% 33.11% -0.15%
==========================================
Files 25 27 +2
Lines 3951 4161 +210
==========================================
+ Hits 1314 1378 +64
- Misses 2475 2610 +135
- Partials 162 173 +11 ☔ View full report in Codecov by Sentry. |
a0d0eef
to
d1dd21c
Compare
|
||
// LastResyncTime contains a timestamp for the last time a resync of the stack took place. | ||
// +optional | ||
LastResyncTime metav1.Time `json:"lastResyncTime,omitempty"` |
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.
I don't understand; multiple stacks could use the same program, no?
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.
I still think this field should be removed because a) it is redundant given the observedGeneration, and b) it uses the term "sync" which has a particular (different) meaning in PKO.
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.
field should be removed
: I'm opposed to this more so because we can have multiple reconciliation on the same generation. Take the example where a Program object has been reconciled and the status is written to it. If the controller pod restarts, there might be a possibility that the hostname has changed (though very unlikely). When the controller pod restarts, it will reconcile all objects it should watch for, and thus, the URL stored in status will be updated. It would be helpful for debugging purposes to know when the URL was generated.the term "sync" which has a particular (different) meaning in PKO.
: yes, a different name for this field, should we ultimately decide to keep it, should be used!
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.
I've removed this field for now, to merge this PR in eagerly. We can rethink how we want to handle this and add this in the future if we choose to.
dcbd67e
to
f376743
Compare
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.
Looks great, just left a couple of comments.
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.
Looks good, mostly just some nits but nothing blocking.
if _, err = stackInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ | ||
AddFunc: newProgramCallback, | ||
DeleteFunc: deleteProgramCallback, | ||
}); err != nil { | ||
return err | ||
} |
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.
Nice!
Ran the following command to scaffold a controller for the existing Program API/CR. ```sh operator-sdk create api --group pulumi --version v1 --kind Program --controller=true --resource=false ```
6e343d2
to
c07c641
Compare
Proposed changes
This PR enables a Workspace pod to fetch a Program object in a similar fashion to how it fetches Flux artifacts. We do this by exposing a HTTP server that serves tarballs of a fully formed
Pulumi.yaml
file, incorporating the requested Program spec. Unlike the approach with the Flux source-controller, I've opted not to create/store these tar files in local ephemeral storage in the controller pod. Instead, when the artifact URL is accessed, the file server will fetch the requested Program resource from the Kubernetes API server, and wrap it up in aPulumi.yaml
file and tarred. This approach ensures that the most recent Program spec is always served, and it also greatly simplifies storage since we do not need to create a local duplicate of these Program objects. Since the source of truth is always on cluster, we do not need to continuously reconcile and generate new artifacts for new generations of Programs. Should we choose to change this implementation in the future, the current strategy using the status field to convey the URL should make it easy to do so.Related issues (optional)
Closes: #651