From 88e3627b92cfd5c58268403c4d10806772447b93 Mon Sep 17 00:00:00 2001 From: Mo Mesgin Date: Fri, 18 Oct 2024 13:21:34 -0700 Subject: [PATCH] add new setting --- .../global_settings/settings-data.ts | 4 +++ .../pages/global-settings/settings-p2.spec.ts | 36 +++++++++++++++++++ shell/assets/translations/en-us.yaml | 1 + shell/config/settings.ts | 5 +++ 4 files changed, 46 insertions(+) diff --git a/cypress/e2e/blueprints/global_settings/settings-data.ts b/cypress/e2e/blueprints/global_settings/settings-data.ts index a6a5d073d87..445a5ded1b5 100644 --- a/cypress/e2e/blueprints/global_settings/settings-data.ts +++ b/cypress/e2e/blueprints/global_settings/settings-data.ts @@ -58,6 +58,10 @@ export const settings = { 'hide-local-cluster': { original: 'false', new: 'true' + }, + 'k3s-based-upgrader-uninstall-concurrency': { + original: '5', + new: '10' } }; export const serverUrlLocalhostCases = [ diff --git a/cypress/e2e/tests/pages/global-settings/settings-p2.spec.ts b/cypress/e2e/tests/pages/global-settings/settings-p2.spec.ts index 4016d40832b..29e200640ae 100644 --- a/cypress/e2e/tests/pages/global-settings/settings-p2.spec.ts +++ b/cypress/e2e/tests/pages/global-settings/settings-p2.spec.ts @@ -398,6 +398,42 @@ describe('Settings', { testIsolation: 'off' }, () => { settingsPage.settingsValue('hide-local-cluster').contains(settings['hide-local-cluster'].original); }); + it('can update k3s-based-upgrader-uninstall-concurrency', { tags: ['@globalSettings', '@adminUser'] }, () => { + // Update setting + SettingsPagePo.navTo(); + settingsPage.editSettingsByLabel('k3s-based-upgrader-uninstall-concurrency'); + + const settingsEdit = settingsPage.editSettings('local', 'k3s-based-upgrader-uninstall-concurrency'); + + settingsEdit.waitForPage(); + settingsEdit.title().contains('Setting: k3s-based-upgrader-uninstall-concurrency').should('be.visible'); + settingsEdit.settingsInput().set(settings['k3s-based-upgrader-uninstall-concurrency'].new); + settingsEdit.saveAndWait('k3s-based-upgrader-uninstall-concurrency').then(({ request, response }) => { + expect(response?.statusCode).to.eq(200); + expect(request.body).to.have.property('value', settings['k3s-based-upgrader-uninstall-concurrency'].new); + expect(response?.body).to.have.property('value', settings['k3s-based-upgrader-uninstall-concurrency'].new); + }); + settingsPage.waitForPage(); + settingsPage.settingsValue('k3s-based-upgrader-uninstall-concurrency').contains(settings['k3s-based-upgrader-uninstall-concurrency'].new); + + // Reset + SettingsPagePo.navTo(); + settingsPage.waitForPage(); + settingsPage.editSettingsByLabel('k3s-based-upgrader-uninstall-concurrency'); + + settingsEdit.waitForPage(); + settingsEdit.title().contains('Setting: k3s-based-upgrader-uninstall-concurrency').should('be.visible'); + settingsEdit.useDefaultButton().click(); + settingsEdit.saveAndWait('k3s-based-upgrader-uninstall-concurrency').then(({ request, response }) => { + expect(response?.statusCode).to.eq(200); + expect(request.body).to.have.property('value', settings['k3s-based-upgrader-uninstall-concurrency'].original); + expect(response?.body).to.have.property('value', settings['k3s-based-upgrader-uninstall-concurrency'].original); + }); + + settingsPage.waitForPage(); + settingsPage.settingsValue('k3s-based-upgrader-uninstall-concurrency').contains(settings['k3s-based-upgrader-uninstall-concurrency'].original); + }); + it.skip('[Vue3 Skip]: can update system-default-registry', { tags: ['@globalSettings', '@adminUser'] }, () => { // Update setting SettingsPagePo.navTo(); diff --git a/shell/assets/translations/en-us.yaml b/shell/assets/translations/en-us.yaml index b5fe15fb321..37c81f1db8f 100644 --- a/shell/assets/translations/en-us.yaml +++ b/shell/assets/translations/en-us.yaml @@ -7413,6 +7413,7 @@ advancedSettings: 'brand': Folder name for an alternative theme defined in '/assets/brand' 'hide-local-cluster': Hide the local cluster 'agent-tls-mode': "Rancher Certificate Verification. In `strict` mode the agents (system, cluster, fleet, etc) will only trust Rancher installations which are using a certificate signed by the CABundle in the `cacerts` setting. When the mode is system-store, the agents will trust any certificate signed by a CABundle in the operating system’s trust store." + 'k3s-based-upgrader-uninstall-concurrency': Defines the maximum number of clusters in which Rancher can concurrently uninstall the legacy rancher-k3s-upgrader or rancher-rke2-upgrader app from imported K3s or RKE2 clusters. warnings: 'agent-tls-mode': 'Changing this setting will cause all agents to be redeployed.' editHelp: diff --git a/shell/config/settings.ts b/shell/config/settings.ts index b23facdd760..a25bdb1eb72 100644 --- a/shell/config/settings.ts +++ b/shell/config/settings.ts @@ -108,6 +108,7 @@ export const SETTING = { USER_LAST_LOGIN_DEFAULT: 'user-last-login-default', DISABLE_INACTIVE_USER_AFTER: 'disable-inactive-user-after', DELETE_INACTIVE_USER_AFTER: 'delete-inactive-user-after', + K3S_UPGRADER_UNINSTALL_CONCURRENCY: 'k3s-based-upgrader-uninstall-concurrency' } as const; // These are the settings that are allowed to be edited via the UI @@ -165,6 +166,10 @@ export const ALLOWED_SETTINGS: GlobalSetting = { options: ['strict', 'system-store'], warning: 'agent-tls-mode' }, + [SETTING.K3S_UPGRADER_UNINSTALL_CONCURRENCY]: { + kind: 'integer', + ruleSet: [{ name: 'minValue', factoryArg: 1 }] + } }; /**