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

Thread FulcioConfig through from main via ctx #249

Merged
merged 1 commit into from Dec 1, 2021

Conversation

mattmoor
Copy link
Member

@mattmoor mattmoor commented Nov 30, 2021

Thread FulcioConfig through to handlers via ctx based on a value that's explicitly Load()ed at application start. This is the first of what I expect will be a bunch of refactoring PRs for Fulcio, but I'm trying to take them in bite-sized chunks. This change:

  1. Plumbs through ctx as a way we can pass configuration downstream to handlers (here with FulcioConfig, but I'd like to kill the usage of viper in our library code)
  2. Enables us to start reloading FulcioConfig (and eventually others!) periodically (or even via an informer!) to avoid needing to cycle pods to force config reloads.

There are some other auxiliary benefits to passing ctx like enabling us to model the K8s lifecycle properly by "draining" pods on SIGTERM, which I'm not sure we properly handle today (would require us to switch to something like knative.dev/pkg/signals.NewContext).

Signed-off-by: Matt Moore mattmoor@chainguard.dev

Release Note

NONE

This makes explicit where the config is loaded (incl. error handling), where it is infused into the `ctx` and how it is loaded from `ctx`.

Signed-off-by: Matt Moore <mattmoor@chainguard.dev>
Comment on lines +52 to +53
$(SWAGGER) generate server -f openapi.yaml -q -r COPYRIGHT.txt -t pkg/generated --exclude-main -A fulcio_server --exclude-spec --flag-strategy=pflag --principal github.com/coreos/go-oidc/v3/oidc.IDToken --additional-initialism=SCT
$(SWAGGER) generate client -f openapi.yaml -q -r COPYRIGHT.txt -t pkg/generated --principal github.com/coreos/go-oidc/v3/oidc.IDToken
Copy link
Member Author

Choose a reason for hiding this comment

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

I did this because it wasn't clear to me what -P was.

@mattmoor mattmoor changed the title [WIP] Experiment with FulcioConfig pulling from context.Context Thread FulcioConfig through from main via ctx Nov 30, 2021
@mattmoor mattmoor requested review from dlorenc and bobcallaway and removed request for dlorenc November 30, 2021 23:47
@bobcallaway
Copy link
Member

... This is the first of what I expect will be a bunch of refactoring PRs for Fulcio, but I'm trying to take them in bite-sized chunks.

sounds great - do you have a list you could share?

Copy link
Member

@bobcallaway bobcallaway left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@dlorenc dlorenc merged commit 71ab4d9 into sigstore:main Dec 1, 2021
@mattmoor mattmoor deleted the fulcio-config-context branch December 1, 2021 15:09
@mattmoor
Copy link
Member Author

mattmoor commented Dec 1, 2021

sounds great - do you have a list you could share?

Not yet really, I'm sort of taking it all in and trying to form a plan for it atm. I'll try to socialize the pieces of it as I form a clearer picture.

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.

None yet

3 participants