Skip to content
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

♻️ Enhance regex validation director v2 - Allow registries by IP and Port #2892

Merged

Conversation

mrnicegyu11
Copy link
Member

What do these changes do?

This makes a regex in the settings validation of director-v2 more permissive. The regex validates an env-var specifying the docker-registry which hosts the image for the dynamic sidecar.

Before the change, the following registry names were matched (and thus allowed):

  • itisfoundation
  • local

Now, additionally registries specified by IP& Port (e.g. 10.0.0.1:5000) are allowed.

This change is necessary for deployments on multiple machines that run custom self-built development containers. For this multi-node setup, a self-hosted registry is necessary to deploy the images to the swarm.

For regex validation, see:

https://regex101.com/r/DoCQeV/1

@codecov
Copy link

codecov bot commented Mar 15, 2022

Codecov Report

Merging #2892 (2f59afd) into master (ec1c9e0) will increase coverage by 0.0%.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2892   +/-   ##
======================================
  Coverage    79.5%   79.5%           
======================================
  Files         670     670           
  Lines       27737   27737           
  Branches     3220    3220           
======================================
+ Hits        22063   22066    +3     
+ Misses       4922    4921    -1     
+ Partials      752     750    -2     
Flag Coverage Δ
integrationtests 65.7% <ø> (+<0.1%) ⬆️
unittests 75.2% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...re_service_director_v2/models/schemas/constants.py 100.0% <ø> (ø)
...rvice_datcore_adapter/utils/requests_decorators.py 71.0% <0.0%> (-7.9%) ⬇️
...tor_v2/modules/dynamic_sidecar/scheduler/events.py 92.5% <0.0%> (-1.2%) ⬇️
...imcore_service_webserver/garbage_collector_core.py 70.5% <0.0%> (-1.0%) ⬇️
...ector_v2/modules/dynamic_sidecar/scheduler/task.py 86.0% <0.0%> (-0.5%) ⬇️
..._director_v2/modules/dynamic_sidecar/docker_api.py 86.4% <0.0%> (+0.5%) ⬆️
.../director/src/simcore_service_director/producer.py 62.3% <0.0%> (+0.6%) ⬆️
.../simcore_service_catalog/services/access_rights.py 81.2% <0.0%> (+2.5%) ⬆️
.../server/src/simcore_service_webserver/users_api.py 95.9% <0.0%> (+4.0%) ⬆️

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • TIP: use composition with f-strings to make it more readable
  • Make sure there are tests covering any new regex. It is specially critical for future changes (we can check together if you like)

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use my suggestion.
The previous regex was totally broken.
As PC requested, also add tests.

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for your contribution! :-)
ok with me but advice to implement changes we agreed .

SWARM_STACK_NAME="",
DYNAMIC_SIDECAR_PROXY_SETTINGS=DynamicSidecarProxySettings(),
)
with pytest.raises(Exception) as exc_info:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValidationError

@mrnicegyu11 mrnicegyu11 merged commit 5c5f2b7 into ITISFoundation:master Mar 24, 2022
@mrnicegyu11 mrnicegyu11 deleted the enhanceRegexValidationDirectorV2 branch March 24, 2022 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:director-v2 issue related with the director-v2 service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants