-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(svc): create Run method to encapsulate most of whats in func main #533
base: main
Are you sure you want to change the base?
Conversation
This PR extracts most of the main function provided by stencil-golang into a function clients can call instead. QSS runs a number of peripheral services-- CDC, Ingest, Polaroid, SmartWorker, etc., each of which need to set up their own main function. To do this, they basically copy whats in stencil-golang. Wouldn't it be better if we could use a library function instead? I think it would be, since it eases the burden when it comes time to update any service-wide behavior. Of course, we'll still want stencil to provide the kubernetes objects, e.g. trace.yaml for example, and my hope is we'll stencil in depending on this method instead of just doing what it does currently inline.
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.
Shouldn't templates/cmd/main.go.tpl
also be changed in this PR?
pkg/run/run.go
Outdated
// Package run provides a function that can be invoked inside of main to set up | ||
// all the service-standard components we expect every service to run. | ||
// | ||
// clients should provide any runners they require as part of the app to the | ||
// Run function with OptAddRunner, and then call `Run` in their main function. |
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.
suggestion: it might be worth adding an example of how to use this.
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.
Added a testable example... should probably add a note that it exists here.
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 already reviewed the majority of this code. I think Mark has some fair points though
I had thought not, I'd like to merge it, use it some test services, and then circle back. |
Please read CONTRIBUTING.md for additional information on contributing to this repository!
What this PR does / why we need it
This PR extracts most of the main function provided by stencil-golang into a
function clients can call instead.
QSS runs a number of peripheral services-- CDC, Ingest, Polaroid, SmartWorker,
etc., each of which need to set up their own main function. To do this, they
basically copy whats in stencil-golang. Wouldn't it be better if we could use a
library function instead? I think it would be, since it eases the burden when
it comes time to update any service-wide behavior.
Of course, we'll still want stencil to provide the kubernetes objects, e.g.
trace.yaml for example, and my hope is we'll stencil in depending on this
method instead of just doing what it does currently inline.
Jira ID
[XX-XX]
Notes for your reviewers