Skip to content

CNTRLPLANE-367: Update Authentication API GoDoc for OIDC-related fields #2314

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

everettraven
Copy link
Contributor

I had noticed that the GoDoc for the OIDC-related fields was a bit sparse and needed to be brought up to date with the OpenShift API conventions.

This PR attempts to improve the GoDoc for only the OIDC-related fields as part of the GA criteria for the BYO OIDC feature.

Copy link
Contributor

openshift-ci bot commented May 7, 2025

Hello @everettraven! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 7, 2025
@openshift-ci openshift-ci bot requested review from deads2k and JoelSpeed May 7, 2025 19:33
Copy link
Contributor

openshift-ci bot commented May 7, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: everettraven
Once this PR has been reviewed and has the lgtm label, please assign joelspeed for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@everettraven everettraven changed the title Update Authentication API GoDoc for OIDC-related fields CNTRLPLANE-367: Update Authentication API GoDoc for OIDC-related fields May 7, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented May 7, 2025

@everettraven: This pull request references CNTRLPLANE-367 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

In response to this:

I had noticed that the GoDoc for the OIDC-related fields was a bit sparse and needed to be brought up to date with the OpenShift API conventions.

This PR attempts to improve the GoDoc for only the OIDC-related fields as part of the GA criteria for the BYO OIDC feature.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 7, 2025
ClaimMappings TokenClaimMappings `json:"claimMappings"`

// claimValidationRules are rules that are applied to validate token claims to authenticate users.
// claimValidationRules configures the rules to be used the Kubernetes API Server
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// claimValidationRules configures the rules to be used the Kubernetes API Server
// claimValidationRules configures the rules to be used by the Kubernetes API Server

Comment on lines 718 to 721
// type sets the type of the validation rule
//
// type configures the type of the validation rule.
// type is optional.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// type sets the type of the validation rule
//
// type configures the type of the validation rule.
// type is optional.
// type configures the type of the validation rule.
// type is optional.

Comment on lines 198 to 203
// name configures the unique human-readable identifier
// associated with the identity provider.
// name is used to distinguish between multiple identity providers.
// name has no impact on token validation or authentication mechanics.
// name is required.
// name must not be an empty string ("").
Copy link
Member

Choose a reason for hiding this comment

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

Instead of repeating name ... in the beginning of every sentence, would it make sense to make it a bit more natural, such as:

Suggested change
// name configures the unique human-readable identifier
// associated with the identity provider.
// name is used to distinguish between multiple identity providers.
// name has no impact on token validation or authentication mechanics.
// name is required.
// name must not be an empty string ("").
// Name configures the unique human-readable identifier
// associated with the identity provider.
// Used to distinguish between multiple identity providers and
// has no impact on token validation or authentication mechanics.
// It is required and must not be an empty string ("").

Also, we should probably match case in the doc comments.

This also seems to agree with our API conventions. This applies to various places in this diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, looking back at this I went a little overboard with the repetition there 😅 - updating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, we should probably match case in the doc comments.

It's API convention to match the serialized name, not the field name in the Go type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For additional context on the serialized name matching, see: #2314 (comment)

Comment on lines 209 to 212
// issuer configures how the platform interacts
// with the identity provider and how tokens issued
// from the identity provider are evaluated by the
// Kubernetes API Server.
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a more suitable comment for the type TokenIssuer instead of the field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comments on top level types do not get included in the generated OpenAPI spec field documentation that is shown to end users for fields of that type. This comment is here so that it appears for the end-user and explains what this field is used for if they run something like oc explain ...

ClaimValidationRules []TokenClaimValidationRule `json:"claimValidationRules,omitempty"`
}

// +kubebuilder:validation:MinLength=1
type TokenAudience string

type TokenIssuer struct {
// URL is the serving URL of the token issuer.
// Must use the https:// scheme.
// issuerURL configures the URL that is used to issue tokens
Copy link
Member

Choose a reason for hiding this comment

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

Wrong field name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issuerURL is the serialized name which we prefer to use for GoDoc on the OpenShift APIs because it is what end-users will be familiar with. The serialized field name is what the documentation, generated by the GoDoc, will be attached to when users do something like oc explain ... on the field

// configuration namespace. The .data of the configMap must contain
// the "ca-bundle.crt" key.
// If unset, system trust is used instead.
// issuerCertificateAuthority configures the certificate authority,
Copy link
Member

Choose a reason for hiding this comment

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

Wrong field name here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See explanation here: #2314 (comment)

//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +required
ComponentNamespace string `json:"componentNamespace"`

// clientID is the identifier of the OIDC client from the OIDC provider
// clientID configures the identifier, from the identity provider, that the platform
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// clientID configures the identifier, from the identity provider, that the platform
// clientID configures the client identifier, from the identity provider, that the platform

Copy link
Contributor

openshift-ci bot commented May 8, 2025

@everettraven: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/verify 053afe5 link true /test verify

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants