From fb01a8d683aa2b51e02526eefc23c65060c201dd Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Tue, 5 Nov 2024 16:15:57 -0600 Subject: [PATCH] Add UI for setting inventory memory limits There are currently knobs that can be used to adjust the memory limit for the `main` container, but not for the `inventory` container. This can cause the inventory container to go into a crash loop on a large deployment. Add the ability to bump the inventory memory limit to avoid this. Fixes: https://issues.redhat.com/browse/MTV-1504 Signed-off-by: Jonathon Jongsma --- .../en/plugin__forklift-console-plugin.json | 5 ++ .../modal/EditInventoryMemoryLimitModal.tsx | 50 +++++++++++++++++++ .../src/modules/Overview/modal/index.ts | 1 + .../tabs/Details/cards/SettingsCard.tsx | 23 +++++++++ 4 files changed, 79 insertions(+) create mode 100644 packages/forklift-console-plugin/src/modules/Overview/modal/EditInventoryMemoryLimitModal.tsx diff --git a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json index 1ca9f92e7..e3448bcb9 100644 --- a/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json +++ b/packages/forklift-console-plugin/locales/en/plugin__forklift-console-plugin.json @@ -145,6 +145,7 @@ "Edit Controller Memory limit": "Edit Controller Memory limit", "Edit credentials": "Edit credentials", "Edit Default Transfer Network": "Edit Default Transfer Network", + "Edit Inventory Container Memory limit": "Edit Inventory Container Memory limit", "Edit mappings": "Edit mappings", "Edit Maximum concurrent VM migrations": "Edit Maximum concurrent VM migrations", "Edit migration plan target namespace": "Edit migration plan target namespace", @@ -216,6 +217,7 @@ "Invalid password": "Invalid password", "Invalid username": "Invalid username", "Inventory": "Inventory", + "Inventory Container Memory limit": "Inventory Container Memory limit", "Inventory server is not reachable. To troubleshoot, check the Forklift controller pod logs.": "Inventory server is not reachable. To troubleshoot, check the Forklift controller pod logs.", "Issuer": "Issuer", "Kubernetes name of the new migration Plan resource": "Kubernetes name of the new migration Plan resource", @@ -354,6 +356,7 @@ "Please enter the interval in seconds for snapshot pooling, if empty default value will be used.": "Please enter the interval in seconds for snapshot pooling, if empty default value will be used.", "Please enter the limit for CPU usage by the controller in milliCPU, if empty default value will be used.": "Please enter the limit for CPU usage by the controller in milliCPU, if empty default value will be used.", "Please enter the limit for memory usage by the controller in Mi, if empty default value will be used.": "Please enter the limit for memory usage by the controller in Mi, if empty default value will be used.", + "Please enter the limit for memory usage by the inventory container in Mi, if empty default value will be used.": "Please enter the limit for memory usage by the inventory container in Mi, if empty default value will be used.", "Please enter the maximum number of concurrent VM migrations, if empty default value will be used.": "Please enter the maximum number of concurrent VM migrations, if empty default value will be used.", "Pod": "Pod", "Pod logs": "Pod logs", @@ -423,6 +426,7 @@ "Set to preserve the static IPs": "Set to preserve the static IPs", "Set warm migration": "Set warm migration", "Sets the maximum number of VMs that can be migrated simultaneously. The default value is 20 virtual machines.": "Sets the maximum number of VMs that can be migrated simultaneously. The default value is 20 virtual machines.", + "Sets the memory limits allocated to the inventory container in the controller pod. The default value is 1000Mi.": "Sets the memory limits allocated to the inventory container in the controller pod. The default value is 1000Mi.", "Sets the memory limits allocated to the main container in the controller pod. The default value is 800Mi.": "Sets the memory limits allocated to the main container in the controller pod. The default value is 800Mi.", "Settings": "Settings", "SHA-1 fingerprint": "SHA-1 fingerprint", @@ -475,6 +479,7 @@ "The interval in seconds for snapshot pooling. Default value is 10.": "The interval in seconds for snapshot pooling. Default value is 10.", "The limit for CPU usage by the controller, specified in milliCPU. Default value is 500m.": "The limit for CPU usage by the controller, specified in milliCPU. Default value is 500m.", "The limit for memory usage by the controller, specified in Megabytes (Mi). Default value is 800Mi.": "The limit for memory usage by the controller, specified in Megabytes (Mi). Default value is 800Mi.", + "The limit for memory usage by the inventory container, specified in Megabytes (Mi). Default value is 1000Mi.": "The limit for memory usage by the inventory container, specified in Megabytes (Mi). Default value is 1000Mi.", "The Manager CA certificate unless it was replaced by a third-party certificate, in which case, enter the Manager Apache CA certificate.": "The Manager CA certificate unless it was replaced by a third-party certificate, in which case, enter the Manager Apache CA certificate.", "The password for the ESXi host admin": "The password for the ESXi host admin", "The plan is not ready - ": "The plan is not ready - ", diff --git a/packages/forklift-console-plugin/src/modules/Overview/modal/EditInventoryMemoryLimitModal.tsx b/packages/forklift-console-plugin/src/modules/Overview/modal/EditInventoryMemoryLimitModal.tsx new file mode 100644 index 000000000..32744fbbe --- /dev/null +++ b/packages/forklift-console-plugin/src/modules/Overview/modal/EditInventoryMemoryLimitModal.tsx @@ -0,0 +1,50 @@ +import React from 'react'; +import { EditModal, ModalInputComponentType } from 'src/modules/Providers/modals'; +import { useForkliftTranslation } from 'src/utils/i18n'; + +import { ForkliftControllerModel } from '@kubev2v/types'; +import { ModalVariant } from '@patternfly/react-core'; + +import { EditSettingsModalProps } from './EditSettingsModalProps'; +import SettingsSelectInput from './SettingsSelectInput'; + +// Define the options +const options = [ + { key: '400Mi', name: '400Mi', description: 'Low memory limit' }, + { key: '1000Mi', name: '1000Mi', description: 'Moderate memory limit' }, + { key: '2000Mi', name: '2000Mi', description: 'High memory limit' }, + { key: '8000Mi', name: '8000Mi', description: 'Very high memory limit' }, +]; + +/** + * InventoryMemoryLimitSelect component. + * Wraps the SettingsSelectInput component with pre-defined options. + * + * @param {ModalInputComponentProps} props - Properties passed to the component + * @returns {JSX.Element} + */ +const InventoryMemoryLimitSelect: ModalInputComponentType = (props) => { + return ; +}; + +export const EditInventoryMemoryLimitModal: React.FC = (props) => { + const { t } = useForkliftTranslation(); + + return ( + + ); +}; diff --git a/packages/forklift-console-plugin/src/modules/Overview/modal/index.ts b/packages/forklift-console-plugin/src/modules/Overview/modal/index.ts index 93ac82708..81eb36677 100644 --- a/packages/forklift-console-plugin/src/modules/Overview/modal/index.ts +++ b/packages/forklift-console-plugin/src/modules/Overview/modal/index.ts @@ -1,6 +1,7 @@ // @index(['./*', /style/g], f => `export * from '${f.path}';`) export * from './EditControllerCPULimitModal'; export * from './EditControllerMemoryLimitModal'; +export * from './EditInventoryMemoryLimitModal'; export * from './EditMaxVMInFlightModal'; export * from './EditPreCopyIntervalModal'; export * from './EditSettingsModalProps'; diff --git a/packages/forklift-console-plugin/src/modules/Overview/views/overview/tabs/Details/cards/SettingsCard.tsx b/packages/forklift-console-plugin/src/modules/Overview/views/overview/tabs/Details/cards/SettingsCard.tsx index 4b7214f06..a1fbc28c0 100644 --- a/packages/forklift-console-plugin/src/modules/Overview/views/overview/tabs/Details/cards/SettingsCard.tsx +++ b/packages/forklift-console-plugin/src/modules/Overview/views/overview/tabs/Details/cards/SettingsCard.tsx @@ -2,6 +2,7 @@ import React, { FC } from 'react'; import { EditControllerCPULimitModal, EditControllerMemoryLimitModal, + EditInventoryMemoryLimitModal, EditMaxVMInFlightModal, EditPreCopyIntervalModal, EditSnapshotPoolingIntervalModal, @@ -98,6 +99,28 @@ const SettingsCard_: FC = ({ obj }) => { onEdit={() => showModal()} /> + {'1000Mi'} + ) + } + moreInfoLink={ + 'https://docs.redhat.com/en/documentation/migration_toolkit_for_virtualization/2.6/html-single/installing_and_using_the_migration_toolkit_for_virtualization/index#advanced-migration-options_mtv' + } + helpContent={ + + {t( + 'Sets the memory limits allocated to the inventory container in the controller pod. The default value is 1000Mi.', + )} + + } + crumbs={['spec', 'inventory_container_limits_memory']} + onEdit={() => showModal()} + /> +