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

创建同步函数失败 #471

Open
mzychaco opened this issue Jul 20, 2023 · 4 comments
Open

创建同步函数失败 #471

mzychaco opened this issue Jul 20, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@mzychaco
Copy link

mzychaco commented Jul 20, 2023

Description
按照官网指引安装好openfunction,过程符合官网描述,没什么问题,然后我尝试创建一个简单的同步函数,yaml如下:

apiVersion: core.openfunction.io/v1beta1
kind: Function
metadata:
  name: function-sample
spec:
  image: "<本地仓库的镜像地址>"

然后执行kubectl apply -f xxx.yaml
但报错返回:

Error from server (InternalError): error when creating "test-go-func.yaml": Internal error occurred: failed calling webhook "mfunctions.of.io": failed to call webhook: Post "https://openfunction-webhook-service.openfunction.svc:443/mutate-core-openfunction-io-v1beta2-function?timeout=10s": EOF

请问该如何解决?

Environmental
Tell us what your cluster environment is like, e.g.

  • Operating System Information:Linux version 4.19.0-amd64-desktop
  • kubernetes version: 1.27.3
  • minikube: 1.31.0
  • OpenFunction version: v1.1.x
  • Versions of dependent components (e.g. dapr, keda, shipwright, knative)

Expected behavior
Tell us what should happen.

Actual behavior
Tell us what happens instead. Provide a log message if relevant.

To Reproduce
Steps to reproduce the behavior:

  1. '..'
  2. '...'
  3. '....'
  4. See error

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
我尝试查看openfunction- controller- manager的日志:

http: panic serving 10.244.0.1:32167: runtime error: invalid memory address or nil pointer dereference
goroutine 10566 [running]:
net/http.(*conn).serve.func1()
        /usr/local/go/src/net/http/server.go:1825 +0xbf
panic({0x160c7a0, 0x25e6e00})
        /usr/local/go/src/runtime/panic.go:844 +0x258
github.com/openfunction/apis/core/v1beta2.(*Function).Default(0xc000475880)
        /workspace/apis/core/v1beta2/function_webhook.go:104 +0x145
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*mutatingHandler).Handle(_, {_, _}, {{{0xc000740c30, 0x24}, {{0xc000d4aa80, 0x14}, {0xc000d19510, 0x7}, {0xc000d19518, ...}}, ...}})
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.2/pkg/webhook/admission/defaulter.go:66 +0x1f9
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc000740c30, 0x24}, {{0xc000d4aa80, 0x14}, {0xc000d19510, 0x7}, {0xc000d19518, ...}}, ...}})
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.2/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0004696c0, {0x7ff761624ce0?, 0xc000c1f5e0}, 0xc000bb8d00)
        /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.11.2/pkg/webhook/admission/http.go:99 +0xe90
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7ff761624ce0, 0xc000c1f5e0}, 0x1a5a900?)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/promhttp/instrument_server.go:60 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1a5a978?, {0x7ff761624ce0?, 0xc000c1f5e0?}, 0x756040?)
        /usr/local/go/src/net/http/server.go:2084 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1a5a978?, 0xc0005a8ee0?}, 0xc000bb8d00)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/promhttp/instrument_server.go:146 +0xb8
net/http.HandlerFunc.ServeHTTP(0x74d8a8?, {0x1a5a978?, 0xc0005a8ee0?}, 0xc000bd2b81?)
        /usr/local/go/src/net/http/server.go:2084 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1a5a978, 0xc0005a8ee0}, 0xc000bb8d00)
        /go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/promhttp/instrument_server.go:108 +0xbf
net/http.HandlerFunc.ServeHTTP(0x282dc7db332?, {0x1a5a978?, 0xc0005a8ee0?}, 0xc000413f90?)
        /usr/local/go/src/net/http/server.go:2084 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc000bbe673?, {0x1a5a978, 0xc0005a8ee0}, 0xc000bb8d00)
        /usr/local/go/src/net/http/server.go:2462 +0x149
net/http.serverHandler.ServeHTTP({0x1a4df40?}, {0x1a5a978, 0xc0005a8ee0}, 0xc000bb8d00)
        /usr/local/go/src/net/http/server.go:2916 +0x43b
net/http.(*conn).serve(0xc000879a40, {0x1a5b718, 0xc000495770})
        /usr/local/go/src/net/http/server.go:1966 +0x5d7
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:3071 +0x4db

@mzychaco mzychaco added the bug Something isn't working label Jul 20, 2023
@vfarcic
Copy link

vfarcic commented Jul 21, 2023

Experiencing the same issue.

@benjaminhuo
Copy link
Member

benjaminhuo commented Jul 24, 2023

按照官网指引安装好openfunction,过程符合官网描述,没什么问题,然后我尝试创建一个简单的同步函数,yaml如下:

Following which doc? Can you give the entire yaml ?

Have you tried examples here?
https://openfunction.dev/docs/getting-started/quickstarts/sync-functions/

@mzychaco
Copy link
Author

mzychaco commented Aug 1, 2023

The problem has been resolved. The YAML I was using was incomplete; the official documentation provides only partial content. To make it work, I need to use the complete function definition YAML.

@uestczz
Copy link

uestczz commented Sep 8, 2023

@benjaminhuo I meet this too. my system is Ubuntu 22.04 LTS. k8s v1.22.2. I use helm to install openfunction. I use the hello word yaml.

apiVersion: core.openfunction.io/v1beta2
kind: Function
metadata:
  name: function-sample
spec:
  version: "v2.0.0"
  image: "openfunctiondev/sample-go-func:v1"
  imageCredentials:
    name: push-secret
  build:
    builder: openfunction/builder-go:latest
    env:
      FUNC_NAME: "HelloWorld"
      FUNC_CLEAR_SOURCE: "true"
      # # Use FUNC_GOPROXY to set the goproxy if failed to fetch go modules
      # FUNC_GOPROXY: "https://goproxy.cn"
    srcRepo:
      url: "https://github.com/OpenFunction/samples.git"
      sourceSubPath: "functions/knative/hello-world-go"
      revision: "main"
  serving:
    template:
      containers:
        - name: function # DO NOT change this
          imagePullPolicy: IfNotPresent
    triggers:
      http:
        port: 8080

this may not happened, when I use v1.26.0 k8s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants