Skip to content

CNTRLPLANE-2523: deploy oauth-apiserver in new OIDC mode when authentication type is OIDC - #858

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
everettraven:feature/eoidc-ec-oauth-new-deploy
Apr 17, 2026
Merged

CNTRLPLANE-2523: deploy oauth-apiserver in new OIDC mode when authentication type is OIDC#858
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
everettraven:feature/eoidc-ec-oauth-new-deploy

Conversation

@everettraven

@everettraven everettraven commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Description

This PR updates the cluster-authentication-operator to deploy the oauth-apiserver in the new external OIDC mode when the authentication type is set to OIDC and the new ExternalOIDCExternalClaimsSourcing feature gate is enabled.

Currently, this feature gate is only enabled in DevPreviewNoUpgrade.

For more information as to the motivation of this change, see openshift/enhancements#1907

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced new external OIDC authentication architecture with dedicated api-server deployment option
    • Added feature gate to enable/disable new OIDC external claims sourcing capability
    • Integrated automatic configuration synchronization for external OIDC scenarios
  • Refactor

    • Updated OIDC availability detection to support both legacy and new architecture paths

@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a feature‑gated external‑OIDC deployment path for the oauth-apiserver, threads a feature‑gate accessor into auth‑config checks and sync flows, conditionally mirrors auth-config, refactors deployment sync into standard vs external‑OIDC flows, and updates tests and manifests to exercise the new behavior.

Changes

Cohort / File(s) Summary
External OIDC Manifests / Testdata
bindata/oauth-apiserver/externaloidc-deploy.yaml, pkg/operator/workload/testdata/sync_ds_scenario_4.yaml, pkg/operator/workload/testdata/sync_ds_scenario_5.yaml, pkg/operator/workload/testdata/sync_ds_scenario_6.yaml
Added runtime and test Deployment manifests for external‑OIDC oauth-apiserver (TLS, auth-config mount, optional trusted CA bundle, privileged SCC, master scheduling, rolling update).
AuthConfigChecker & Tests
pkg/controllers/common/external_oidc.go, pkg/controllers/common/external_oidc_test.go
NewAuthConfigChecker now accepts an OAAS ConfigMap informer and a featureGateAccessor; AuthConfigChecker stores new informer/lister and feature accessor. OIDCAvailable() waits for initial feature gates, reads current gates, and when FeatureGateExternalOIDCExternalClaimsSourcing is enabled uses openshift-oauth-apiserver/auth-config existence to determine OIDC availability. Tests updated to inject feature‑gate scenarios and failure cases.
Controller Tests Wiring
pkg/controllers/routercerts/controller_test.go
Test setup updated to inject a hardcoded feature gate accessor and the extra ConfigMap informer into NewAuthConfigChecker.
Webhook Authenticator Controller
pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
sync path now skips the OIDC‑availability/removeOperands/ApplyOperatorStatus block when FeatureGateExternalOIDCExternalClaimsSourcing is enabled; prior behavior retained when disabled.
Operator Startup & Resource Sync
pkg/operator/starter.go
Create featureGateAccessor earlier and pass it into NewAuthConfigChecker (error returned on failure). prepareOauthAPIServerOperator conditionally calls resourceSyncController.SyncConfigMapConditionally to mirror openshift-config-managed/auth-configopenshift-oauth-apiserver/auth-config when initial gates are observed and external‑OIDC feature is enabled; static resource inclusion logic updated; workload.NewOAuthAPIServerWorkload now receives &authConfigChecker.
Workload Sync Refactor
pkg/operator/workload/sync_openshift_oauth_apiserver.go
Introduced a minimal authConfigChecker interface and switched the workload to accept it. syncDeployment now waits for initial gates and reads current gates, branching to syncExternalOIDCDeployment (renders/applies externaloidc-deploy.yaml, computes dependency hash for trusted-ca-bundle, enforces pod-per-node replicas) or syncStandardDeployment (retains KMS plugin handling).
Workload Sync Tests
pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
Expanded scenarios to include per‑test featureGates, authenticationType, and authConfigChecker; added mockAuthConfigChecker and multiple golden fixtures for external‑OIDC vs standard deployment outputs.
E2E OIDC Tests
test/e2e-oidc/external_oidc_test.go
Tests read the external‑OIDC feature gate and adjust validation/cleanup: when enabled, skip kube-apiserver rollout/waits and omit certain resource/condition/operand expectations; when disabled, keep prior checks.
Starter / Replacement Feature Defaults
pkg/operator/replacement_starter.go
Static feature gate accessor now explicitly disables FeatureGateExternalOIDCExternalClaimsSourcing by default (alongside existing disabled gates).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Starter as Operator Starter
participant FGA as FeatureGateAccessor
participant ACC as AuthConfigChecker
participant RSC as ResourceSyncController
participant WL as OAuthAPIServerWorkload
participant CM as ConfigMap (openshift-oauth-apiserver/auth-config)
participant KAS as KubeAPIServer

