func icon indicating copy to clipboard operation
func copied to clipboard

Func deploy python not work.

Open ryan-alexander-zhang opened this issue 4 months ago • 11 comments

Hi team.

I used the func deploy --remote to deploy the default Python func. But the Tekton build the source as Java. It looks weird.

Here's my function yaml:

          # $schema: https://raw.githubusercontent.com/knative/func/refs/tags/v0.36.0/schema/func_yaml-schema.json
          # yaml-language-server: $schema=https://raw.githubusercontent.com/knative/func/refs/tags/v0.36.0/schema/func_yaml-schema.json
          specVersion: 0.36.0
          name: fn-py-01
          runtime: python
          registry: <registry>
          namespace: ronghuanz40
          created: 2025-08-13T15:05:40.187484+08:00
          build:
            git:
              url: <git-url>
            builder: pack
          run:
            envs:
            - name: name
              value: sahara6
          deploy:
            serviceAccountName: ronghuanz40
            options:
              resources:
                requests:
                  cpu: 50m
                  memory: 129Mi
                limits:
                  cpu: 129m
                  memory: 1024Mi
              scale:
                min: 0
                max: 3

ryan-alexander-zhang avatar Aug 14 '25 07:08 ryan-alexander-zhang

kubectl logs --tail=100 -f fn-py-01-00001-deployment-86f8c8dd75-lv2cw -n ronghuanz40

Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx479908K -XX:MaxMetaspaceSize=56667K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 1G, Thread Count: 250, Loaded Class Count: 7591, Headroom: 0%)
Enabling Java Native Memory Tracking
Using readonly truststore: /tmp/truststore
Adding 146 container CA certificates to JVM truststore
---> Installing application source ...
mv: cannot stat '/tmp/src/*': No such file or directory

ryan-alexander-zhang avatar Aug 14 '25 08:08 ryan-alexander-zhang

func version -v

Version: v0.45.1
Knative: v1.18.1
Commit: c1160e14
SocatImage: ghcr.io/knative/func-utils:v2
TarImage: ghcr.io/knative/func-utils:v2

ryan-alexander-zhang avatar Aug 14 '25 09:08 ryan-alexander-zhang

Hey! thank you very much for reporting this issue. Im able to reproduce.

So far it seems that the issue is only with python. The other runtimes seem to work as intended. I suspect there is an issue because of our recent python template re-do. Will investigate further.

gauron99 avatar Aug 19 '25 07:08 gauron99

Hey! thank you very much for reporting this issue. Im able to reproduce.

So far it seems that the issue is only with python. The other runtimes seem to work as intended. I suspect there is an issue because of our recent python template re-do. Will investigate further.

Thanks for your reply. Kindly let me know if there are any updates. Thanks.

ryan-alexander-zhang avatar Aug 19 '25 09:08 ryan-alexander-zhang

@gauron99 Hi, I just wanted to check if there are any updates on this issue. Am I able to use the Python function now? Thanks a lot.

ryan-alexander-zhang avatar Aug 26 '25 01:08 ryan-alexander-zhang

@ryan-alexander-zhang hey, Im pretty sure I have identified the issue, its with the buildpacks and the way we package the function. Im now working on a fix. Theres an "easy" solution but that was a bit too hacky to merge to main so its taking a bit more time. Thanks for your patience! PR should be up soon. I expect couple of days max. This week for sure.

gauron99 avatar Aug 26 '25 05:08 gauron99

Thanks so much for your reply and for all the hard work. It's really appreciated.

ryan-alexander-zhang avatar Aug 26 '25 05:08 ryan-alexander-zhang

@ryan-alexander-zhang I have a working change. If you were interested in doing a bit of hacking you can try already using my branch, otherwise I will get this into func after some time. Im just also doing a bit of related cleanup etc.

If you were to use my branch https://github.com/gauron99/func/tree/push-loznlwuozlqs you would ~~need to build the func-util image and~~ use that instead of the func one (you can see a where Im going within the changes in the branch). edit: Actually since I already built the image, you might not need to do much hacking after all, all changes should be within the branch so just make and run it.

Let me know if you are interested in that and I can get you the necessary steps, otherwise Ill get it into func asap.

gauron99 avatar Aug 27 '25 10:08 gauron99

@gauron99 Thanks—that’s really helpful. I read through the HEAD commit in your repo, and it looks like I just need to rebuild the CLI using the image you’ve already built.

And I have a question about pkg/pipelines/tekton/pipelines_provider.go: is this where the Tekton scaffolding step is implemented?

ryan-alexander-zhang avatar Aug 27 '25 13:08 ryan-alexander-zhang

The scaffolding step is really in a transition right now. Think of this as a hot fix for an actual codebase fix later. I have that planned right after this. And yes, the scaffolding is done vie the "injector" in the new changes in my branch

and yes, you should be able to just rebuild!

gauron99 avatar Aug 27 '25 14:08 gauron99

Thank you very much! I will have a try.

ryan-alexander-zhang avatar Aug 27 '25 14:08 ryan-alexander-zhang