-
Notifications
You must be signed in to change notification settings - Fork 20
Allow PCUI to support multiple Pcluster versions #418
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9865410
Modify cloudformation template and api handler to create multiple api…
hgreebe f84a92d
Add version field to cluster create
hgreebe 96dfef4
Add dropdown menu to select the image version for the Official Images…
hgreebe d5a1384
Add a version page to create cluster with a version dropdown menu and…
hgreebe 9461617
Fix location of the version dropdown menu on the official images page
hgreebe 897b3a5
Modify unit tests to account for multiple pcluster versions
hgreebe 98ed239
Modify demo environment to work with multiple pcluster versions
hgreebe ff49a2b
Fix cluster update
hgreebe 760614a
fix frontend tests
hgreebe 58eaa88
Use set for version comparison
hgreebe 7d0ce72
Add version field test
hgreebe 709b5d6
Add backend test for invoke url mapping
hgreebe a1f5c23
Fix official images version dropdown menu
hgreebe 4199108
Wrap url mapping logic in a function
hgreebe 40fd88c
Add cluster version selection to custom image build.
hgreebe 5529745
fix create cluster from template
hgreebe 6d8dcb8
Scope down permissions
hgreebe 5f5ae6f
Fix formatting
hgreebe d8169b1
Handle duplicate versions
hgreebe c9e5652
Fix create version issue
hgreebe aab0f60
Account for fix of path traversal vulnerability
hgreebe ac8981a
Merge branch 'main' into develop
hgreebe 52a3ef6
Add images unit tests
hgreebe 2170bb6
Scope down ApiVersionMap permissions
hgreebe 94f9775
Change ui api id tag
hgreebe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
from unittest import mock | ||
from api.PclusterApiHandler import login | ||
from api.PclusterApiHandler import login, get_base_url, create_url_map | ||
|
||
class MockRequest: | ||
cookies = {'int_value': 100} | ||
args = {'version': '3.12.0'} | ||
json = {'username': '[email protected]'} | ||
|
||
|
||
@mock.patch("api.PclusterApiHandler.requests.post") | ||
|
@@ -27,3 +32,14 @@ def test_login_with_no_access_token_returns_401(mocker, app): | |
login() | ||
|
||
mock_abort.assert_called_once_with(401) | ||
|
||
def test_get_base_url(monkeypatch): | ||
monkeypatch.setattr('api.PclusterApiHandler.API_VERSION', ['3.12.0', '3.11.0']) | ||
monkeypatch.setattr('api.PclusterApiHandler.API_BASE_URL', '3.12.0=https://example.com,3.11.0=https://example1.com,') | ||
monkeypatch.setattr('api.PclusterApiHandler.API_BASE_URL_MAPPING', {'3.12.0': 'https://example.com', '3.11.0': 'https://example1.com'}) | ||
|
||
assert 'https://example.com' == get_base_url(MockRequest()) | ||
|
||
def test_create_url_map(): | ||
assert {'3.12.0': 'https://example.com', '3.11.0': 'https://example1.com'} == create_url_map('3.12.0=https://example.com,3.11.0=https://example1.com,') | ||
|
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we are setting the latest PC version as the default one.
The user should be able to control the default version, but with this solution is not.
Example: a user wants to try a new version of PC, but keeping the default version to the one that they consider the most stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because for the home page where all of the clusters are displayed, it uses the list clusters API of the default version.
Currently, if the supported API version is larger than an unsupport version of one of the clusters, then you will be able to see some of its information, there will just be a warning saying that you can not edit the cluster. But is the supported API version it less than the unsupported version, you won't be able to see any cluster information and will getting an error message saying that the version is not supported.
The reason for the sorting/default version being the largest version is so that for example if the supported versions for 3.13.0 and 3.11.0, you will be able to see the information for a 3.12.0 cluster no matter the order you put in the supported versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for the explanation. Please put a comment explaining why the default version must be the most recent one.