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

The simultaneous use of one's own image in the build of Python functions does not take effect #145

Open
Leo88886 opened this issue Nov 13, 2023 · 8 comments

Comments

@Leo88886
Copy link

Hello, when I used the description of openfunction to deploy a Python function as a service, I wanted to use my own image (which contains some data files), but when I declared spec build params RUN_ After IMAGE, the generated pod did not use the image I declared. Is there any problem with the declared image? It's quite urgent, online, etc

你好,我使用openfunction的描述去部署一个python函数为服务时,希望使用我自己的一个镜像(镜像里面有一些数据文件),但是在我声明了spec build params RUN_IMAGE后,生成的pod并没有使用我声明的镜像,是声明的有什么问题吗,挺急的,在线等

apiVersion: core.openfunction.io/v1beta1
kind: Function
metadata:
namespace: "abc"
name: "test--testtpy"
spec:
version: "v2.0.0"
image: "172.16.xxx.xxx:81/abc/test--testtpy:v2"
imageCredentials:
name: push-secret
port: 8080
build:
builder: "openfunction/gcp-builder:v1"
env:
GOOGLE_FUNCTION_TARGET: "hello_world"
GOOGLE_FUNCTION_SIGNATURE_TYPE: "http"
GOOGLE_FUNCTION_SOURCE: "main.py"
params:
RUN_IMAGE: "172.16.xxx.xxx:81/zhikong/ubuntu-20.04.4lts-block-inner:v2"
srcRepo:
url: "[email protected]:abc/test.git"
sourceSubPath: "/testtpy"
revision: "main"
credentials:
name: secret-git-ssh-auth2
serving:
scaleOptions:
minReplicas: 1
maxReplicas: 10
runtime: "knative"
template:
containers:
- name: function # DO NOT change this
imagePullPolicy: IfNotPresent
route:
gatewayRef:
name: openfunction
namespace: openfunction
rules:
- matches:
- path:
type: PathPrefix
value: "/faas/xxx/test/tt/py"

@wanjunlei
Copy link
Member

Please provide the whole function yaml including the status, and also provide the serving yaml.

@Leo88886
Copy link
Author

Leo88886 commented Nov 13, 2023

Please provide the whole function yaml including the status, and also provide the serving yaml. @wanjunlei
That's all the yaml descriptions
I posted the build related logs at the end
“including the status”,What exactly does' status' represent? I did not declare this

apiVersion: core.openfunction.io/v1beta1
kind: Function
metadata:
namespace: "abc"
name: "test--testtpy"
spec:
version: "v2.0.0"
image: "172.16.xxx.xxx:81/abc/test--testtpy:v2"
imageCredentials:
name: push-secret
port: 8080
build:
builder: "openfunction/gcp-builder:v1"
env:
GOOGLE_FUNCTION_TARGET: "hello_world"
GOOGLE_FUNCTION_SIGNATURE_TYPE: "http"
GOOGLE_FUNCTION_SOURCE: "main.py"
params:
RUN_IMAGE: "172.16.xxx.xxx:81/zhikong/ubuntu-20.04.4lts-block-inner:v2"
srcRepo:
url: "[email protected]:abc/test.git"
sourceSubPath: "/testtpy"
revision: "main"
credentials:
name: secret-git-ssh-auth2
serving:
scaleOptions:
minReplicas: 1
maxReplicas: 10
runtime: "knative"
template:
containers:
- name: function # DO NOT change this
imagePullPolicy: IfNotPresent
route:
gatewayRef:
name: openfunction
namespace: openfunction
rules:
- matches:
- path:
type: PathPrefix
value: "/faas/xxx/test/tt/py"

