-
Notifications
You must be signed in to change notification settings - Fork 28
🎨 docker-api-proxy
always requires authentication (⚠️devops)
#7586
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
base: master
Are you sure you want to change the base?
🎨 docker-api-proxy
always requires authentication (⚠️devops)
#7586
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7586 +/- ##
==========================================
- Coverage 87.69% 87.46% -0.24%
==========================================
Files 1774 1730 -44
Lines 68426 66084 -2342
Branches 1125 1123 -2
==========================================
- Hits 60006 57799 -2207
+ Misses 8113 7978 -135
Partials 307 307
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
docker-api-proxy
always requires authentication nowdocker-api-proxy
always requires authentication now (⚠️devops)
…ic-auth-to-docker-api-proxy
|
docker-api-proxy
always requires authentication now (⚠️devops)docker-api-proxy
always requires authentication (⚠️devops)
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.
thx!
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.
Thx. Left some comments.
@@ -22,7 +22,13 @@ | |||
async def _wait_till_docker_api_proxy_is_responsive( | |||
settings: DockerApiProxysettings, | |||
) -> None: | |||
async with ClientSession(timeout=ClientTimeout(1, 1, 1, 1, 1)) as client: | |||
async with ClientSession( | |||
timeout=ClientTimeout(1, 1, 1, 1, 1), |
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.
MINOR: i would add keyword arguments to know what these 1,1,1,1 refers to
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.
Yep, this is very unclear. what is 1? a second a millisecond? what is the point of defining all of them? since this is aiohttp, you can also define only 1 argument instead of having this super complicated thing. one of the timeout is getting a client from the pool, etc etc...
thought: Would it not make sense to create 1 client session for waiting instead of re-creating each time?
login=settings.DOCKER_API_PROXY_USER, | ||
password=settings.DOCKER_API_PROXY_PASSWORD.get_secret_value(), | ||
) | ||
session = await exit_stack.enter_async_context( |
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.
where is this session
used?
@@ -0,0 +1,11 @@ | |||
:8888 { | |||
handle { | |||
basicauth { |
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.
So this container has two apps? One reverse-proxy (caddy) that auths, and the actual python app that access docker api.
Q: does this service need special tuning of resources ( e.g. 1-2 CPUs? )
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.
nice!
async with setup_docker_client(envs) as working_docker: | ||
with pytest.raises(aiodocker.exceptions.DockerError) as exc: | ||
await working_docker.system.info() | ||
assert exc.value.status == 401 |
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.
MINOR: use status.HTTP_***
constants instead. They are more readable
assert exec.value.status == status.HTTP_40_UNAUTHORIZED
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.
thanks!
@@ -22,7 +22,13 @@ | |||
async def _wait_till_docker_api_proxy_is_responsive( | |||
settings: DockerApiProxysettings, | |||
) -> None: | |||
async with ClientSession(timeout=ClientTimeout(1, 1, 1, 1, 1)) as client: | |||
async with ClientSession( | |||
timeout=ClientTimeout(1, 1, 1, 1, 1), |
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.
Yep, this is very unclear. what is 1? a second a millisecond? what is the point of defining all of them? since this is aiohttp, you can also define only 1 argument instead of having this super complicated thing. one of the timeout is getting a client from the pool, etc etc...
thought: Would it not make sense to create 1 client session for waiting instead of re-creating each time?
DOCKER_API_PROXY_USER: str | None = None | ||
DOCKER_API_PROXY_PASSWORD: SecretStr | None = None | ||
DOCKER_API_PROXY_USER: str | ||
DOCKER_API_PROXY_PASSWORD: SecretStr |
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.
so this was usable before right? Why do you then need 3 different MRs for the ops part?
@@ -29,10 +29,11 @@ HEALTHCHECK \ | |||
--start-period=20s \ | |||
--start-interval=1s \ | |||
--retries=5 \ | |||
CMD curl http://localhost:8888/version || exit 1 | |||
CMD curl --fail-with-body -u ${DOCKER_API_PROXY_USER}:${DOCKER_API_PROXY_PASSWORD} http://localhost:8888/version |
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.
is --user
not available since it is alpine?
What do these changes do?
Related issue/s
docker-api-proxy
shall require basic auth #7223How to test