Starter->>FGA: create accessor, wait for initial gates
Starter->>ACC: construct with KAS configmaps + OAAS configmaps + FGA
ACC->>FGA: AreInitialFeatureGatesObserved? / CurrentFeatureGates()
alt external OIDC feature enabled
    RSC->>CM: SyncConfigMapConditionally(from openshift-config-managed)
    WL->>ACC: OIDCAvailable()
    ACC->>CM: check existence of auth-config
    alt auth-config exists
        WL->>WL: render & apply externaloidc-deploy.yaml
    else
        WL->>WL: skip external deployment
    end
else external OIDC feature disabled
    WL->>KAS: validate KAS revision/cluster state
    WL->>WL: render & apply standard deployment
end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 7 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.26% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Single Node Openshift (Sno) Test Compatibility ⚠️ Warning Test lacks SNO protection mechanisms like [Skipped:SingleReplicaTopology] label or exutil.IsSingleNode() check. Add [Skipped:SingleReplicaTopology] to test name or implement exutil.IsSingleNode() check with skip logic.
Topology-Aware Scheduling Compatibility ⚠️ Warning External OIDC deployment uses nodeSelector assuming HA topology without checking infrastructure.Status.ControlPlaneTopology, causing scheduling failures on HyperShift. Check cluster topology and skip deployment on External/HyperShift topologies or add alternative scheduling logic for non-HA topologies.
✅ Passed checks (7 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: deploying oauth-apiserver in new OIDC mode when the authentication type is OIDC and the feature gate is enabled.
Stable And Deterministic Test Names ✅ Passed All test names in the PR are static and deterministic with no dynamic content like fmt.Sprintf, variable concatenation, or timestamps.
Test Structure And Quality ✅ Passed Test code demonstrates good quality with proper cleanup patterns, focused table-driven test cases with meaningful assertions, and appropriate timeout handling.
Microshift Test Compatibility ✅ Passed The custom check applies to newly added Ginkgo e2e tests. This PR modifies an existing test file using Go's standard testing framework (t.Run()), not Ginkgo. No new Ginkgo test constructs were added.
Ote Binary Stdout Contract ✅ Passed All fmt and klog calls in modified files are confined to test blocks and function bodies, with no suite-level code violations of OTE stdout contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The test uses traditional Go testing.T with t.Run() sub-tests, not Ginkgo constructs, and is a modification of an existing test rather than a new test addition.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 Mar 27, 2026
@openshift-ci

openshift-ci Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 27, 2026
Comment thread pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
Comment thread bindata/oauth-apiserver/externaloidc-deploy.yaml
Comment thread pkg/operator/starter.go Outdated
Comment thread bindata/oauth-apiserver/externaloidc-deploy.yaml Outdated
@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch from 45ab4b5 to 562dc8c Compare April 8, 2026 18:24
@everettraven everettraven changed the title WIP: external oidc uses new oauth-apiserver mode CNTRLPLANE-2523: deploy oauth-apiserver in new OIDC mode when authentication type is OIDC Apr 8, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 8, 2026
@openshift-ci-robot

openshift-ci-robot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

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

Details

In response to this:

Description

This PR updates the cluster-authentication-operator to deploy the oauth-apiserver in the new external OIDC mode when the authentication type is set to OIDC and the new ExternalOIDCExternalClaimsSourcing feature gate is enabled.

Currently, this feature gate is only enabled in DevPreviewNoUpgrade.

For more information as to the motivation of this change, see openshift/enhancements#1907

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.

@everettraven
everettraven marked this pull request as ready for review April 8, 2026 18:59
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 8, 2026
@openshift-ci
openshift-ci Bot requested review from ibihim and liouk April 8, 2026 19:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
pkg/operator/workload/sync_openshift_oauth_apiserver_test.go (1)

199-237: Incorrect scenario numbering in comments.

The comments say "scenario 2" and "scenario 3" (lines 199, 237), but these are actually scenarios 5 and 6 in the overall list. The first set of three scenarios (1-3) with feature gate disabled is followed by three more (4-6) with feature gate enabled but OIDC not configured.

Consider updating the comments to match the actual scenario numbers or removing the inline numbering.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/workload/sync_openshift_oauth_apiserver_test.go` around lines
199 - 237, The inline comment labels "scenario 2" and "scenario 3" are incorrect
for the test cases that follow; update those comments (near the table-driven
test entries that include goldenFile "./testdata/sync_ds_scenario_2.yaml",
featureGates usage, authConfigChecker, and customAPIServerArgsJSON) to the
correct scenario numbers (5 and 6) or remove the numeric labels altogether so
they don't mislead readers; locate the comments immediately above the test case
structs that reference featureGates.NewHardcodedFeatureGateAccess and adjust the
text accordingly.
pkg/operator/workload/sync_openshift_oauth_apiserver.go (1)

326-415: Consider extracting shared logic between deployment sync functions.

syncExternalOIDCDeployment and syncStandardDeployment share significant templating and annotation logic (~60% overlap). While the current duplication is acceptable for initial implementation clarity, consider extracting common code into a helper function in the future to reduce maintenance burden.

Key intentional differences noted:

  • External OIDC uses different template and excludes InitContainers processing
  • External OIDC only hashes trusted-ca-bundle (no etcd dependencies)
  • External OIDC skips KMS plugin volume injection
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/workload/sync_openshift_oauth_apiserver.go` around lines 326 -
415, syncExternalOIDCDeployment duplicates much of the
templating/annotation/argument logic from syncStandardDeployment; extract a
shared helper (e.g., renderAndPrepareDeployment(templatePath string,
operatorSpec *operatorv1.OperatorSpec, operatorStatus
*operatorv1.OperatorStatus, imagePullSpec string, operatorImagePullSpec string,
excludedReferences []string, hashedConfigMaps []string, injectKMS bool)
(*appsv1.Deployment, error)) that performs: loading the YAML template, parsing
and inserting args (including setting "v"), performing string replacements for
IMAGE/REVISION/FLAGS, validating unreplaced references, encoding FLAGS, applying
annotations/labels (including operator-pull-spec and revision), computing
resourcehash.MultipleObjectHashStringMapForObjectReferences for a provided list
of configmaps/secrets and applying those annotations to both deployment and pod
template, and returning the prepared Deployment object; keep
syncExternalOIDCDeployment and syncStandardDeployment to call this helper and
perform only the unique steps (initContainer handling, KMS volume injection,
different hashed resources, and replica counting/ensureAtMostOnePodPerNode) so
behavior remains identical but shared behavior is centralized.
test/e2e-oidc/external_oidc_test.go (1)

904-909: Track the TODO for future cleanup.

The comment indicates this is a temporary solution that reduces validation thoroughness. Consider tracking this for follow-up once the re-architecture is complete.

Would you like me to open an issue to track improving the operand version validation once the new architecture is stable?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e-oidc/external_oidc_test.go` around lines 904 - 909, Replace the
vague TODO above the conditional that uses newExternalOIDCArchitectureEnabled
and operands.Delete("oauth-apiserver") with a tracked follow-up: open a repo
issue describing restoring/strengthening operand version validation after the
re-architecture, then update the inline comment to include the created issue
number or URL and a short owner/priority tag (e.g., "TODO(`#1234`) - restore
thorough validation"), so future reviewers can find and resolve the temporary
operand deletion behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bindata/oauth-apiserver/externaloidc-deploy.yaml`:
- Around line 36-53: The oauth-apiserver container attempts to copy the trusted
CA bundle into /etc/pki which requires elevated privileges; add a
securityContext block to the container spec for the container named
"oauth-apiserver" with privileged: true and runAsUser: 0 so the cp operation
succeeds (i.e., add securityContext: privileged: true and runAsUser: 0 to the
oauth-apiserver container spec).
- Around line 79-84: The pod references a conditionally-synced ConfigMap
"auth-config" but doesn't mark it optional or guard its use, causing pod startup
failures when OIDC is disabled; fix by either adding "optional: true" under the
auth-config volume mount (the same way trusted-ca-bundle is marked) or modify
the container startup script/command to check for
/var/run/configmaps/auth-config/auth-config.json before appending "--config=..."
(follow the trusted-ca-bundle conditional pattern and the
SyncConfigMapConditionally behavior in starter.go to decide which approach to
apply).

---

Nitpick comments:
In `@pkg/operator/workload/sync_openshift_oauth_apiserver_test.go`:
- Around line 199-237: The inline comment labels "scenario 2" and "scenario 3"
are incorrect for the test cases that follow; update those comments (near the
table-driven test entries that include goldenFile
"./testdata/sync_ds_scenario_2.yaml", featureGates usage, authConfigChecker, and
customAPIServerArgsJSON) to the correct scenario numbers (5 and 6) or remove the
numeric labels altogether so they don't mislead readers; locate the comments
immediately above the test case structs that reference
featureGates.NewHardcodedFeatureGateAccess and adjust the text accordingly.

In `@pkg/operator/workload/sync_openshift_oauth_apiserver.go`:
- Around line 326-415: syncExternalOIDCDeployment duplicates much of the
templating/annotation/argument logic from syncStandardDeployment; extract a
shared helper (e.g., renderAndPrepareDeployment(templatePath string,
operatorSpec *operatorv1.OperatorSpec, operatorStatus
*operatorv1.OperatorStatus, imagePullSpec string, operatorImagePullSpec string,
excludedReferences []string, hashedConfigMaps []string, injectKMS bool)
(*appsv1.Deployment, error)) that performs: loading the YAML template, parsing
and inserting args (including setting "v"), performing string replacements for
IMAGE/REVISION/FLAGS, validating unreplaced references, encoding FLAGS, applying
annotations/labels (including operator-pull-spec and revision), computing
resourcehash.MultipleObjectHashStringMapForObjectReferences for a provided list
of configmaps/secrets and applying those annotations to both deployment and pod
template, and returning the prepared Deployment object; keep
syncExternalOIDCDeployment and syncStandardDeployment to call this helper and
perform only the unique steps (initContainer handling, KMS volume injection,
different hashed resources, and replica counting/ensureAtMostOnePodPerNode) so
behavior remains identical but shared behavior is centralized.

In `@test/e2e-oidc/external_oidc_test.go`:
- Around line 904-909: Replace the vague TODO above the conditional that uses
newExternalOIDCArchitectureEnabled and operands.Delete("oauth-apiserver") with a
tracked follow-up: open a repo issue describing restoring/strengthening operand
version validation after the re-architecture, then update the inline comment to
include the created issue number or URL and a short owner/priority tag (e.g.,
"TODO(`#1234`) - restore thorough validation"), so future reviewers can find and
resolve the temporary operand deletion behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 04ea6cf1-c730-4ea1-9f4f-cd5a52e3856c

📥 Commits

Reviewing files that changed from the base of the PR and between 51ea6cd and 562dc8c.

📒 Files selected for processing (12)
  • bindata/oauth-apiserver/externaloidc-deploy.yaml
  • pkg/controllers/common/external_oidc.go
  • pkg/controllers/common/external_oidc_test.go
  • pkg/controllers/routercerts/controller_test.go
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
  • pkg/operator/starter.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
  • pkg/operator/workload/testdata/sync_ds_scenario_4.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_5.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_6.yaml
  • test/e2e-oidc/external_oidc_test.go

Comment thread bindata/oauth-apiserver/externaloidc-deploy.yaml
Comment thread bindata/oauth-apiserver/externaloidc-deploy.yaml
Comment thread bindata/oauth-apiserver/externaloidc-deploy.yaml
Comment thread pkg/operator/workload/sync_openshift_oauth_apiserver.go
Comment thread bindata/oauth-apiserver/externaloidc-deploy.yaml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/e2e-oidc/external_oidc_test.go (1)

904-912: Temporary workaround is reasonable but should be tracked.

The TODO comment at line 907 notes this is a temporary solution. Consider opening an issue to track restoring full oauth-apiserver operand version validation once the re-architecture is complete.

Would you like me to open an issue to track restoring the full operand version validation?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e-oidc/external_oidc_test.go` around lines 904 - 912, The TODO notes
removing "oauth-apiserver" from operands in validateOperandVersions as a
temporary workaround; create a tracked follow-up by opening an issue that
references validateOperandVersions, the operands set (including
"oauth-apiserver" and "oauth-openshift"), and the flag
newExternalOIDCArchitectureEnabled, describing that full validation for
oauth-apiserver should be restored once the re-architecture finishes; add the
issue ID to the TODO comment so future reviewers can find the tracking ticket.
🤖 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/operator/workload/sync_openshift_oauth_apiserver.go`:
- Around line 382-390: The dependency hash currently only includes the
"trusted-ca-bundle" ConfigMap; update the call to
resourcehash.MultipleObjectHashStringMapForObjectReferences in the external OIDC
deployment sync so it also includes the "auth-config" ConfigMap reference. Add
another
resourcehash.NewObjectRef().ForConfigMap().InNamespace(c.targetNamespace).Named("auth-config")
to the argument list (alongside the existing trusted-ca-bundle ref) so updates
to auth-config will change the computed hash and trigger pod redeploys.

---

Nitpick comments:
In `@test/e2e-oidc/external_oidc_test.go`:
- Around line 904-912: The TODO notes removing "oauth-apiserver" from operands
in validateOperandVersions as a temporary workaround; create a tracked follow-up
by opening an issue that references validateOperandVersions, the operands set
(including "oauth-apiserver" and "oauth-openshift"), and the flag
newExternalOIDCArchitectureEnabled, describing that full validation for
oauth-apiserver should be restored once the re-architecture finishes; add the
issue ID to the TODO comment so future reviewers can find the tracking ticket.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c35d9686-19f1-49fe-a886-47226120b00b

📥 Commits

Reviewing files that changed from the base of the PR and between 562dc8c and e12da8f.

📒 Files selected for processing (9)
  • bindata/oauth-apiserver/externaloidc-deploy.yaml
  • pkg/controllers/common/external_oidc.go
  • pkg/controllers/common/external_oidc_test.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
  • pkg/operator/workload/testdata/sync_ds_scenario_4.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_5.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_6.yaml
  • test/e2e-oidc/external_oidc_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/controllers/common/external_oidc_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/controllers/common/external_oidc.go

Comment thread pkg/operator/workload/sync_openshift_oauth_apiserver.go
@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch from e12da8f to 7252295 Compare April 9, 2026 19:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/e2e-oidc/external_oidc_test.go (1)

68-69: Use an “external mode active” flag here, not just gate state.

Per the PR objective, the new path is selected only when auth type is OIDC and the feature gate is enabled. This boolean is later used to skip resource/condition/version assertions, so on gate-enabled clusters the IntegratedOAuth phases stop validating parts of the standard oauth-apiserver path.

Please derive and pass a flag that reflects the active mode, not just FeatureGateExternalOIDCExternalClaimsSourcing.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/e2e-oidc/external_oidc_test.go` around lines 68 - 69, The current
boolean newExternalOIDCArchitectureEnabled only reflects the feature gate;
change it to represent "external mode active" by computing a flag that is true
only when the cluster auth type is OIDC and the feature gate is enabled (e.g.,
externalModeActive := (authType == "OIDC") && featureGateEnabled(testCtx,
testClient.configClient,
features.FeatureGateExternalOIDCExternalClaimsSourcing)). Replace uses of
newExternalOIDCArchitectureEnabled with this externalModeActive when passing
into the IntegratedOAuth phase checks and when deciding to skip
resource/condition/version assertions so the new path is selected only when both
auth type and gate are satisfied. Ensure you read auth type from the same config
source used elsewhere in the test and keep the original featureGateEnabled call.
🤖 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/common/external_oidc.go`:
- Around line 96-113: The ExternalOIDC feature-gated branch reads from
c.oaasConfigMapLister without ensuring the informer cache is synced; add a
pre-check using c.oaasNamespaceConfigMapsInformer.HasSynced() before calling
ConfigMaps(...).Get(...) and return false with an error like "AuthConfigChecker
oaas configmaps informer has not synced yet" if it hasn't synced, so the code in
the featureGates.Enabled(features.FeatureGateExternalOIDCExternalClaimsSourcing)
block follows the same informer sync pattern as the rest of AuthConfigChecker.

---

Nitpick comments:
In `@test/e2e-oidc/external_oidc_test.go`:
- Around line 68-69: The current boolean newExternalOIDCArchitectureEnabled only
reflects the feature gate; change it to represent "external mode active" by
computing a flag that is true only when the cluster auth type is OIDC and the
feature gate is enabled (e.g., externalModeActive := (authType == "OIDC") &&
featureGateEnabled(testCtx, testClient.configClient,
features.FeatureGateExternalOIDCExternalClaimsSourcing)). Replace uses of
newExternalOIDCArchitectureEnabled with this externalModeActive when passing
into the IntegratedOAuth phase checks and when deciding to skip
resource/condition/version assertions so the new path is selected only when both
auth type and gate are satisfied. Ensure you read auth type from the same config
source used elsewhere in the test and keep the original featureGateEnabled call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b05dd5f7-fe19-48df-bc7c-354a3fa6ec3a

📥 Commits

Reviewing files that changed from the base of the PR and between e12da8f and 7252295.

📒 Files selected for processing (12)
  • bindata/oauth-apiserver/externaloidc-deploy.yaml
  • pkg/controllers/common/external_oidc.go
  • pkg/controllers/common/external_oidc_test.go
  • pkg/controllers/routercerts/controller_test.go
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
  • pkg/operator/starter.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
  • pkg/operator/workload/testdata/sync_ds_scenario_4.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_5.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_6.yaml
  • test/e2e-oidc/external_oidc_test.go
✅ Files skipped from review due to trivial changes (2)
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
  • pkg/controllers/common/external_oidc_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/operator/starter.go

Comment thread pkg/controllers/common/external_oidc.go
@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch 3 times, most recently from ee49819 to 2fa3418 Compare April 10, 2026 18:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/operator/workload/sync_openshift_oauth_apiserver_test.go (1)

6-6: Consider replacing deprecated ioutil import.

io/ioutil is deprecated since Go 1.16. Consider using io.ReadAll instead.

♻️ Suggested fix
-	"io/ioutil"
+	"io"

And at line 548:

-	data, err := ioutil.ReadAll(file)
+	data, err := io.ReadAll(file)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/workload/sync_openshift_oauth_apiserver_test.go` at line 6,
Replace the deprecated "io/ioutil" import with "io" and update all usages of
ioutil.ReadAll to io.ReadAll (e.g., replace ioutil.ReadAll calls found in the
tests around the existing ReadAll usage) ensuring error handling and types
remain the same; update the import list to remove "io/ioutil" and add "io".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/operator/workload/sync_openshift_oauth_apiserver_test.go`:
- Line 6: Replace the deprecated "io/ioutil" import with "io" and update all
usages of ioutil.ReadAll to io.ReadAll (e.g., replace ioutil.ReadAll calls found
in the tests around the existing ReadAll usage) ensuring error handling and
types remain the same; update the import list to remove "io/ioutil" and add
"io".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 84e4aa71-dff6-4654-8540-9db87a6f228e

📥 Commits

Reviewing files that changed from the base of the PR and between 7252295 and 2fa3418.

📒 Files selected for processing (12)
  • bindata/oauth-apiserver/externaloidc-deploy.yaml
  • pkg/controllers/common/external_oidc.go
  • pkg/controllers/common/external_oidc_test.go
  • pkg/controllers/routercerts/controller_test.go
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
  • pkg/operator/starter.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
  • pkg/operator/workload/testdata/sync_ds_scenario_4.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_5.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_6.yaml
  • test/e2e-oidc/external_oidc_test.go
✅ Files skipped from review due to trivial changes (1)
  • test/e2e-oidc/external_oidc_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
  • pkg/controllers/common/external_oidc_test.go

@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch from 2fa3418 to 943edc6 Compare April 13, 2026 17:54
@openshift-ci-robot

openshift-ci-robot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

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

Details

In response to this:

Description

This PR updates the cluster-authentication-operator to deploy the oauth-apiserver in the new external OIDC mode when the authentication type is set to OIDC and the new ExternalOIDCExternalClaimsSourcing feature gate is enabled.

Currently, this feature gate is only enabled in DevPreviewNoUpgrade.

For more information as to the motivation of this change, see openshift/enhancements#1907

Summary by CodeRabbit

Release Notes

  • New Features

  • Introduced new external OIDC authentication architecture with dedicated api-server deployment option

  • Added feature gate to enable/disable new OIDC external claims sourcing capability

  • Integrated automatic configuration synchronization for external OIDC scenarios

  • Refactor

  • Updated OIDC availability detection to support both legacy and new architecture paths

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 coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
pkg/operator/workload/sync_openshift_oauth_apiserver_test.go (1)

164-348: Add one OIDCAvailable() error-path scenario.

The new cases cover true and false, but not the third outcome from syncDeployment() when authConfigChecker.OIDCAvailable() returns an error. Since the mock already supports err, a single failing scenario here would lock down the new feature-gated branch.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/operator/workload/sync_openshift_oauth_apiserver_test.go` around lines
164 - 348, Add a test case in the table that exercises the error path from
authConfigChecker.OIDCAvailable() (used by syncDeployment) by using the existing
mockAuthConfigChecker with its err field set (e.g. err: fmt.Errorf("...")).
Model the new case on one of the existing entries (use a new golden file like
./testdata/sync_ds_scenario_7.yaml) and set authConfigChecker:
&mockAuthConfigChecker{err: someError} and expectedActions to match the behavior
of syncDeployment when OIDCAvailable() returns an error (mirror the assertions
used for the non-available branch to lock down that feature-gated branch).
🤖 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/common/external_oidc.go`:
- Around line 110-117: The OIDCAvailable function currently treats the presence
of the openshift-oauth-apiserver/auth-config ConfigMap as sufficient; change the
logic (in OIDCAvailable where you call
c.oaasConfigMapLister.ConfigMaps("openshift-oauth-apiserver").Get("auth-config"))
to also verify the ConfigMap contains the required "auth-config.json" key (and
that its value is non-empty/valid payload) before returning true; if the key is
missing or empty return false, nil, and if needed return a formatted error on
retrieval failures as before.

In `@pkg/operator/replacement_starter.go`:
- Line 146: The MOM starter hardcodes featureGateAccessor via
staticFeatureGateAccessor disabling
features.FeatureGateExternalOIDCExternalClaimsSourcing, causing
CreateOperatorInputFromMOM (invoked from RunApplyConfiguration) to ignore live
cluster gates; change featureGateAccessor to consult live gates instead of
statically disabling that feature (e.g., remove the forced-disabled entry and
use the same live feature gate accessor used by the normal starter or pass
through the real featureGateAccessor), ensuring CreateOperatorInputFromMOM sees
the actual state of features.FeatureGateExternalOIDCExternalClaimsSourcing.

---

Nitpick comments:
In `@pkg/operator/workload/sync_openshift_oauth_apiserver_test.go`:
- Around line 164-348: Add a test case in the table that exercises the error
path from authConfigChecker.OIDCAvailable() (used by syncDeployment) by using
the existing mockAuthConfigChecker with its err field set (e.g. err:
fmt.Errorf("...")). Model the new case on one of the existing entries (use a new
golden file like ./testdata/sync_ds_scenario_7.yaml) and set authConfigChecker:
&mockAuthConfigChecker{err: someError} and expectedActions to match the behavior
of syncDeployment when OIDCAvailable() returns an error (mirror the assertions
used for the non-available branch to lock down that feature-gated branch).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c165be09-80e3-4cbb-a250-c52b275610a9

📥 Commits

Reviewing files that changed from the base of the PR and between 2fa3418 and 943edc6.

📒 Files selected for processing (13)
  • bindata/oauth-apiserver/externaloidc-deploy.yaml
  • pkg/controllers/common/external_oidc.go
  • pkg/controllers/common/external_oidc_test.go
  • pkg/controllers/routercerts/controller_test.go
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
  • pkg/operator/replacement_starter.go
  • pkg/operator/starter.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver_test.go
  • pkg/operator/workload/testdata/sync_ds_scenario_4.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_5.yaml
  • pkg/operator/workload/testdata/sync_ds_scenario_6.yaml
  • test/e2e-oidc/external_oidc_test.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/controllers/webhookauthenticator/webhookauthenticator_controller.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • pkg/controllers/routercerts/controller_test.go
  • pkg/operator/workload/sync_openshift_oauth_apiserver.go
  • test/e2e-oidc/external_oidc_test.go
  • pkg/controllers/common/external_oidc_test.go
  • pkg/operator/starter.go

Comment thread pkg/controllers/common/external_oidc.go
Comment thread pkg/operator/replacement_starter.go
@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch from 943edc6 to 147d959 Compare April 13, 2026 19:33
@everettraven

Copy link
Copy Markdown
Contributor Author

Manually verified that the changes work as expected and got a clean run of the oidc e2e tests on a devpreview enabled clusterbot cluster.

/verified by @everettraven

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 13, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@everettraven: This PR has been marked as verified by @everettraven.

Details

In response to this:

Manually verified that the changes work as expected and got a clean run of the oidc e2e tests on a devpreview enabled clusterbot cluster.

/verified by @everettraven

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 removed the verified Signifies that the PR passed pre-merge verification criteria label Apr 13, 2026
@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch from 8d1117c to 9d561be Compare April 13, 2026 20:01
@everettraven

Copy link
Copy Markdown
Contributor Author

/retest-required

name string
authInformerSynced bool
kasInformerSynced bool
cmInformerSynced bool

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just checking if there is a reason why we don't have oaasInformerSynced bool ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cmInformerSynced is the thing that is used for both the oauth-apiserver and kube-apiserver namespaced configmap informers.

This means the new line in external_oidc.go that checks if the oauth-apiserver namespaced configmap informer has synced technically would never have it's error return path validated as part of our tests. I didn't feel like covering that path was all that necessary as it is pretty straightforward behavior.

kasInformerSynced is a separate informer entirely to watch for changes to the KubeAPIServer type that is used to communicate the state of the kube-apiserver configuration. This was necessary for the older architecture so that we could ensure that all instances of the kube-apiserver were successfully configured and running with the new OIDC authentication mode before removing the oauth-apiserver.

There isn't a need for us to do this same check here because the oauth-apiserver will always be deployed and all kube-apiserver instances will be configured to communicate with it.

@ehearne-redhat ehearne-redhat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I have one concern about not checking oaasInformerSynced not being included in testing, but other than that changes look fine.

@ehearne-redhat

Copy link
Copy Markdown

@everettraven What I would also like to know is if you know why some tests are failing? I can see they are also failing for others too.

@everettraven

Copy link
Copy Markdown
Contributor Author

@everettraven What I would also like to know is if you know why some tests are failing? I can see they are also failing for others too.

All the tests that contain encryption in the name are optional and seem to be related to the KMS feature that is currently in development. They seem to be failing due to issues related to the work to add/migrate tests for this feature to the openshift-tests-extension pattern.

The required tests that are failing are:

  • e2e-oidc and e2e-oidc-techpreview - From what it looks like, these are also related to wider CI issues but I am going to run these tests against a fresh non-devpreview 4.22 cluster to verify it doesn't have to do with the changes I've made in this PR.
  • e2e-agnostic - This one looks to be failing due to the known kubelet version issue affecting pre-submit jobs.

@everettraven

Copy link
Copy Markdown
Contributor Author

/retest-required

Comment thread pkg/operator/workload/sync_openshift_oauth_apiserver.go Outdated
Comment thread pkg/operator/starter.go Outdated
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
@everettraven
everettraven force-pushed the feature/eoidc-ec-oauth-new-deploy branch from 9d561be to 44a8076 Compare April 16, 2026 11:20
@liouk

liouk commented Apr 16, 2026

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 16, 2026
@everettraven

Copy link
Copy Markdown
Contributor Author

/verified by @everettraven

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 16, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@everettraven: This PR has been marked as verified by @everettraven.

Details

In response to this:

/verified by @everettraven

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-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD fac3b50 and 2 for PR HEAD 44a8076 in total

@everettraven

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci

openshift-ci Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

@everettraven: 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/e2e-aws-operator-serial-ote 44a8076 link false /test e2e-aws-operator-serial-ote
ci/prow/e2e-aws-operator-encryption-rotation-serial-ote-2of2 44a8076 link false /test e2e-aws-operator-encryption-rotation-serial-ote-2of2
ci/prow/e2e-aws-operator-encryption-kms-serial-ote-1of2 44a8076 link false /test e2e-aws-operator-encryption-kms-serial-ote-1of2
ci/prow/e2e-aws-operator-encryption-serial-ote-1of2 44a8076 link false /test e2e-aws-operator-encryption-serial-ote-1of2
ci/prow/e2e-aws-operator-parallel-ote 44a8076 link false /test e2e-aws-operator-parallel-ote
ci/prow/e2e-aws-operator-encryption-rotation-serial-ote-1of2 44a8076 link false /test e2e-aws-operator-encryption-rotation-serial-ote-1of2
ci/prow/e2e-aws-operator-encryption-perf-serial-ote-2of2 44a8076 link false /test e2e-aws-operator-encryption-perf-serial-ote-2of2
ci/prow/e2e-aws-operator-encryption-perf-serial-ote-1of2 44a8076 link false /test e2e-aws-operator-encryption-perf-serial-ote-1of2
ci/prow/e2e-aws-operator-encryption-serial-ote-2of2 44a8076 link false /test e2e-aws-operator-encryption-serial-ote-2of2
ci/prow/e2e-aws-operator-encryption-kms-serial-ote-2of2 44a8076 link false /test e2e-aws-operator-encryption-kms-serial-ote-2of2

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.

@ehearne-redhat

Copy link
Copy Markdown

thanks for the explanation @everettraven !

/lgtm

@openshift-ci

openshift-ci Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ehearne-redhat, everettraven, liouk

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

The pull request process is described 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

@liouk

liouk commented Apr 17, 2026

Copy link
Copy Markdown
Member

The e2e-agnostic job is failing due to a known ingress component readiness regression. Since this is the only failure in the most recent run of the job, but also because the changes in this PR are gated in DevPreviewNoUpgrade, we're overriding that job.

/override ci/prow/e2e-agnostic

@openshift-ci

openshift-ci Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@liouk: Overrode contexts on behalf of liouk: ci/prow/e2e-agnostic

Details

In response to this:

The e2e-agnostic job is failing due to a known ingress component readiness regression. Since this is the only failure in the most recent run of the job, but also because the changes in this PR are gated in DevPreviewNoUpgrade, we're overriding that job.

/override ci/prow/e2e-agnostic

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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 1a2579c into openshift:master Apr 17, 2026
15 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants