-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api,ui): Add new max allowed replicas field to env configs and r…
…elevant checks (#546) # Description Previously the Merlin API server does not have any constraints on the max number of replicas users are able to set for their deployments. This constraint however, appears on the UI via the variable `REACT_APP_MAX_ALLOWED_REPLICA` that can be set in the configs. In order to make the max allowed replica constraint consistent across the API server (as well as the SDK) and the UI, this PR introduces a new configuration value under the `Environment` struct. This struct currently already contains other environment (cluster) related configs such as the max allowable CPU and memory a user is allowed to set. Doing so thus requires a very simple DB update in order to introduce a new column corresponding to the max allowed replica field, and also allows the UI to retrieve this max allowed replica value directly from the environments API endpoint (just as it does for other environment-related configs such as GPU information) instead of via a React app configuration value. https://github.com/caraml-dev/merlin/assets/36802364/7c37be61-d540-495e-b12c-4efa92ebae0f ## Additional bug fixes Removal of the requirement for the `endpoint` and `version` props to be set in the `DeploymentPanelHeader` component, which causes a warning to occur show when no endpoint is selected for a specific version: <img width="1638" alt="Screenshot 2024-03-02 at 12 58 48 PM" src="https://github.com/caraml-dev/merlin/assets/36802364/ed7a1e4a-3978-4f09-8928-486cc31f9e27"> Resetting of the `resource_request` schema after the `None` transformer type is selected AFTER any other transformer type is selected and configured with invalid `resource_request` values rejected by yup validation (this happens because the invalid resource request values do not get removed even after the transformer has been 'removed'; note that a `None` type transformer still gets certain default transformer configs saved though they are technically redundant - it might be worth changing this in the future): https://github.com/caraml-dev/merlin/assets/36802364/062694a1-cca6-4fed-a869-d01ab0958ce8 # Modifications - `api/cluster/controller.go` - Addition of new max replica check on the API server for **Merlin models** during deployment - `api/config/config.go` - Removal of `MaxAllowedReplica` from the `ReactAppConfig` struct - `api/config/environment.go` - Addition of `MaxAllowedReplica` to the `EnvironmentConfig` struct - `ui/src/config.js` - Removal of `REACT_APP_MAX_ALLOWED_REPLICA` from React configs - `ui/src/pages/version/components/forms/DeployModelVersionForm.js` - Addition of a new state and state setter to set the max allowed replica value based on the environment selected in the form context - `ui/src/pages/version/components/forms/components/DeploymentConfigPanel.js` - Addition of a new effect update to update the max allowed replica value when the environment in a deployment form is updated - `ui/src/pages/version/components/forms/components/ResourcesPanel.js` - Removal of ticks and the addition of min/max labels to indicate variable min/max replica values users may set for a deployment - `ui/src/pages/version/components/forms/validation/schema.js` - Update validation schema to use a variable max allowed replica value to determine the struct validation outcomes # Tests <!-- Besides the existing / updated automated tests, what specific scenarios should be tested? Consider the backward compatibility of the changes, whether corner cases are covered, etc. Please describe the tests and check the ones that have been completed. Eg: - [x] Deploying new and existing standard models - [ ] Deploying PyFunc models --> # Checklist - [x] Added PR label - [x] Added unit test, integration, and/or e2e tests - [x] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [ ] Regenerated Golang and Python client if the PR introduces API changes # Release Notes <!-- Does this PR introduce a user-facing change? If no, just write "NONE" in the release-note block below. If yes, a release note is required. Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required". For more information about release notes, see kubernetes' guide here: http://git.k8s.io/community/contributors/guide/release-notes.md --> ```release-note This update potentially allows users to set a larger max replica value than usual for their deployments and may also inadvertently constrain the number of max replicas they can set, depending on the max allowed replica value set by the Merlin API server operator. ```
- Loading branch information
1 parent
650bc5e
commit 09a8e71
Showing
20 changed files
with
127 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
db-migrations/37_environments_add_max_allowed_replicas.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE environments DROP COLUMN max_allowed_replica; |
2 changes: 2 additions & 0 deletions
2
db-migrations/37_environments_add_max_allowed_replicas.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE environments | ||
ADD COLUMN max_allowed_replica int; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.