[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/prepare] 2023/11/10 08:41:23 Entrypoint initialization
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 Info: ssh (/usr/bin/ssh): OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 Info: git (/usr/bin/git): git version 2.31.1
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 Info: git-lfs (/usr/bin/git-lfs): git-lfs/2.13.3 (GitHub; linux amd64; go 1.17.5)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 /usr/bin/git clone -h
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 /usr/bin/git submodule -h
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 /usr/bin/git clone --quiet --no-tags --single-branch --branch main --depth 1 -c core.sshCommand=ssh -o LogLevel=ERROR -o BatchMode=yes -i /tmp/ssh-private-key2016994930 -o StrictHostKeyChecking=accept-new -- [email protected]:abc/test.git /workspace/source
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 /usr/bin/git -C /workspace/source -c core.sshCommand=ssh -o LogLevel=ERROR -o BatchMode=yes -i /tmp/ssh-private-key2016994930 -o StrictHostKeyChecking=accept-new submodule update --init --recursive --depth 1
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 Successfully loaded [email protected]:abc/test.git (main) into /workspace/source
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 /usr/bin/git -C /workspace/source rev-parse --verify HEAD
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-source-default] 2023/11/10 08:41:42 /usr/bin/git -C /workspace/source log -1 --pretty=format:%an
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] > Setting permissions on '/cache'...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] > Setting permissions on '/tekton/home'...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] > Setting permissions on '/layers'...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] > Setting permissions on '/workspace/source'...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] > Processing any environment variables...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] --> Creating 'env' directory: /platform/env
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] --> Writing /platform/env/GOOGLE_FUNCTION_SIGNATURE_TYPE...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] --> Writing /platform/env/GOOGLE_FUNCTION_SOURCE...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-prepare] --> Writing /platform/env/GOOGLE_FUNCTION_TARGET...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ===> DETECTING
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] 4 of 5 buildpacks participating
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] google.python.runtime 0.9.1
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] google.python.functions-framework 0.9.4
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] google.python.pip 0.9.2
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] google.utils.label 0.0.1
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ===> ANALYZING
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Restoring metadata for "google.python.runtime:python" from app image
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Restoring metadata for "google.python.pip:pip" from app image
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Restoring metadata for "google.python.pip:pipcache" from cache
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ===> RESTORING
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Removing "google.python.runtime:python", wrong sha
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Removing "google.python.pip:pip", wrong sha
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Restoring data for "google.python.pip:pipcache" from cache
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ===> BUILDING
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] === Python - Runtime ([email protected]) ===
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Using latest runtime version: 3.9.8
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Installing Python v3.9.8
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Upgrading pip to the latest version and installing build tools
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] --------------------------------------------------------------------------------
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Running "/layers/google.python.runtime/python/bin/python3 -m pip install --upgrade pip setuptools wheel"
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Requirement already satisfied: pip in /layers/google.python.runtime/python/lib/python3.9/site-packages (21.2.4)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting pip
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading pip-23.3.1-py3-none-any.whl (2.1 MB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Requirement already satisfied: setuptools in /layers/google.python.runtime/python/lib/python3.9/site-packages (58.1.0)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting setuptools
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading setuptools-68.2.2-py3-none-any.whl (807 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting wheel
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading wheel-0.41.3-py3-none-any.whl (65 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Installing collected packages: wheel, setuptools, pip
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Attempting uninstall: setuptools
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Found existing installation: setuptools 58.1.0
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Uninstalling setuptools-58.1.0:
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Successfully uninstalled setuptools-58.1.0
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Attempting uninstall: pip
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Found existing installation: pip 21.2.4
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Uninstalling pip-21.2.4:
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Successfully uninstalled pip-21.2.4
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Successfully installed pip-23.3.1 setuptools-68.2.2 wheel-0.41.3
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Done "/layers/google.python.runtime/python/bin/python3 -m pip inst..." (4m30.073937769s)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] === Python - Functions Framework ([email protected]) ===
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] --------------------------------------------------------------------------------
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Running "python3 -m compileall -f -q ."
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Done "python3 -m compileall -f -q ." (61.708269ms)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Handling functions with dependency on functions-framework.
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] === Python - pip ([email protected]) ===
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Installing application dependencies.
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] --------------------------------------------------------------------------------
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Running "python3 -m pip install --requirement requirements.txt --upgrade --upgrade-strategy only-if-needed --no-warn-script-location --no-warn-conflicts --force-reinstall --no-compile --user (PIP_CACHE_DIR=/layers/google.python.pip/pipcache PIP_DISABLE_PIP_VERSION_CHECK=1)"
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting functions-framework==1.4.3 (from -r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading functions_framework-1.4.3-py3-none-any.whl (21 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting markupsafe==2.0.1 (from -r requirements.txt (line 2))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting flask<2.0,>=1.0 (from functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading Flask-1.1.4-py2.py3-none-any.whl (94 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.6/94.6 kB 83.9 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting click<8.0,>=7.0 (from functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.8/82.8 kB 65.7 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting watchdog>=0.10.0 (from functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading watchdog-3.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.1/82.1 kB 17.8 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting gunicorn<21.0,>=19.2.0 (from functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 21.3 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting Werkzeug<2.0,>=0.15 (from flask<2.0,>=1.0->functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 298.6/298.6 kB 21.2 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting Jinja2<3.0,>=2.10.1 (from flask<2.0,>=1.0->functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.7/125.7 kB 39.8 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting itsdangerous<2.0,>=0.24 (from flask<2.0,>=1.0->functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Collecting setuptools>=3.0 (from gunicorn<21.0,>=19.2.0->functions-framework==1.4.3->-r requirements.txt (line 1))
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Downloading setuptools-68.2.2-py3-none-any.whl (807 kB)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 807.9/807.9 kB 25.6 kB/s eta 0:00:00
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Installing collected packages: Werkzeug, watchdog, setuptools, markupsafe, itsdangerous, click, Jinja2, gunicorn, flask, functions-framework
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Successfully installed Jinja2-2.11.3 Werkzeug-1.0.1 click-7.1.2 flask-1.1.4 functions-framework-1.4.3 gunicorn-20.1.0 itsdangerous-1.1.0 markupsafe-2.0.1 setuptools-68.2.2 watchdog-3.0.0
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Done "python3 -m pip install --requirement requirements.txt --upgr..." (1m33.997995808s)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] --------------------------------------------------------------------------------
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Running "python3 -m compileall --invalidation-mode unchecked-hash -qq /layers/google.python.pip/pip"
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Done "python3 -m compileall --invalidation-mode unchecked-hash -qq..." (596.183789ms)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Checking for incompatible dependencies.
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] --------------------------------------------------------------------------------
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Running "python3 -m pip check"
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] No broken requirements found.
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Done "python3 -m pip check" (336.559098ms)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] === Utils - Label Image ([email protected]) ===
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] ===> EXPORTING
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Reusing layers from image '172.16.xxx.172:81/abc/test--testtpy@sha256:8bb3ef679606f6a2867b7d6728bd34db6a4448d631048a71c72abd87b891f4e2'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding layer 'google.python.runtime:python'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding layer 'google.python.functions-framework:functions-framework'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding layer 'google.python.pip:pip'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding 1/1 app layer(s)
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Reusing layer 'launcher'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding layer 'config'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding label 'io.buildpacks.lifecycle.metadata'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding label 'io.buildpacks.build.metadata'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding label 'io.buildpacks.project.metadata'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Saving 172.16.203.xxx:81/abc/test--testtpy:v2...
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] *** Images (sha256:6eccaa7df8ba1a8ddc47e4f6c5dabe88ae924dd42411436277f7934bfdb94060):
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] 172.16.203.xxx:81/abc/test--testtpy:v2
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding cache layer 'google.python.runtime:python'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding cache layer 'google.python.pip:pip'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-create] Adding cache layer 'google.python.pip:pipcache'
[pod/builder-jkftd-buildrun-hgjf8-tzc9d-pod/step-results] sha256:6eccaa7df8ba1a8ddc47e4f6c5dabe88ae924dd42411436277f7934bfdb94060%

@wanjunlei
Copy link
Member

This is a complete yaml file of function. Please provide a complete yaml file of your function. And a complete yaml file of the serving.

apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
  creationTimestamp: "2023-11-07T03:01:35Z"
  generation: 6
  name: function-sample
  namespace: default
  resourceVersion: "180125101"
  uid: 6ae9fa17-8a9b-45de-be36-74d1c7e5af83
spec:
  build:
    builder: openfunction/builder-go:latest
    env:
      FUNC_CLEAR_SOURCE: "true"
      FUNC_NAME: HelloWorld
    srcRepo:
      revision: main
      sourceSubPath: functions/knative/hello-world-go
      url: https://github.com/OpenFunction/samples.git
  image: openfunction/sample-go-func:v2
  imageCredentials:
    name: push-secret
  serving:
    template:
      containers:
      - imagePullPolicy: IfNotPresent
        name: function
        resources: {}
    triggers:
      http:
        port: 8080
        route:
          gatewayRef:
            name: openfunction
            namespace: openfunction
          hostnames:
          - abc.efg.com
          rules:
          - matches:
            - path:
                type: PathPrefix
                value: /
  version: v2.0.0
  workloadRuntime: OCIContainer
status:
  addresses:
  - type: External
    value: http://abc.efg.com/
  - type: Internal
    value: http://function-sample.default.svc.cluster.local/
  build:
    message: Succeeded
    reason: Succeeded
    resourceHash: "7899469276580197810"
    resourceRef: builder-qj85k
    state: Succeeded
  revision:
    imageDigest: sha256:0ff9c9013ae07a4aa18b036a05ac7f9b0e2e32ff792b1207b10f9abd3108dec3
  route:
    conditions:
    - lastTransitionTime: "2023-11-13T00:53:35Z"
      message: Valid HTTPRoute
      observedGeneration: 7
      reason: Valid
      status: "True"
      type: Accepted
    hosts:
    - abc.efg.com
    - function-sample.default.svc.cluster.local
    paths:
    - type: PathPrefix
      value: /
  serving:
    lastSuccessfulResourceRef: serving-4wfjs
    message: Running
    reason: Running
    resourceHash: "10662537031178369906"
    resourceRef: serving-4wfjs
    service: serving-4wfjs-ksvc-hcvfl
    state: Running
  sources:
  - git:
      commitAuthor: Benjamin Huo
      commitSha: 318ee2452fc1bb61a35b2c5016a8ab6fc29eef0c
    name: default

@Leo88886
Copy link
Author

@wanjunlei
is this yaml you want ?

Name: test--testtpy
Namespace: abc
Labels:
Annotations:
API Version: core.openfunction.io/v1beta1
Kind: Function
Metadata:
Creation Timestamp: 2023-11-13T09:26:33Z
Generation: 1
Managed Fields:
API Version: core.openfunction.io/v1beta1
Fields Type: FieldsV1
fieldsV1:
f:spec:
.:
f:build:
.:
f:builder:
f:env:
.:
f:CACHE_IMAGE:
f:GOOGLE_FUNCTION_SIGNATURE_TYPE:
f:GOOGLE_FUNCTION_SOURCE:
f:GOOGLE_FUNCTION_TARGET:
f:RUN_IMAGE:
f:srcRepo:
.:
f:credentials:
.:
f:name:
f:revision:
f:sourceSubPath:
f:url:
f:image:
f:imageCredentials:
.:
f:name:
f:port:
f:route:
.:
f:gatewayRef:
.:
f:name:
f:namespace:
f:rules:
f:serving:
.:
f:runtime:
f:scaleOptions:
.:
f:maxReplicas:
f:minReplicas:
f:template:
.:
f:containers:
f:version:
f:workloadRuntime:
Manager: kubectl-replace
Operation: Update
Time: 2023-11-13T09:26:33Z
API Version: core.openfunction.io/v1beta1
Fields Type: FieldsV1
fieldsV1:
f:status:
.:
f:addresses:
f:build:
.:
f:resourceHash:
f:resourceRef:
f:state:
f:revision:
.:
f:imageDigest:
f:route:
.:
f:conditions:
.:
k:{"type":"Accepted"}:
.:
f:lastTransitionTime:
f:message:
f:observedGeneration:
f:reason:
f:status:
f:type:
f:hosts:
f:paths:
f:serving:
.:
f:lastSuccessfulResourceRef:
f:resourceHash:
f:resourceRef:
f:service:
f:state:
f:sources:
Manager: openfunction
Operation: Update
Subresource: status
Time: 2023-11-13T09:32:51Z
Resource Version: 402062208
UID: 0840f9c4-8d29-4da8-90c6-a3939e832068
Spec:
Build:
Builder: openfunction/gcp-builder:v1
Env:
CACHE_IMAGE: xxx.xxx.xxx.xxx:81/openfunctiondev/cache-py:v1
GOOGLE_FUNCTION_SIGNATURE_TYPE: http
GOOGLE_FUNCTION_SOURCE: main.py
GOOGLE_FUNCTION_TARGET: hello_world
RUN_IMAGE: xxx.xxx.xxx.xxx:81/zhikong/ubuntu-20.04.4lts-block-inner:v2
Src Repo:
Credentials:
Name: secret-git-ssh-auth2
Revision: main
Source Sub Path: /testtpy
URL: [email protected]:abc/test.git
Image: xxx.xxx.xxx.xxx:81/abc/test--testtpy:v2
Image Credentials:
Name: push-secret
Port: 8080
Route:
Gateway Ref:
Name: openfunction
Namespace: openfunction
Rules:
Matches:
Path:
Type: PathPrefix
Value: /faas/abc/test/tt/py
Serving:
Runtime: knative
Scale Options:
Max Replicas: 10
Min Replicas: 1
Template:
Containers:
Image Pull Policy: IfNotPresent
Name: function
Resources:
Version: v2.0.0
Workload Runtime: OCIContainer
Status:
Addresses:
Type: External
Value: http://test--testtpy.abc.ofn.io/faas/abc/test/tt/py
Type: Internal
Value: http://test--testtpy.abc.svc.cluster.local/faas/abc/test/tt/py
Build:
Resource Hash: 1546743529005315067
Resource Ref: builder-bd2m5
State: Succeeded
Revision:
Image Digest: sha256:a798c8925788d8618a764fedbce39bbd57a971a602341478552b5366cbbb717a
Route:
Conditions:
Last Transition Time: 2023-11-13T09:39:57Z
Message: Valid HTTPRoute
Observed Generation: 1
Reason: Valid
Status: True
Type: Accepted
Hosts:
test--testtpy.abc.ofn.io
test--testtpy.abc.svc.cluster.local
Paths:
Type: PathPrefix
Value: /faas/abc/test/tt/py
Serving:
Last Successful Resource Ref: serving-csgxl
Resource Hash: 16111132736330349564
Resource Ref: serving-csgxl
Service: serving-csgxl-ksvc-qmklh
State: Running
Sources:
Git:
Commit Author: 2bdz
Commit Sha: 43ca3fe87b026b68d9401c0788d79486efe4a2e2
Name: default
Events:

@wanjunlei
Copy link
Member

The RUN_IMAGE used to build your function image, it will be the basic image of the function image, not the image of the workload.

@Leo88886
Copy link
Author

So, do you mean that after starting this function, I didn't use this image when it really works? "RUN_IMAGE" just published a basic image, but it wasn't used when starting the function, right?

I just want to use my own image when starting Python functions, because there are some files in my own image that my functions need to use. How can I declare this yaml? Could you please give me some guidance and send me a sample

@wanjunlei

@wanjunlei
Copy link
Member

I do not understand what you say. OpenFunction will build the image xxx.xxx.xxx.xxx:81/abc/test--testtpy:v2 using the base image 172.16.xxx.xxx:81/zhikong/ubuntu-20.04.4lts-block-inner: v2 , your function will be included in the image xxx.xxx.xxx.xxx:81/abc/test--testtpy:v2, and the files required by the function will also be included in the image xxx.xxx.xxx.xxx: 81/abc/test--testtpy:v2. Is this what you need?

@Leo88886
Copy link
Author

@wanjunlei
那意思就是我用我的那个yaml来发布的函数,运行环境就是172.16.xxx.xxx:81/zhikong/ubuntu-20.04.4lts-block-inner: v2 这个镜像呗?
但是我发现 函数的pod里面 没有我镜像里的文件呀。。。 说明用的就不是我RUN_IMAGE声明的这个对象。。

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

2 participants