fix(docker): handle Kubernetes service-link port env#2045
Open
dev07060 wants to merge 1 commit into
Open
Conversation
d140524 to
17c565d
Compare
17c565d to
f0c9693
Compare
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
Fixes a Docker entrypoint failure mode in Kubernetes clusters where service-link environment variables can inject a non-numeric
CRAWL4AI_PORTvalue such astcp://10.0.101.25:80.This keeps the existing secure-by-default Docker bind posture intact:
127.0.0.1:<port>[::]:<port>defaultGUNICORN_BINDin credentialed mode is preserved and does not forceCRAWL4AI_PORTparsingThe only behavior change is port normalization before the entrypoint composes its own default bind address. Numeric
CRAWL4AI_PORTvalues still work as before; Kubernetes-styletcp://...service-link values are ignored with a warning and fall back to11235; other non-numeric values fail fast with a clear error.I also checked current open PRs for overlap using Kubernetes/k8s/GUNICORN_BIND/CRAWL4AI_PORT/service-link/entrypoint/bind search terms and did not find another PR covering this entrypoint service-link collision.
List of files changed and why
deploy/docker/entrypoint.sh- add narrowCRAWL4AI_PORTnormalization for Kubernetestcp://...service-link collisions while preserving the existing[::]default and explicitGUNICORN_BINDoverride behavior.deploy/docker/tests/test_security_container_posture.py- add entrypoint regression tests for the dual-stack credentialed bind, service-link fallback with and without credentials, explicitGUNICORN_BINDpreservation, and invalid non-service-link port values.How Has This Been Tested?
uv run --no-project --with pytest pytest deploy/docker/tests/test_security_container_posture.py -q -k 'TestEntrypoint or TestDockerfile or TestSupervisord or TestCompose'(21 passed, 2 deselected)bash -n deploy/docker/entrypoint.shgit diff --checkI also attempted the editable project test command, but local dependency setup failed while building
scipy==1.13.1because this machine does not have a Fortran compiler (gfortran) installed.Checklist: