-
Notifications
You must be signed in to change notification settings - Fork 27
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
✨♻️ (⚠️ devops) Remove 5gb limit when uploading data via nodeports #2993
Changes from 60 commits
24f90e4
7dca9b7
ede7db6
965ef2a
f641299
1391d21
33d8bbf
a33cfb0
002ad5f
66da40d
e3730f9
94e4c5f
a7be73b
db6be1f
dace16c
1789bc1
efc1d1d
77c9b33
76a0528
8409f38
c61de67
365b34b
df29fd5
49e48f9
92d8b62
a3b595b
5c564d6
aea65b9
8113043
dad78df
3032ab3
1fabc74
123495d
14be36c
fcd0ad0
f9af13d
2b80e15
b557dac
24c1236
5093401
e847cbd
b74cca0
3237d15
caf5b17
ffb00bb
039cd4e
69db8bd
a13b90e
c17f082
3b1c38e
486d481
eb6f940
81ace91
c75fbc0
e43cb28
5e18032
f5204d4
8bf58c5
14abcdc
a53eff7
5f2ea52
8bcce57
6f5cecc
1160e57
8e7fb41
9d6acd0
4455007
9af8adb
656e499
de6c151
0af0f33
01f56eb
b02d8bb
46d4f7a
9f2707e
181d3eb
c34badc
5d18d78
2091408
7c6cd29
c1248a7
1bd4839
448bce1
7b226fa
b109667
5a922dc
ac3e214
fb14b4c
f9b9116
5b9e167
32fda96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,17 @@ | ||||||||||||||||||||||||||||||||||||
from enum import Enum | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
from pydantic import Field | ||||||||||||||||||||||||||||||||||||
from .base import BaseCustomSettings | ||||||||||||||||||||||||||||||||||||
from .s3 import S3Settings | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
class S3Provider(str, Enum): | ||||||||||||||||||||||||||||||||||||
AWS = "AWS" | ||||||||||||||||||||||||||||||||||||
CEPH = "CEPH" | ||||||||||||||||||||||||||||||||||||
MINIO = "MINIO" | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
class RCloneSettings(BaseCustomSettings): | ||||||||||||||||||||||||||||||||||||
R_CLONE_S3: S3Settings = Field(auto_default_from_env=True) | ||||||||||||||||||||||||||||||||||||
R_CLONE_PROVIDER: S3Provider | ||||||||||||||||||||||||||||||||||||
R_CLONE_REGION: str = Field("us-east-1", description="S3 region to use") | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: why not move this to S3Settings? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I wanted to put it inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while I agree it's currently only used by RClone, it is still a S3 setting. and it will be used in AWS deployments cause currently we probably use some default. Therefore I would put it there. Can you please check how storage connects to AWS S3 then? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Storage uses osparc-simcore/services/storage/src/simcore_service_storage/s3wrapper/s3_client.py Lines 21 to 37 in 122703f
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whether the S3_REGION is used or not is up to the client code. so I do not think this should create any problem. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
from typing import Optional | ||
|
||
from .base import BaseCustomSettings | ||
from functools import cached_property | ||
|
||
|
||
class S3Settings(BaseCustomSettings): | ||
S3_ENDPOINT: str = "minio:9000" | ||
S3_ACCESS_KEY: str = "12345678" | ||
S3_SECRET_KEY: str = "12345678" | ||
S3_ENDPOINT: str | ||
S3_ACCESS_KEY: str | ||
S3_SECRET_KEY: str | ||
S3_ACCESS_TOKEN: Optional[str] = None | ||
S3_BUCKET_NAME: str = "simcore" | ||
S3_BUCKET_NAME: str | ||
S3_SECURE: bool = False | ||
|
||
@cached_property | ||
def endpoint(self) -> str: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pair review comment: check if still required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved this to a validator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spent too much time on this. Requires much more time to refactor and make working with validator. Will leave as is. |
||
if not self.S3_ENDPOINT.startswith("http"): | ||
scheme = "https" if self.S3_SECURE else "http" | ||
return f"{scheme}://{self.S3_ENDPOINT}" | ||
return self.S3_ENDPOINT |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import configparser | ||
from copy import deepcopy | ||
from io import StringIO | ||
from typing import Dict | ||
|
||
from .r_clone import RCloneSettings, S3Provider | ||
|
||
_COMMON_ENTRIES: Dict[str, str] = { | ||
"type": "s3", | ||
"access_key_id": "{access_key}", | ||
"secret_access_key": "{secret_key}", | ||
"region": "{aws_region}", | ||
"acl": "private", | ||
} | ||
|
||
_PROVIDER_ENTRIES: Dict[S3Provider, Dict[str, str]] = { | ||
# NOTE: # AWS_SESSION_TOKEN should be required for STS | ||
S3Provider.AWS: {"provider": "AWS"}, | ||
S3Provider.CEPH: {"provider": "Ceph", "endpoint": "{endpoint}"}, | ||
S3Provider.MINIO: {"provider": "Minio", "endpoint": "{endpoint}"}, | ||
} | ||
|
||
|
||
def _format_config(entries: Dict[str, str]) -> str: | ||
config = configparser.ConfigParser() | ||
config["dst"] = entries | ||
with StringIO() as string_io: | ||
config.write(string_io) | ||
string_io.seek(0) | ||
return string_io.read() | ||
|
||
|
||
def get_r_clone_config(r_clone_settings: RCloneSettings) -> str: | ||
provider = r_clone_settings.R_CLONE_PROVIDER | ||
entries = deepcopy(_COMMON_ENTRIES) | ||
entries.update(_PROVIDER_ENTRIES[provider]) | ||
|
||
r_clone_config_template = _format_config(entries=entries) | ||
|
||
# replace entries in template | ||
r_clone_config = r_clone_config_template.format( | ||
GitHK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endpoint=r_clone_settings.R_CLONE_S3.endpoint, | ||
access_key=r_clone_settings.R_CLONE_S3.S3_ACCESS_KEY, | ||
secret_key=r_clone_settings.R_CLONE_S3.S3_SECRET_KEY, | ||
aws_region=r_clone_settings.R_CLONE_REGION, | ||
) | ||
return r_clone_config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# pylint: disable=redefined-outer-name | ||
|
||
import pytest | ||
from settings_library.r_clone import RCloneSettings, S3Provider | ||
from settings_library.utils_r_clone import _COMMON_ENTRIES, get_r_clone_config | ||
|
||
|
||
@pytest.fixture(params=list(S3Provider)) | ||
def r_clone_settings(request, monkeypatch) -> RCloneSettings: | ||
monkeypatch.setenv("R_CLONE_PROVIDER", request.param) | ||
monkeypatch.setenv("S3_ENDPOINT", "endpoint") | ||
monkeypatch.setenv("S3_ACCESS_KEY", "access_key") | ||
monkeypatch.setenv("S3_SECRET_KEY", "secret_key") | ||
monkeypatch.setenv("S3_BUCKET_NAME", "bucket_name") | ||
monkeypatch.setenv("S3_SECURE", False) | ||
GitHK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return RCloneSettings() | ||
|
||
|
||
def test_r_clone_config_template_replacement(r_clone_settings: RCloneSettings) -> None: | ||
r_clone_config = get_r_clone_config(r_clone_settings) | ||
print(r_clone_config) | ||
|
||
assert "{endpoint}" not in r_clone_config | ||
assert "{access_key}" not in r_clone_config | ||
assert "{secret_key}" not in r_clone_config | ||
|
||
for key in _COMMON_ENTRIES.keys(): | ||
assert key in r_clone_config |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ pytest-xdist | |
pytest-lazy-fixture | ||
|
||
# mockups/fixtures | ||
aioboto3 | ||
aioresponses | ||
alembic | ||
click | ||
|
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.
very minor: python 3.9 allows to use
dict
instead ofDict
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.
Very nice to know!
@colinRawlings you were wondering about
None
in typing. This is similar.