Skip to content
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

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions controller/setting_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const (
var (
upgradeCheckInterval = time.Hour
settingControllerResyncPeriod = time.Hour
checkUpgradeURL = "https://longhorn-upgrade-responder.rancher.io/v1/checkupgrade"
)

type SettingController struct {
Expand Down Expand Up @@ -1157,7 +1156,13 @@ func (sc *SettingController) CheckLatestAndStableLonghornVersions() (string, str
if err := json.NewEncoder(&content).Encode(req); err != nil {
return "", "", err
}
r, err := http.Post(checkUpgradeURL, "application/json", &content)

upgradeResponderURL, err := sc.ds.GetSettingValueExisted(types.SettingNameUpgradeResponderURL)
if err != nil {
return "", "", err
}

r, err := http.Post(upgradeResponderURL, "application/json", &content)
if err != nil {
return "", "", err
}
Expand Down
13 changes: 13 additions & 0 deletions types/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (
SettingNameStorageMinimalAvailablePercentage = SettingName("storage-minimal-available-percentage")
SettingNameStorageReservedPercentageForDefaultDisk = SettingName("storage-reserved-percentage-for-default-disk")
SettingNameUpgradeChecker = SettingName("upgrade-checker")
SettingNameUpgradeResponderURL = SettingName("upgrade-responder-url")
SettingNameAllowCollectingLonghornUsage = SettingName("allow-collecting-longhorn-usage-metrics")
SettingNameCurrentLonghornVersion = SettingName("current-longhorn-version")
SettingNameLatestLonghornVersion = SettingName("latest-longhorn-version")
Expand Down Expand Up @@ -163,6 +164,7 @@ var (
SettingNameStorageMinimalAvailablePercentage,
SettingNameStorageReservedPercentageForDefaultDisk,
SettingNameUpgradeChecker,
SettingNameUpgradeResponderURL,
SettingNameAllowCollectingLonghornUsage,
SettingNameCurrentLonghornVersion,
SettingNameLatestLonghornVersion,
Expand Down Expand Up @@ -283,6 +285,7 @@ var (
SettingNameStorageMinimalAvailablePercentage: SettingDefinitionStorageMinimalAvailablePercentage,
SettingNameStorageReservedPercentageForDefaultDisk: SettingDefinitionStorageReservedPercentageForDefaultDisk,
SettingNameUpgradeChecker: SettingDefinitionUpgradeChecker,
SettingNameUpgradeResponderURL: SettingDefinitionUpgradeResponderURL,
SettingNameAllowCollectingLonghornUsage: SettingDefinitionAllowCollectingLonghornUsageMetrics,
SettingNameCurrentLonghornVersion: SettingDefinitionCurrentLonghornVersion,
SettingNameLatestLonghornVersion: SettingDefinitionLatestLonghornVersion,
Expand Down Expand Up @@ -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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @longhorn/doc

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?

Category: SettingCategoryGeneral,
Type: SettingTypeString,
Required: true,
ReadOnly: false,
Default: "https://longhorn-upgrade-responder.rancher.io/v1/checkupgrade",
}

SettingDefinitionAllowCollectingLonghornUsageMetrics = SettingDefinition{
DisplayName: "Allow Collecting Longhorn Usage Metrics",
Description: "Enabling this setting will allow Longhorn to provide additional usage metrics to https://metrics.longhorn.io/.\n" +
Expand Down
Loading