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

OIDC authenticator defaults to using host's root CA pool if CA file is not provided #342

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

dimityrmirchev
Copy link
Contributor

This PR proposes an alternative approach to #259 by implementing #259 (comment).

It also aligns the behaviour of the --oidc-ca-file flag with its description.

Reference to the code that utilises the host's root cert pool when no CAContentProvider is set https://github.com/kubernetes/kubernetes/blob/c83cbee114ddb732cdc06d3d1b62c9eb9220726f/staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/oidc/oidc.go#L271-L290

Comment on lines 42 to 43
if len(config.CAFile) > 0 {
dyCA, err := dynamiccertificates.NewDynamicCAContentFromFile("oidc-ca", config.CAFile)
Copy link
Collaborator

@stlaz stlaz Dec 9, 2024

Choose a reason for hiding this comment

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

nit:

Suggested change
if len(config.CAFile) > 0 {
dyCA, err := dynamiccertificates.NewDynamicCAContentFromFile("oidc-ca", config.CAFile)
if len(config.CAFile) > 0 { // if unset, the OIDC authenticator defaults to host's trust store
var err error
dynamicCA, err = dynamiccertificates.NewDynamicCAContentFromFile("oidc-ca", config.CAFile)

Otherwise the change looks good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed with 84cafeb

Should this be squashed into the previous commit?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes please

@stlaz
Copy link
Collaborator

stlaz commented Dec 9, 2024

lgtm, let's wait for the tests to complete

@stlaz
Copy link
Collaborator

stlaz commented Dec 9, 2024

Merging, thank you for your PR 🙂

@stlaz stlaz merged commit 0b6ff42 into brancz:master Dec 9, 2024
7 checks passed
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.

2 participants