CNTRLPLANE-312: Add generation logic for new API fields in the Authentication CR#810
CNTRLPLANE-312: Add generation logic for new API fields in the Authentication CR#810ShazaAldawamneh wants to merge 7 commits intoopenshift:masterfrom
Conversation
|
@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. DetailsIn 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. |
WalkthroughUpdates OpenShift module dependencies and adds upstream parity support for external OIDC authentication through user validation rules and CEL-based claim validation. New functionality is guarded by a feature gate, with corresponding test coverage and expanded operator gating logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ShazaAldawamneh The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
everettraven
left a comment
There was a problem hiding this comment.
Overall, the structure looks pretty good.
I have a handful of comments.
|
/retest-required |
|
/retest-required |
82a054d to
4cb42b2
Compare
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
4cb42b2 to
ffbc0c5
Compare
everettraven
left a comment
There was a problem hiding this comment.
A few minor things. Other than that, this LGTM
Signed-off-by: Shaza Aldawamneh <shaza.aldawamneh@hotmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/controllers/externaloidc/externaloidc_controller.go (1)
407-418:⚠️ Potential issue | 🟠 MajorEnforce UpstreamParity gate for CEL claim validation rules.
Line 407 ignores
featureGates, soTokenValidationRuleTypeCELrules can be emitted even whenFeatureGateExternalOIDCWithUpstreamParityis off. This bypasses feature gating for new fields.🛠️ Suggested fix
func generateClaimValidationRules(featureGates featuregates.FeatureGate, claimValidationRules ...configv1.TokenClaimValidationRule) ([]apiserverv1beta1.ClaimValidationRule, error) { out := []apiserverv1beta1.ClaimValidationRule{} errs := []error{} for _, claimValidationRule := range claimValidationRules { + if claimValidationRule.Type == configv1.TokenValidationRuleTypeCEL && + !featureGates.Enabled(features.FeatureGateExternalOIDCWithUpstreamParity) { + errs = append(errs, fmt.Errorf("claimValidationRule.type %q requires %s feature gate", configv1.TokenValidationRuleTypeCEL, features.FeatureGateExternalOIDCWithUpstreamParity)) + continue + } rule, err := generateClaimValidationRule(claimValidationRule) if err != nil { errs = append(errs, fmt.Errorf("generating claimValidationRule: %v", err)) continue }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/controllers/externaloidc/externaloidc_controller.go` around lines 407 - 418, The loop in generateClaimValidationRules ignores the featureGates parameter and may emit CEL-based rules regardless of the FeatureGateExternalOIDCWithUpstreamParity flag; update generateClaimValidationRules to check featureGates.Has(featuregates.FeatureGateExternalOIDCWithUpstreamParity) (or equivalent) before appending any rule whose type is TokenValidationRuleTypeCEL (as determined from generateClaimValidationRule or the returned rule.Type), and if the gate is off either skip that rule or return a descriptive error; reference generateClaimValidationRules, generateClaimValidationRule, TokenValidationRuleTypeCEL, and FeatureGateExternalOIDCWithUpstreamParity to locate and implement the gate check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@pkg/controllers/externaloidc/externaloidc_controller.go`:
- Around line 226-228: The code currently sets out.DiscoveryURL when
issuer.DiscoveryURL is non-empty; instead validate the URL scheme (parse
issuer.DiscoveryURL and ensure scheme == "https") before assigning to
out.DiscoveryURL and return the appropriate error for non-HTTPS or invalid URLs;
update the branch around issuer.DiscoveryURL and out.DiscoveryURL so it parses
the value (using net/url.Parse), checks u.Scheme == "https", and only then sets
out.DiscoveryURL = &issuer.DiscoveryURL, otherwise return the “invalid discovery
URL (http)” style error.
---
Outside diff comments:
In `@pkg/controllers/externaloidc/externaloidc_controller.go`:
- Around line 407-418: The loop in generateClaimValidationRules ignores the
featureGates parameter and may emit CEL-based rules regardless of the
FeatureGateExternalOIDCWithUpstreamParity flag; update
generateClaimValidationRules to check
featureGates.Has(featuregates.FeatureGateExternalOIDCWithUpstreamParity) (or
equivalent) before appending any rule whose type is TokenValidationRuleTypeCEL
(as determined from generateClaimValidationRule or the returned rule.Type), and
if the gate is off either skip that rule or return a descriptive error;
reference generateClaimValidationRules, generateClaimValidationRule,
TokenValidationRuleTypeCEL, and FeatureGateExternalOIDCWithUpstreamParity to
locate and implement the gate check.
|
/retest |
|
@ShazaAldawamneh: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
No description provided.