Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Bad gateway occurred when an account with operator role list DevOps projects #9

@JohnNiang

Description

@JohnNiang

Description

Recently, I authorized a DevOps project to give an account named test operator permission. But when I logged in with test account and tries to list DevOps projects, a bad gateway error occurred.

image

image

Invoved API

/kapis/tenant.kubesphere.io/v1alpha2/workspaces/my-workspace/devops?limit=10

Error Stack

 W0802 09:20:58.653225       1 client_config.go:552] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.

 W0802 09:20:58.655138       1 options.go:107] ks-apiserver starts without redis provided, it will use in memory cache. This may cause inconsistencies when running ks-apiserver with multiple replicas.

 I0802 09:20:58.696255       1 apiserver.go:196] Start cache objects

 I0802 09:20:59.313052       1 apiserver.go:315] Finished caching objects

 I0802 09:20:59.313096       1 apiserver.go:150] Start listening on :9090

 &{test  [system:authenticated] map[]} my-workspace &{0xc00151d2d0 creationTimestamp false map[] }

 2021/08/02 09:21:09 http: panic serving 10.233.66.120:45972: runtime error: invalid memory address or nil pointer dereference

 goroutine 702 [running]:

 net/http.(*conn).serve.func1(0xc0004bf9a0)

 	/usr/local/go/src/net/http/server.go:1795 +0x139

 panic(0x1a69920, 0x2ec9990)

 	/usr/local/go/src/runtime/panic.go:679 +0x1b2

 devops.kubesphere.io/plugin/pkg/models/tenant.(*tenantOperator).ListDevOpsProjects(0xc000306a50, 0x200bbc0, 0xc00162a0c0, 0xc001c26c94, 0xc, 0xc00162ad80, 0x0, 0x0, 0xc0003fdda0)

 	/workspace/pkg/models/tenant/devops.go:74 +0x51b

 devops.kubesphere.io/plugin/pkg/kapis/tenant/v1alpha2.(*tenantHandler).ListDevOpsProjects(0xc00021a0d0, 0xc0007ac570, 0xc000185d50)

 	/workspace/pkg/kapis/tenant/v1alpha2/handler.go:69 +0x294

 github.com/emicklei/go-restful.(*FilterChain).ProcessFilter(0xc0007ac600, 0xc0007ac570, 0xc000185d50)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/filter.go:21 +0x8b

 devops.kubesphere.io/plugin/pkg/apiserver.logRequestAndResponse(0xc0007ac570, 0xc000185d50, 0xc0007ac600)

 	/workspace/pkg/apiserver/apiserver.go:344 +0x82

 github.com/emicklei/go-restful.(*FilterChain).ProcessFilter(0xc0007ac600, 0xc0007ac570, 0xc000185d50)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/filter.go:19 +0x65

 github.com/emicklei/go-restful.(*Container).dispatch(0xc0005f0000, 0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/container.go:291 +0x48d

 net/http.HandlerFunc.ServeHTTP(0xc00021a690, 0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 net/http.(*ServeMux).ServeHTTP(0xc00040c580, 0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/usr/local/go/src/net/http/server.go:2416 +0x1bd

 github.com/emicklei/go-restful.(*Container).ServeHTTP(0xc0005f0000, 0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/container.go:311 +0x2c9

 devops.kubesphere.io/plugin/pkg/apiserver/filters.WithKubeAPIServer.func1(0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/workspace/pkg/apiserver/filters/kubeapiserver.go:62 +0x37f

 net/http.HandlerFunc.ServeHTTP(0xc00040ca80, 0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 devops.kubesphere.io/plugin/pkg/apiserver/filters.WithAuthentication.func1(0x2004e40, 0xc0001e2b60, 0xc0000be700)

 	/workspace/pkg/apiserver/filters/authentication.go:70 +0x5ce

 net/http.HandlerFunc.ServeHTTP(0xc00040cb00, 0x2004e40, 0xc0001e2b60, 0xc0000be500)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 devops.kubesphere.io/plugin/pkg/apiserver/filters.WithRequestInfo.func1(0x2004e40, 0xc0001e2b60, 0xc0000be200)

 	/workspace/pkg/apiserver/filters/requestinfo.go:70 +0x3c5

 net/http.HandlerFunc.ServeHTTP(0xc000610de0, 0x2004e40, 0xc0001e2b60, 0xc0000be200)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 net/http.serverHandler.ServeHTTP(0xc0005f2380, 0x2004e40, 0xc0001e2b60, 0xc0000be200)

 	/usr/local/go/src/net/http/server.go:2831 +0xa4

 net/http.(*conn).serve(0xc0004bf9a0, 0x200b580, 0xc001b7dfc0)

 	/usr/local/go/src/net/http/server.go:1919 +0x875

 created by net/http.(*Server).Serve

 	/usr/local/go/src/net/http/server.go:2957 +0x384

 &{test  [system:authenticated] map[]} my-workspace &{0xc00165fc30 creationTimestamp false map[] }

 2021/08/02 09:21:10 http: panic serving 10.233.66.120:46002: runtime error: invalid memory address or nil pointer dereference

 goroutine 650 [running]:

 net/http.(*conn).serve.func1(0xc00032da40)

 	/usr/local/go/src/net/http/server.go:1795 +0x139

 panic(0x1a69920, 0x2ec9990)

 	/usr/local/go/src/runtime/panic.go:679 +0x1b2

 devops.kubesphere.io/plugin/pkg/models/tenant.(*tenantOperator).ListDevOpsProjects(0xc000306a50, 0x200bbc0, 0xc001680080, 0xc000dd53b4, 0xc, 0xc001680640, 0x0, 0x0, 0xc0003fdda0)

 	/workspace/pkg/models/tenant/devops.go:74 +0x51b

 devops.kubesphere.io/plugin/pkg/kapis/tenant/v1alpha2.(*tenantHandler).ListDevOpsProjects(0xc00021a0d0, 0xc000812c00, 0xc000183ce0)

 	/workspace/pkg/kapis/tenant/v1alpha2/handler.go:69 +0x294

 github.com/emicklei/go-restful.(*FilterChain).ProcessFilter(0xc000812c90, 0xc000812c00, 0xc000183ce0)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/filter.go:21 +0x8b

 devops.kubesphere.io/plugin/pkg/apiserver.logRequestAndResponse(0xc000812c00, 0xc000183ce0, 0xc000812c90)

 	/workspace/pkg/apiserver/apiserver.go:344 +0x82

 github.com/emicklei/go-restful.(*FilterChain).ProcessFilter(0xc000812c90, 0xc000812c00, 0xc000183ce0)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/filter.go:19 +0x65

 github.com/emicklei/go-restful.(*Container).dispatch(0xc0005f0000, 0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/container.go:291 +0x48d

 net/http.HandlerFunc.ServeHTTP(0xc00021a690, 0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 net/http.(*ServeMux).ServeHTTP(0xc00040c580, 0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/usr/local/go/src/net/http/server.go:2416 +0x1bd

 github.com/emicklei/go-restful.(*Container).ServeHTTP(0xc0005f0000, 0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/go/pkg/mod/github.com/emicklei/go-restful@v2.14.3+incompatible/container.go:311 +0x2c9

 devops.kubesphere.io/plugin/pkg/apiserver/filters.WithKubeAPIServer.func1(0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/workspace/pkg/apiserver/filters/kubeapiserver.go:62 +0x37f

 net/http.HandlerFunc.ServeHTTP(0xc00040ca80, 0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 devops.kubesphere.io/plugin/pkg/apiserver/filters.WithAuthentication.func1(0x2004e40, 0xc0005f20e0, 0xc0005fe400)

 	/workspace/pkg/apiserver/filters/authentication.go:70 +0x5ce

 net/http.HandlerFunc.ServeHTTP(0xc00040cb00, 0x2004e40, 0xc0005f20e0, 0xc0005fe300)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 devops.kubesphere.io/plugin/pkg/apiserver/filters.WithRequestInfo.func1(0x2004e40, 0xc0005f20e0, 0xc0005fe100)

 	/workspace/pkg/apiserver/filters/requestinfo.go:70 +0x3c5

 net/http.HandlerFunc.ServeHTTP(0xc000610de0, 0x2004e40, 0xc0005f20e0, 0xc0005fe100)

 	/usr/local/go/src/net/http/server.go:2036 +0x44

 net/http.serverHandler.ServeHTTP(0xc0005f2380, 0x2004e40, 0xc0005f20e0, 0xc0005fe100)

 	/usr/local/go/src/net/http/server.go:2831 +0xa4

 net/http.(*conn).serve(0xc00032da40, 0x200b580, 0xc000a91080)

 	/usr/local/go/src/net/http/server.go:1919 +0x875

 created by net/http.(*Server).Serve

 	/usr/local/go/src/net/http/server.go:2957 +0x384

/kind bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions