Added service account to dev branch#2318
Conversation
|
@NicholasYancey: This pull request references OADP-8448 which is a valid jira issue. 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. |
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
WalkthroughThe CLI and VMDP controllers now create dedicated ServiceAccounts with token automounting disabled, configure their server Deployments to use them, and update existing Deployments when fields are missing or outdated. Unit tests cover ServiceAccount and Deployment construction and reconciliation. ChangesDownload server ServiceAccounts
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Controller
participant KubernetesAPI
participant ServerDeployment
Controller->>KubernetesAPI: Get or create dedicated ServiceAccount
Controller->>KubernetesAPI: Reconcile labels, owner reference, and token automount
Controller->>KubernetesAPI: Get server Deployment
Controller->>ServerDeployment: Apply probes and ServiceAccount settings
Controller->>KubernetesAPI: Update Deployment when fields differ
Controller->>KubernetesAPI: Reconcile Route and ConsoleCLIDownload
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@NicholasYancey: No Jira issue is referenced in the title of this pull request. 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. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/controller/cli_download_controller.go`:
- Around line 133-136: Reconcile AutomountServiceAccountToken independently from
the ServiceAccountName condition in the Deployment update logic. Update both
internal/controller/cli_download_controller.go lines 133-136 and
internal/controller/vmdp_download_controller.go lines 128-131 so each desired
field is compared and applied independently, ensuring token automounting is
reset to the desired value even when the ServiceAccount name already matches.
🪄 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: Enterprise
Run ID: 662acb2e-f815-42d8-8a2a-def3c9bdc37e
📒 Files selected for processing (4)
internal/controller/cli_download_controller.gointernal/controller/cli_download_controller_test.gointernal/controller/vmdp_download_controller.gointernal/controller/vmdp_download_controller_test.go
kaovilai
left a comment
There was a problem hiding this comment.
Consider reconciling the ServiceAccount object itself when it already exists.
Right now, the controllers create the dedicated ServiceAccounts when missing, but if the ServiceAccount already exists with:
AutomountServiceAccountToken unset or true
missing/incorrect labels
missing owner reference
…it looks like the code does not update it.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/controller/cli_download_controller_test.go`:
- Line 85: Update each of the four reconcileCLIResources calls in the affected
tests to capture and explicitly assert or log the returned error instead of
assigning it to blank. Preserve the tests’ expected failure flow and subsequent
fakeClient.Get assertions, while ensuring any reconcile error is surfaced with
useful test context.
In `@internal/controller/vmdp_download_controller_test.go`:
- Line 59: Update all four reconcileVMDPResources calls in the VMDP controller
tests to handle the returned error using the same documented pattern as the CLI
test file, rather than discarding it with “_”. Preserve the existing test
rationale for the unregistered Route/Console step while applying the shared fix
consistently.
🪄 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: Enterprise
Run ID: beefde83-92fa-472e-86b7-1e267bce8a15
📒 Files selected for processing (4)
internal/controller/cli_download_controller.gointernal/controller/cli_download_controller_test.gointernal/controller/vmdp_download_controller.gointernal/controller/vmdp_download_controller_test.go
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kaovilai, NicholasYancey, weshayutin 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 |
|
@NicholasYancey: all tests passed! 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. |
|
/cherry-pick oadp-1.6 |
|
@NicholasYancey: new pull request created: #2320 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 kubernetes-sigs/prow repository. |
Why the changes were made
The CLI and VMDP download server pods on oadp-dev currently run with no ServiceAccount specified, defaulting to the namespace's default ServiceAccount. This fails Telco/CNF certification:
access-control-pod-service-account requires every pod to use a non-default ServiceAccount. This same fix was already backported directly to oadp-1.3 (#2310), oadp-1.4 (#2312), and oadp-1.5 (#2309), but was never to oadp-dev as that branch only picked up readiness/liveness probes via #2306. This PR closes that gap on oadp-dev, covering both the CLI and VMDP servers.
How to test the changes made
How to test the changes made
oc get deploy -n openshift-adp openshift-adp-oadp-cli-server openshift-adp-oadp-vmdp-server \ -o jsonpath='{.spec.template.spec.serviceAccountName}{"\n"}'Summary by CodeRabbit
Security
Bug Fixes
Tests