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

带端口的镜像地址解析问题 #1576

Open
linxiaowu1992 opened this issue Sep 5, 2024 · 0 comments
Open

带端口的镜像地址解析问题 #1576

linxiaowu1992 opened this issue Sep 5, 2024 · 0 comments

Comments

@linxiaowu1992
Copy link
Contributor

版本:1.5.0-beta.1

问题:

在bkpaas3-apiserver-web pod中,设置PAAS_APP_IMAGE变量,并执行push_smart_image

export PAAS_APP_IMAGE=10.10.26.84:5000/blueking/slug-app:v1.1.0-beta.27
python manage.py push_smart_image --image "${PAAS_APP_IMAGE}" --type legacy --dry-run "${PAAS_SKIP_PUSH_SMART_BASE_IMAGE:-False}"

会有以下报错:
image

经排查确认,在paasng/settings/init.py:1231行,会对传入的APP_IMAGE根据冒号进行解析:
SMART_IMAGE_TAG = f'{settings.get("APP_IMAGE", "").partition(":")[-1]}-{_SMART_TAG_SUFFIX}'

image

但如果url的host带有端口,将导致该解析出现问题,无法准确截取tag。

同理,paasng/settings/init.py:1233行也存在该问题:

SMART_CNB_IMAGE_TAG = f'{settings.get("HEROKU_RUNNER_IMAGE", "").partition(":")[-1]}-{_SMART_TAG_SUFFIX}'

建议将partition改为split:

SMART_IMAGE_TAG = f'{settings.get("APP_IMAGE", "").partition(":")[-1]}-{_SMART_TAG_SUFFIX}'

->

SMART_IMAGE_TAG = f'{settings.get("APP_IMAGE", "").split(":")[-1]}-{_SMART_TAG_SUFFIX}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant