AGENT-1136, AGENT-1229: Add auth to unconfigured-ignition#10381
AGENT-1136, AGENT-1229: Add auth to unconfigured-ignition#10381zaneb wants to merge 4 commits intoopenshift:mainfrom
Conversation
|
@zaneb: This pull request references AGENT-1136 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. This pull request references AGENT-1236 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 epic to target the "4.22.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. |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughRemoved token expiry from ignition template data and getTemplateData; added gencrypto.AuthConfig as a dependency and populated ignition templates with authentication fields (public key and tokens); updated rendezvous file permissions to 0600; adjusted agent UI systemd unit ExecStart to export Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.11.3)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Comment |
|
/cc @pawanpinjarkar |
|
Skipping CI for Draft Pull Request. |
|
@zaneb: This pull request references AGENT-1136 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. This pull request references AGENT-1236 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 epic to target the "4.22.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. |
ddd11e4 to
8a341bd
Compare
|
@zaneb: This pull request references AGENT-1136 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. This pull request references AGENT-1229 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. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
@zaneb: This pull request references AGENT-1136 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. This pull request references AGENT-1229 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. 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. |
8a341bd to
bda1e88
Compare
|
/jira refresh |
|
@zaneb: This pull request references AGENT-1136 which is a valid jira issue. This pull request references AGENT-1229 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. |
|
@zaneb: This pull request references AGENT-1136 which is a valid jira issue. This pull request references AGENT-1229 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. |
The UI can use this token to authenticate to the assisted-service API.
bda1e88 to
351ef05
Compare
|
@zaneb: This pull request references AGENT-1136 which is a valid jira issue. This pull request references AGENT-1229 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. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
pkg/asset/agent/image/ignition.go (1)
437-442: Reduce positional-argument risk ingetTemplateData.Line 438 now contributes to a long list of same-typed string args, which is brittle and easy to misorder (especially auth-related fields). Prefer a single input struct (or passing
*agentTemplateDatadirectly) to make call sites self-documenting.As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/asset/agent/image/ignition.go` around lines 437 - 442, The getTemplateData function currently takes many same-typed string and int parameters which is brittle; refactor it to accept a single parameter (either a pointer to agentTemplateData or a new input struct) instead of the long positional list so call sites become self-documenting and order-safe; update the getTemplateData signature (replace the long parameter list including name, pullSecret, releaseImageList, releaseImage, releaseImageMirror, publicContainerRegistries, imageTypeISO, infraEnvID, publicKey, authType, agentAuthToken, userAuthToken, watcherAuthToken, caBundleMount, haveMirrorConfig, numMasters, numArbiters, numWorkers, osImage, proxy) to take *agentTemplateData (or a dedicated struct), adapt all callers to construct and pass that struct, and ensure any field-level validation or defaults previously done inside getTemplateData are preserved after the change.pkg/asset/agent/image/unconfigured_ignition_test.go (1)
100-100: Add content assertions for auth output, not only dependency wiring.Line 100 adds
gencrypto.AuthConfig, but this test still mainly checks file existence. Add assertions for auth-bearing output (for example/etc/assisted/rendezvous-host.env.templatecontainingUSER_AUTH_TOKENandPULL_SECRET_TOKEN) so auth regressions are caught directly.As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/asset/agent/image/unconfigured_ignition_test.go` at line 100, The test currently only asserts dependency wiring when adding gencrypto.AuthConfig; extend it to assert the generated auth-bearing output contents as well by reading the produced template file (e.g., the `/etc/assisted/rendezvous-host.env.template` artifact created by the test) and asserting it contains the expected tokens/keys such as `USER_AUTH_TOKEN` and `PULL_SECRET_TOKEN`. Update the test that references gencrypto.AuthConfig in unconfigured_ignition_test.go to open the created asset (use the same helper/variable that locates produced files in that test), assert the file exists, then assert its contents include those exact substrings so auth regressions are caught. Ensure assertions reference the test helper/variable names already used in the file to locate the output file.
🤖 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/asset/agent/image/unconfigured_ignition.go`:
- Around line 166-170: The template data includes sensitive bearer tokens
(AgentAuthToken, UserAuthToken, WatcherAuthToken) which are then written to
/etc/assisted/rendezvous-host.env.template and /etc/assisted/rendezvous-host.env
with mode 0644; update the file write operations to use stricter permissions
(e.g., 0600 or 0640 depending on group requirements) so only the owner (and
optionally group) can read them, and ensure any helper that creates these files
or calls os.WriteFile / io.Write* sets the new mode consistently for both the
template and final file; change permission constants where
rendezvous-host.env.template and rendezvous-host.env are created/closed and add
a comment noting sensitive content handling.
---
Nitpick comments:
In `@pkg/asset/agent/image/ignition.go`:
- Around line 437-442: The getTemplateData function currently takes many
same-typed string and int parameters which is brittle; refactor it to accept a
single parameter (either a pointer to agentTemplateData or a new input struct)
instead of the long positional list so call sites become self-documenting and
order-safe; update the getTemplateData signature (replace the long parameter
list including name, pullSecret, releaseImageList, releaseImage,
releaseImageMirror, publicContainerRegistries, imageTypeISO, infraEnvID,
publicKey, authType, agentAuthToken, userAuthToken, watcherAuthToken,
caBundleMount, haveMirrorConfig, numMasters, numArbiters, numWorkers, osImage,
proxy) to take *agentTemplateData (or a dedicated struct), adapt all callers to
construct and pass that struct, and ensure any field-level validation or
defaults previously done inside getTemplateData are preserved after the change.
In `@pkg/asset/agent/image/unconfigured_ignition_test.go`:
- Line 100: The test currently only asserts dependency wiring when adding
gencrypto.AuthConfig; extend it to assert the generated auth-bearing output
contents as well by reading the produced template file (e.g., the
`/etc/assisted/rendezvous-host.env.template` artifact created by the test) and
asserting it contains the expected tokens/keys such as `USER_AUTH_TOKEN` and
`PULL_SECRET_TOKEN`. Update the test that references gencrypto.AuthConfig in
unconfigured_ignition_test.go to open the created asset (use the same
helper/variable that locates produced files in that test), assert the file
exists, then assert its contents include those exact substrings so auth
regressions are caught. Ensure assertions reference the test helper/variable
names already used in the file to locate the output file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3b458534-d808-4a2e-afa9-9476ce15db22
📒 Files selected for processing (5)
data/data/agent/systemd/units/agent-ui.service.templatepkg/asset/agent/image/ignition.gopkg/asset/agent/image/ignition_test.gopkg/asset/agent/image/unconfigured_ignition.gopkg/asset/agent/image/unconfigured_ignition_test.go
This file contains auth tokens now, so we should reduce the permissions.
This adds auth support to the unconfigured-ignition. This has no effect on the appliance, because all of the relevant files are overwritten by the config ISO when it is attached so it is the config ISO that ultimately controls the auth settings. However, for the interactive installer, this means that the unconfigured-ignition generated by assisted-service will contain the necessary keys/tokens and config to enable auth.
351ef05 to
448f168
Compare
This adds auth support to the unconfigured-ignition. This has no effect
on the appliance, because all of the relevant files are overwritten by
the config ISO when it is attached so it is the config ISO that
ultimately controls the auth settings.
However, for the interactive installer, this means that the
unconfigured-ignition generated by assisted-service will contain the
necessary keys/tokens and config to enable auth.
This change depends on openshift-assisted/assisted-installer-ui#3454