-
Notifications
You must be signed in to change notification settings - Fork 153
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
feat(setting): add upgrade-responder-url setting #3591
Conversation
WalkthroughThis pull request modifies how the upgrade responder URL is managed. In the controller, the previously hardcoded URL is removed and replaced by dynamically fetching the URL from the datastore within the Changes
Sequence Diagram(s)sequenceDiagram
participant SC as SettingController
participant DS as DataStore
participant US as Upgrade Service
SC->>DS: Retrieve upgradeResponderURL setting
DS-->>SC: Return dynamic URL
SC->>US: Send HTTP POST request to URL
US-->>SC: Return version information
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Longhorn 10437 Signed-off-by: Derek Su <derek.su@suse.com>
a07ce94
to
33382f7
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
controller/setting_controller.go (1)
1159-1166
: LGTM with a security suggestion.The change to make the upgrade responder URL configurable improves flexibility. However, consider adding URL validation to ensure only trusted URLs are used.
Add URL validation before using it in the HTTP POST request:
upgradeResponderURL, err := sc.ds.GetSettingValueExisted(types.SettingNameUpgradeResponderURL) if err != nil { return "", "", err } + +// Validate the URL +if _, err := url.ParseRequestURI(upgradeResponderURL); err != nil { + return "", "", fmt.Errorf("invalid upgrade responder URL: %v", err) +} r, err := http.Post(upgradeResponderURL, "application/json", &content)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
controller/setting_controller.go
(1 hunks)types/setting.go
(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- types/setting.go
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build binaries
- GitHub Check: Summary
@mergify backport v1.8.x |
✅ Backports have been created
|
@@ -585,6 +588,16 @@ var ( | |||
Default: "true", | |||
} | |||
|
|||
SettingDefinitionUpgradeResponderURL = SettingDefinition{ | |||
DisplayName: "Upgrade Responder URL", | |||
Description: "The upgrade responder notifies users the available versions of Longhorn for upgrade", |
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.
cc @longhorn/doc
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.
Just to clarify, the notification actually mentions the available versions? Or is it a generic notification that a new version (relevant to what is installed) is available?
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.
I have a question about the Upgrade Responder URL description.
@@ -585,6 +588,16 @@ var ( | |||
Default: "true", | |||
} | |||
|
|||
SettingDefinitionUpgradeResponderURL = SettingDefinition{ | |||
DisplayName: "Upgrade Responder URL", | |||
Description: "The upgrade responder notifies users the available versions of Longhorn for upgrade", |
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.
Just to clarify, the notification actually mentions the available versions? Or is it a generic notification that a new version (relevant to what is installed) is available?
Which issue(s) this PR fixes:
Issue longhorn/longhorn#10437
What this PR does / why we need it:
Special notes for your reviewer:
Additional documentation or context