knative/func

Regarding the issues of compilation and deployment. knative 1.14

Closed this issue · 8 comments

When deploying with func deploy, there is a func.yaml file under the directory, and parameters such as the deployed image have already been described in the file. However, when deploying, it does not read the image in the func.yaml, but reads the image of build-image under.func. When I delete the.func directory under the directory, the deployment will report an error, as shown in the figure.
image
However, in versions 1.12 and earlier of Knative, this issue did not exist.
A simple deployment method should only require one yaml file to be sufficient.

my fun.yaml.

specVersion: 0.36.0
name: instantiate
runtime: go
registry: 192.168.100.167:80
image: 192.168.100.167:80/serverless/flow-model-gvcbkl-instantiate:v3
namespace: flow-model-gvcbkl
created: 2024-05-28T10:39:25.562440871Z
build:
  builder: pack
run:
  envs:
  - name: FUNC_ID
    value: 5fd83203-aeaf-48c8-88d2-7fa3fc07aa90
  - name: FUNC_TYPE
    value: http
  - name: FUNC_NAME
    value: instantiate
deploy:
  namespace: flow-model-gvcbkl
  image: 192.168.100.167:80/serverless/flow-model-gvcbkl-instantiate:v3
  options:
    scale:
      min: 1
      max: 5
      metric: concurrency
      target: 75
      utilization: 75
    resources:
      requests:
        cpu: 10m
        memory: 128Mi
      limits:
        cpu: 100m
        memory: 256Mi
        concurrency: 100

There is still one question. In the.func directory, in the built-hash and built-image files, there are only the corresponding string contents, but there is execution permission. The file permission should be read-only.

This also affects func deploy --build=false --image <image> and func run where you do not build with func

This also affects func deploy --build=false --image <image> and func run where you do not build with func

I have already compiled it in advance and pushed the compiled image to the remote repository. In version 1.12, under the directory, there is func.yaml. Executing func deploy --push=false --build=false can be executed successfully, but in version 1.14, this problem will occur.

Just wanted to confirm that I'm also seeing the same behaviour mentioned here as well - func deploy --push=false --build=false --image=myregistry.example.com/myfunction:latest isn't behaving correctly with the latest func release.

I configured my environment to run func deploy through a locally running mitmproxy and can confirm that the JSON for the Service CR that gets PUT to the Kubernetes API really is missing the spec.template.spec.containers[0].image field mentioned in the error - everything else in the CR is virtually identical.

I've been able to work around this for now by rolling back to the previous version of the func CLI, i.e. v0.40.1 which I believe is the release tagged v1.13.1 in this repo.

@Taylorzhao maybe try rolling back to the previous func version and see if it works for you as well?

Just wanted to confirm that I'm also seeing the same behaviour mentioned here as well - func deploy --push=false --build=false --image=myregistry.example.com/myfunction:latest isn't behaving correctly with the latest func release.

I configured my environment to run func deploy through a locally running mitmproxy and can confirm that the JSON for the Service CR that gets PUT to the Kubernetes API really is missing the spec.template.spec.containers[0].image field mentioned in the error - everything else in the CR is virtually identical.

I've been able to work around this for now by rolling back to the previous version of the func CLI, i.e. v0.40.1 which I believe is the release tagged v1.13.1 in this repo.

@Taylorzhao maybe try rolling back to the previous func version and see if it works for you as well?

I create a.func directory under the directory, create a built-image file under the.func directory, write the image address in the file, and then it can be successfully executed as func deploy --build=false --push=false.

Hi folks,

I would just like to confirm that when using --build=false in combination with --image={your image} it should not require having an image locally available, or even that the .func directory exist.

This command should create a new Knative Serivce revision which references the image given by the --image flag, even if that image is not available locally (was not built locally, or through some other means).

I am pretty sure we have both unit and E2E tests which confirm that func deploy --build=false --image={your image} works in this manner, but bugs always find a way through.

@Taylorzhao your initial issue is focusing on the func.yaml. To be able to easily recreate the issue, can we please confirm that the command is working as expected? I believe the correct command for your situation might be:
func deploy --build=false --image=192.168.100.167:80/serverless/flow-model-gvcbkl-instantiate:v3

@9numbernine9 and @braunsonm It appears this is what you have both observed, so we will try to recreate the issue on our end

Thanks for contributing to the issue

Ive recreated the issue, working on a fix.

This is my mistake when I have changed the deploy process a bit a while back. Thanks for reporting this

@9numbernine9 @Taylorzhao ^ above PR should allow you to deploy directly with undigested images (tagged/untagged ones) given you deploy with --build=false and --push=false

@gauron99 After building the code with the changes from that PR, I can confirm that the changes fix the func deploy --push=false --build=false --image=myregistry.example.com/myfunction:latest use case. 😃