Fix token auth annotation to use opt-in instead of opt-out#15998
Fix token auth annotation to use opt-in instead of opt-out#15998TheRealJon wants to merge 1 commit intoopenshift:mainfrom
Conversation
Restore correct opt-in behavior for token-auth-aws/azure annotations. Operators must explicitly set the annotation to "true" to show ARN/credential fields in subscription form on STS/WIF clusters. Regression introduced in a931fbd changed logic from opt-in (=== 'true') to opt-out (!== 'false'), causing operators without annotation or with annotation set to "false" to incorrectly show credential fields. This fix ensures Cluster Observability Operator and similar operators with token-auth-aws: "false" don't show ARN field, matching 4.20 behavior. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: TheRealJon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThis change updates the TokenAuth feature gating logic in the operator-hub utilities to enforce stricter validation. The implementation shifts from accepting any value except 'false' to requiring the explicit string 'true' for the awsTokenAuthIsSupported and azureTokenAuthIsSupported conditions. Corresponding test coverage is expanded to validate behavior across multiple scenarios: when annotations are explicitly true, false, or absent for AWS STS and Azure WIF clusters. All existing test inputs are updated to include the new TokenAuth annotations. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
@TheRealJon: The following test 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. |
Summary
Fixes regression where operators without explicit
token-auth-aws: "true"annotation incorrectly show the ARN role field in the subscription form on AWS STS clusters.Problem
Cluster Observability Operator (and similar operators) have
features.operators.openshift.io/token-auth-aws: "false"but the ARN field was still showing in the subscription form on 4.21, even though it worked correctly in 4.20.Root Cause
Regression introduced in commit a931fbd (Sep 9, 2024) during the "Fix JSON annotation parsing issue and harden related code" refactor.
Before refactor (correct opt-in behavior):
After refactor (buggy opt-out behavior):
This changed the logic from opt-in to opt-out:
undefined !== 'false'→true(shows ARN field)'false' !== 'false'→false(hides ARN field)Solution
Restore opt-in behavior by changing condition from
!== 'false'to=== 'true':Now operators must explicitly opt-in by setting the annotation to
"true"to show credential fields.Changes
operator-hub-utils.ts'true'annotations"false"🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests