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(support-bundle): add support-bundle-node-collection-timeout setting #2825

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
1 change: 1 addition & 0 deletions controller/setting_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,7 @@ func (info *ClusterInfo) collectSettings() error {
types.SettingNameStorageOverProvisioningPercentage: true,
types.SettingNameStorageReservedPercentageForDefaultDisk: true,
types.SettingNameSupportBundleFailedHistoryLimit: true,
types.SettingNameSupportBundleNodeCollectionTimeout: true,
types.SettingNameSystemManagedPodsImagePullPolicy: true,
types.SettingNameV1DataEngine: true,
types.SettingNameV2DataEngine: true,
Expand Down
13 changes: 11 additions & 2 deletions controller/support_bundle_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,20 @@ func (c *SupportBundleController) createSupportBundleManagerDeployment(supportBu
}
registrySecret := registrySecretSetting.Value

newSupportBundleManager, err := c.newSupportBundleManager(supportBundle, nodeSelector, imagePullPolicy, priorityClass, registrySecret)
nodeCollectionTimeoutMinute, err := c.ds.GetSettingAsInt(types.SettingNameSupportBundleNodeCollectionTimeout)
if err != nil {
return nil, errors.Wrap(err, "failed to get support bundle node collection timeout setting before creating support bundle manager deployment")
}

newSupportBundleManager, err := c.newSupportBundleManager(supportBundle, nodeSelector, imagePullPolicy, priorityClass, registrySecret, nodeCollectionTimeoutMinute)
if err != nil {
return nil, errors.Wrap(err, "failed to create new support bundle manager")
}
return c.ds.CreateDeployment(newSupportBundleManager)
}

func (c *SupportBundleController) newSupportBundleManager(supportBundle *longhorn.SupportBundle, nodeSelector map[string]string,
imagePullPolicy corev1.PullPolicy, priorityClass, registrySecret string) (*appsv1.Deployment, error) {
imagePullPolicy corev1.PullPolicy, priorityClass, registrySecret string, nodeCollectionTimeoutMinute int64) (*appsv1.Deployment, error) {

tolerationSetting, err := c.ds.GetSettingWithAutoFillingRO(types.SettingNameTaintToleration)
if err != nil {
Expand Down Expand Up @@ -760,6 +765,10 @@ func (c *SupportBundleController) newSupportBundleManager(supportBundle *longhor
Name: "SUPPORT_BUNDLE_TAINT_TOLERATION",
Value: c.getTaintTolerationString(tolerationSetting),
},
{
Name: "SUPPORT_BUNDLE_NODE_TIMEOUT",
Value: fmt.Sprintf("%dm", nodeCollectionTimeoutMinute),
},
},
Ports: []corev1.ContainerPort{
{
Expand Down
17 changes: 17 additions & 0 deletions types/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const (
SettingNameRecurringFailedJobsHistoryLimit = SettingName("recurring-failed-jobs-history-limit")
SettingNameRecurringJobMaxRetention = SettingName("recurring-job-max-retention")
SettingNameSupportBundleFailedHistoryLimit = SettingName("support-bundle-failed-history-limit")
SettingNameSupportBundleNodeCollectionTimeout = SettingName("support-bundle-node-collection-timeout")
SettingNameDeletingConfirmationFlag = SettingName("deleting-confirmation-flag")
SettingNameEngineReplicaTimeout = SettingName("engine-replica-timeout")
SettingNameSnapshotDataIntegrity = SettingName("snapshot-data-integrity")
Expand Down Expand Up @@ -187,6 +188,7 @@ var (
SettingNameRecurringFailedJobsHistoryLimit,
SettingNameRecurringJobMaxRetention,
SettingNameSupportBundleFailedHistoryLimit,
SettingNameSupportBundleNodeCollectionTimeout,
SettingNameDeletingConfirmationFlag,
SettingNameEngineReplicaTimeout,
SettingNameSnapshotDataIntegrity,
Expand Down Expand Up @@ -299,6 +301,7 @@ var (
SettingNameRecurringFailedJobsHistoryLimit: SettingDefinitionRecurringFailedJobsHistoryLimit,
SettingNameRecurringJobMaxRetention: SettingDefinitionRecurringJobMaxRetention,
SettingNameSupportBundleFailedHistoryLimit: SettingDefinitionSupportBundleFailedHistoryLimit,
SettingNameSupportBundleNodeCollectionTimeout: SettingDefinitionSupportBundleNodeCollectionTimeout,
SettingNameDeletingConfirmationFlag: SettingDefinitionDeletingConfirmationFlag,
SettingNameEngineReplicaTimeout: SettingDefinitionEngineReplicaTimeout,
SettingNameSnapshotDataIntegrity: SettingDefinitionSnapshotDataIntegrity,
Expand Down Expand Up @@ -1057,6 +1060,20 @@ var (
},
}

SettingDefinitionSupportBundleNodeCollectionTimeout = SettingDefinition{
DisplayName: "Timeout for Support Bundle Node Collection",
Description: "In minutes. The timeout for collecting node bundles for support bundle generation. The default value is 30.\n\n" +
"When the timeout is reached, the support bundle generation will proceed without requiring the collection of node bundles. \n\n",
Category: SettingCategoryGeneral,
Type: SettingTypeInt,
Required: true,
ReadOnly: false,
Default: "30",
ValueIntRange: map[string]int{
ValueIntRangeMinimum: 0,
},
}

SettingDefinitionDeletingConfirmationFlag = SettingDefinition{
DisplayName: "Deleting Confirmation Flag",
Description: "This flag is designed to prevent Longhorn from being accidentally uninstalled which will lead to data lost. \n\n" +
Expand Down