serverless / serverless-kubeless

This plugin enables support for Kubeless within the Serverless Framework.
Apache License 2.0
303 stars 81 forks source link

remove shell-escaping url in S3ZipContent #200

Closed lorenzo-ange closed 4 years ago

lorenzo-ange commented 4 years ago

Hello, when I deploy a Kubeless function with strategy: S3ZipContent, the deploy fails.

The pod goes in Init:CrashLoopBackOff status because the Kubeless prepare initContainer cannot retrieve the artifact from the bucket using the S3 presigned url.

Logs of the prepare initContainer:

sh: 1: -L: not found

The issue seems related to the CURL command in the preapre container that has the url argument with two quotes before and after the url.

Example:

curl ''https://grid.photosi.com/kubeless-artifacts-test/microservice-sls-test-1583329211862.zip?AWSAccessKeyId=XXXXX&Expires=1614865212&Signature=a%2Fc%2F5A3k3G0EbL%2Fz0Up9u8m6pN0%3D''
          -L --silent --output /tmp/func.fromurl && echo 'f68e1c7f7427afdc65b4cdcd514239fdb3ffd4850cb00cd6032189305b9ee827  /tmp/func.fromurl'
          > /tmp/func.sha256 && sha256sum -c /tmp/func.sha256 && unzip -o /tmp/func.fromurl
          -d /kubeless && cp /src/project.csproj /kubeless

Seems that shellescape in lib/strategy/s3_zip_content.js is the cause of this issue and I think it should be no more necessary because of this commit to the kubeless project.

I hope this PR could be merged to fix issues with S3ZipContent deploys. Let me know if you have any questions, comments or suggestions.

Thank you very much for your work, Lorenzo Angelini

andresmgot commented 4 years ago

Thanks for the PR @lorenzo-ange!

From your comment is not clear to me if you were able to verify if removing that dependency fixes the problem. Can you confirm it?

Also, to automatically publish your changes, do you mind increasing the version of the package in the package.json?

lorenzo-ange commented 4 years ago

Hi @andresmgot , I confirm that this PR fixes the problem. I updated the package version in package.json and also updated the Kubeless and Kubeless Kafka versions in travis-ci configuration to make the tests pass.

Thank you, Lorenzo