Fix 'resources' type description#828
Merged
jyunmitch merged 1 commit intoentando:mainfrom Mar 27, 2024
almartino:patch-1
Merged
Fix 'resources' type description#828jyunmitch merged 1 commit intoentando:mainfrom almartino:patch-1
jyunmitch merged 1 commit intoentando:mainfrom
almartino:patch-1
Conversation
The correct type here is not an array type but a plain json object.
jyunmitch
approved these changes
Mar 27, 2024
Collaborator
|
Thank you for pointing this out! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This pull request addresses the discrepancy in the type definition for the resources field in the microservice model. The current implementation uses an array type, which causes issues during deployment. The correct type should be a plain JSON object.
Details:
The ent CLI does not perform any validation on the microservice model during
packexecution, leading to potential errors during deployment.Examples:
Example 1:
{ "name": "testms", "stack": "custom", "dbms": "postgresql", "healthCheckPath": "/api/health", "commands": { "build": "...", "run": "...", "pack": "..." }, "version": "0.0.5", "resources": [ // valid, no errors during pack phase {"cpu": "100m"}, {"memory": "128M"} ] }Example 2:
{ "name": "testms", "stack": "custom", "dbms": "postgresql", "healthCheckPath": "/api/health", "commands": { "build": "...", "run": "...", "pack": "..." }, "version": "0.0.5", "resources": { // valid, no errors during pack phase "cpu": "100m", "memory": "128M" } }Both examples work during the pack phase. However, if the deployed bundle is installed with the microservice defined as in Example 1, the error "plugin/testms.yaml invalid [...]" appears when clicking the install button in AppBuilder. On the other hand, the deployed bundle with the microservice defined as in Example 2 will also fail:
The "cm" pod logs a null pointer exception due to the missing "storage" parameter in the "resources" object. Could this parameter be made optional? Some containers do not require storage.
NPE detail
Changes: