Skip to content

Conversation

@ShazaAldawamneh
Copy link

No description provided.

Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 17, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Nov 17, 2025

@ShazaAldawamneh: This pull request references CNTRLPLANE-312 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.21.0" version, but no target version was set.

Details

In response to this:

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.

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Excluded labels (none allowed) (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 17, 2025
@openshift-ci openshift-ci bot requested review from ibihim and liouk November 17, 2025 11:09
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Details 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

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Overall, the structure looks pretty good.

I have a handful of comments.

Comment on lines +446 to +451
// validate CEL expression
if err := validateCELExpression(&authenticationcel.ClaimMappingExpression{
Expression: claimValidationRule.Expression.Expression,
}); err != nil {
return apiserverv1beta1.ClaimValidationRule{}, fmt.Errorf("invalid CEL expression: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

As a note, we should update https://github.com/openshift/kubernetes/blob/891f5bb0306166d5625b89fc8dc86bbc8c85f549/openshift-kube-apiserver/admission/customresourcevalidation/authentication/validate_authentication.go#L240 to perform admission time validation of these expressions.

It doesn't hurt to also include the runtime validations here, but admission validations should be sufficient here because we are embedding that in the kube-apiserver

Copy link
Author

Choose a reason for hiding this comment

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

I'm not entirely sure what you mean here, can you explain more in details on what needs to be done ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean that we will also need to take an action item to update our admission plugin that we inject into the Kubernetes API server to validate that the CEL expressions here compile successfully.

There is nothing that needs to be done in this PR to address this comment.

Copy link
Author

Choose a reason for hiding this comment

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

I see, make sense, will make a note on that!

Comment on lines 66 to 116
DiscoveryURL: "https://example.com/.well-known/openid-configuration",
},
OIDCClients: []configv1.OIDCClientConfig{
{
ComponentName: "console",
ComponentNamespace: "openshift-console",
ClientID: "console-oidc-client",
},
{
ComponentName: "kube-apiserver",
ComponentNamespace: "openshift-kube-apiserver",
ClientID: "test-oidc-client",
},
},
ClaimMappings: configv1.TokenClaimMappings{
Username: configv1.UsernameClaimMapping{
Claim: "username",
PrefixPolicy: configv1.Prefix,
Prefix: &configv1.UsernamePrefix{
PrefixString: "oidc-user:",
},
},
Groups: configv1.PrefixedClaimMapping{
TokenClaimMapping: configv1.TokenClaimMapping{
Claim: "groups",
},
Prefix: "oidc-group:",
},
},
ClaimValidationRules: []configv1.TokenClaimValidationRule{
{
Type: configv1.TokenValidationRuleTypeRequiredClaim,
Type: configv1.TokenValidationRuleRequiredClaim,
RequiredClaim: &configv1.TokenRequiredClaim{
Claim: "username",
RequiredValue: "test-username",
},
},
{
Type: configv1.TokenValidationRuleTypeRequiredClaim,
RequiredClaim: &configv1.TokenRequiredClaim{
Claim: "email",
RequiredValue: "test-email",
Type: configv1.TokenValidationRuleExpression,
Expression: configv1.TokenExpressionRule{
Expression: "claims.email.endsWith('@example.com')",
Message: "email domain must be example.com",
},
},
},
UserValidationRules: []configv1.TokenUserValidationRule{
{
Expression: "user.groups.exists(g, g == 'system:authenticated')",
Message: "user must be authenticated",
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should be making these changes to the base configuration because these new fields are only present on a cluster where the associated feature gate is enabled.

These tests will run against clusters where the feature gate is and is not enabled.

Copy link
Author

Choose a reason for hiding this comment

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

Do you mean that the existing tests should remain unchanged, and that I should avoid modifying the base expected configuration?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, you should not modify existing tests to fit the requirements of a tech-preview feature. Instead, add new tests that are gated on that feature-gate being present and make modifications accordingly.

As an example:

{
name: "uncompilable CEL expression for uid claim mapping",
specUpdate: func(s *configv1.AuthenticationSpec) {
s.OIDCProviders[0].ClaimMappings.UID = &configv1.TokenClaimOrExpressionMapping{
Expression: "^&*!@#^*(",
}
},
requireFeatureGates: []configv1.FeatureGateName{features.FeatureGateExternalOIDCWithAdditionalClaimMappings},
},

Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 8, 2025

@ShazaAldawamneh: The following tests 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/unit 07257c7 link true /test unit
ci/prow/e2e-oidc-techpreview 07257c7 link true /test e2e-oidc-techpreview
ci/prow/e2e-oidc 07257c7 link true /test e2e-oidc

Full PR test history. Your PR dashboard.

Details

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

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants