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

ADR 1: Use secret types to select the authentication scheme #5110

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

twz123
Copy link
Member

@twz123 twz123 commented Oct 10, 2024

Description

This is a follow-up to #4524 (comment) and #4524 (comment). I think using secret types more could help in making the API better. WDYT?

The current version of this ADR proposes to use one secret type per protocol, which is somewhat limiting. It would be reasonable to consider the use of a basic auth secret for authentication to an OCI registry, for instance. Also, the use of the secret type to select the authentication scheme would help to reduce any potential ambiguity.

In the case of OCI registries, the ADR already explicitly mentions the dockerconfigjson secret type. For HTTP[S], it falls back on the Opaque type and attempts to figure out the appropriate authentication method based on the contents of the secret. This is inconsistent with the way it works for OCI, and can be made consistent by adding a custom secret type for the case that k0s wants to cover, but for which there's no predefined type available upstream.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings


The `authorization` entry is used as is, with its content placed directly into
the `Authorization` header. For example, a secret like the following will make
Autopilot set the `Authorization` header to `Bearer abc123def456ghi789jkl0`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Somehow we lost the example so the "following" part here makes no sense anymore (maybe it should be "previous" now).

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, it has to be reversed 🙈

`InsecureSkipTLSVerify` on a Go HTTP client.
- The `InsecureSkipTLSVerify` property will be valid for both `oci://` and
`https://` protocols.
`https://` protocols. It has no effect for the `http://` protocol.
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to add some notes here regarding the new oci+http introduced by #5107 as well.

Copy link
Contributor

This pull request has merge conflicts that need to be resolved.

The current version of this ADR proposes to use one secret type
per protocol, which is somewhat limiting. It would be reasonable to
consider the use of a basic auth secret for authentication to an OCI
registry, for instance. Also, the use of the secret type to select the
authentication scheme would help to reduce any potential ambiguity.

In the case of OCI registries, the ADR already explicitly mentions the
dockerconfigjson secret type. For HTTP[S], it falls back on the Opaque
type and attempts to figure out the appropriate authentication method
based on the contents of the secret. This is inconsistent with the way
it works for OCI, and can be made consistent by adding a custom secret
type for the case that k0s wants to cover, but for which there's no
predefined type available upstream.

Signed-off-by: Tom Wieczorek <[email protected]>
@twz123 twz123 merged commit af59855 into k0sproject:main Oct 21, 2024
7 checks passed
@twz123 twz123 deleted the use-secret-types branch October 21, 2024 13:25
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