knative/func

`func deploy --remote` failure to watch & deploy

acelinkio opened this issue ยท 5 comments

Summary

There are two issues when running the func deploy --remote command.

  • func is about unable to decode actions form kubernetes
  • tekton pipeline fails on the deploy action

Mentioned this briefly in another comment #1466 (comment)

Steps to Recreate

func create -l python hello
cd hello
func deploy --remote --registry docker.io/acelinkit
๐Ÿ•˜ Creating Pipeline resources
๐Ÿ•– ase provide credentials for image registry (index.docker.io).
๐Ÿ•— sername: acelinkit
๐Ÿ•‘ ************
Credentials will not be saved.
If you would like to save your credentials in the future,
you can install docker credential helper https://github.com/docker/docker-credential-helpers.
W0716 14:41:34.649153   74920 reflector.go:347] github.com/tektoncd/pipeline/pkg/client/informers/externalversions/factory.go:117: watch of *v1.PipelineRun ended with: an error on the server ("unable to decode an event from the watch stream: unable to decode watch event: no kind \"PipelineRun\" is registered for version \"tekton.dev/v1\" in scheme \"github.c๐Ÿ•‘ tektoncd/pipeline/pkg/client/clientset/versioned/scheme/register.go:32\"") has prevented the request from succeeding
W0716 14:41:47.868666   74920 reflector.go:347] github.com/tektoncd/pipeline/pkg/client/informers/externalversions/factory.go:117: watch of *v1.PipelineRun ended with: an error on the server ("unable to decode an event from the watch stream: unable to decode watch event: no kind \"PipelineRun\" is registered for version \"tekton.dev/v1\" in scheme \"github.c๐Ÿ•• tektoncd/pipeline/pkg/client/clientset/versioned/scheme/register.go:32\"") has prevented the request from succeeding
W0716 14:41:51.879204   74920 reflector.go:347] github.com/tektoncd/pipeline/pkg/client/informers/externalversions/factory.go:117: watch of *v1.PipelineRun ended with: an error on the server ("unable to decode an event from the watch stream: unable to decode watch event: no kind \"PipelineRun\" is registered for version \"tekton.dev/v1\" in scheme \"github.c๐Ÿ•” tektoncd/pipeline/pkg/client/clientset/versioned/scheme/register.go:32\"") has prevented the request from succeeding

Details

However the command clearly created a pipeline run as a result. Clealry using the tekton.dev/v1 api version and kind PipelineRun.

kubectl describe pipelinerun                                                                                                                                                                                                                                        14:44:23 
Name:         hello-pack-upload-pipeline-run-b8kpl
Namespace:    default
Labels:       boson.dev/function=true
              boson.dev/runtime=python
              function.knative.dev=true
              function.knative.dev/name=hello
              function.knative.dev/runtime=python
              tekton.dev/pipeline=hello-pack-upload-pipeline
Annotations:  <none>
API Version:  tekton.dev/v1
Kind:         PipelineRun
...

The tekton build task does complete successfully and does publish an image to https://hub.docker.com/r/acelinkit/hello

And the corresponding logs from the corresponding deploy task run

kubectl -n default logs hello-pack-upload-pipeline-run-b8kpl-deploy-pod -c step-func-deploy                                                                                                                                                                         15:17:18 
โฌ†๏ธ  Deploying function to the cluster
W0716 21:41:51.639058      22 warnings.go:70] Kubernetes default value is insecure, Knative may default this to secure in a future release: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation, spec.template.spec.containers[0].securityContext.capabiliti
es, spec.template.spec.containers[0].securityContext.runAsNonRoot, spec.template.spec.containers[0].securityContext.seccompProfile
deploy error: knative deployer failed to update the Knative Service: admission webhook "validation.webhook.serving.knative.dev" denied the request: validation failed: missing field(s): spec.template.spec.containers[0].image
Error: knative deployer failed to update the Knative Service: admission webhook "validation.webhook.serving.knative.dev" denied the request: validation failed: missing field(s): spec.template.spec.containers[0].image

However I can manually run the command locally and it is successful. Looks like there the issue passing the image between tasks.

func deploy --verbose --build=false --push=false --remote=false --image=acelinkit/hello
โฌ†๏ธ  Deploying function to the cluster
W0716 15:24:18.893097  177487 warnings.go:70] Kubernetes default value is insecure, Knative may default this to secure in a future release: spec.template.spec.containers[0].securityContext.allowPrivilegeEscalation, spec.template.spec.containers[0].securityContext.capabilities, spec.template.spec.containers[0].securityContext.runAsNonRoot, spec.template.spec.containers[0].securityContext.seccompProfile
โœ… Function updated in namespace "default" and exposed at URL:
   http://hello.default.svc.cluster.local

Versions

Client

Server

kubectl apply -f https://raw.githubusercontent.com/knative-sandbox/kn-plugin-func/main/pkg/pipelines/resources/tekton/task/func-buildpacks/0.1/func-buildpacks.yaml
kubectl apply -f https://raw.githubusercontent.com/knative-sandbox/kn-plugin-func/main/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
kubectl apply -f https://raw.githubusercontent.com/knative-sandbox/kn-plugin-func/main/pkg/pipelines/resources/tekton/task/func-deploy/0.1/func-deploy.yaml

I did try following the tutorial from https://github.com/knative/func/blob/knative-v1.10.1/docs/building-functions/on_cluster_build.md#building-a-function-on-cluster using the git method and saw the same results even when updating func.yaml registry and image fields.

@acelinkio does this happen on main? I believe this should have been fixed by dependency update.

@acelinkio is this still happening with latest func?

Hey. I can check it out tomorrow with the latest release. Will let you know how it goes

@matejvasek func deploy --remote works now using the 1.11.0 release of func. Please note that I had to delete previous Tekton tasks. Appreciate your help, closing ticket.