-
Notifications
You must be signed in to change notification settings - Fork 225
OCM-18278 | fix: Fix OIDC provider detection for classic and BYO OIDC clusters #3002
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
base: master
Are you sure you want to change the base?
Conversation
… clusters Fixes iamserviceaccount creation failures with classic OIDC and BYO OIDC clusters. - Remove early exit for clusters without oidcConfig that caused "does not have OIDC configuration" error - Add fallback logic to use cluster.AWS().STS().OIDCEndpointURL() when cluster ID-based search fails - Implement endpoint URL-based provider detection using existing HasOpenIDConnectProvider function - Add generateOIDCProviderARN helper to construct provider ARN from endpoint URL - Enhanced test coverage for classic OIDC and BYO OIDC scenarios Resolves OCM-18278 and OCM-18279 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cuppett 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 |
@cuppett: all tests passed! 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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3002 +/- ##
==========================================
+ Coverage 27.33% 27.80% +0.47%
==========================================
Files 306 315 +9
Lines 34449 34816 +367
==========================================
+ Hits 9416 9681 +265
- Misses 24384 24481 +97
- Partials 649 654 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asked QE to test and the results are:
Classic non-byooidc still fails due to the same reason, HCP byooidc works, and classic byooidc works
Line 1749 in 77b8741
func (c *awsClient) GetOpenIDConnectProviderByClusterIdTag(clusterID string) (string, error) { |
This function for example is used only for delete oidcprovider
. It seems to do what is needed here. If you look at that old linked function, and the original solution Claude generated in this file, it looks pretty familiar!
If this doesn't work (due to the same tagging issue) - a solution which would work with the EndpointURL
which was grabbed here already exists:
Line 1784 in 77b8741
func (c *awsClient) GetOpenIDConnectProviderByOidcEndpointUrl(oidcEndpointUrl string) (string, error) { |
Which again.. looks very familiar when you look at function linked above VS the code in this MR (except this is a less generic version)
The goal is to get the ARN from the OIDC provider based on the name of the function. We have done this before in other commands such as delete oidcprovider
, list oidcproviders
, etc. And can probably make use of some of the patterns there
At the end of the day, getting the ARN from a cluster's OIDC Provider should be less complex than what is here, because we have an existing function already. To me, it looks like Claude mimicked creating brand-new code by copying this function and editing it to be more specific-purpose (rather than general-purpose like the original function was intended to be)
A failure still exists, meaning we are either missing tests, or test(s) are not set up to correctly reflect the real world scenario we are running into |
Did some more manual testing, I think I found another bug with the merged feature: it is failing to create a role due to invalid policy ARN still creates some resources, when it should fail before making anything, or, delete the resources after failing
|
2 more release-blocker bugs raised for this feature |
PR needs rebase. 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. |
Summary
Fixes iamserviceaccount creation failures with classic OIDC and BYO OIDC clusters that were reporting "no OIDC provider found for cluster" and "does not have OIDC configuration" errors.
Root Cause
The current
getOIDCProviderARN
function has two issues:oidcConfig == nil
causes "does not have OIDC configuration" errorListOidcProviders
by cluster ID fails to find providers that weren't tagged with cluster IDSolution
cluster.AWS().STS().OIDCEndpointURL()
when cluster ID-based search failsHasOpenIDConnectProvider
functiongenerateOIDCProviderARN
helper to construct provider ARN from endpoint URLChanges Made
getOIDCProviderARN
function with fallback detection logicgenerateOIDCProviderARN
helper for ARN constructionTest Plan
Resolves
🤖 Generated with Claude Code