zou8944 opened a new issue, #1427:
URL: https://github.com/apache/apisix-ingress-controller/issues/1427

   ### Issue description
   
   MetricsCollector should be assign value 
[here](https://github.com/apache/apisix-ingress-controller/blob/6b38e806b0862b98e7565934b47143230d23bad8/pkg/api/server.go#L87),
 or nil panic will be raised at [this 
line](https://github.com/apache/apisix-ingress-controller/blob/6b38e806b0862b98e7565934b47143230d23bad8/pkg/apisix/cluster.go#L596).
   
   I got this panic when start ingress-controller.
   
   ### Environment
   
   - your apisix-ingress-controller version (output of 
apisix-ingress-controller version --long):
   - your Kubernetes cluster version (output of kubectl version):
   - if you run apisix-ingress-controller in Bare-metal environment, also show 
your OS version (uname -a):
   
   
   ### Minimal test code / Steps to reproduce
   
   build image , deploy to k8s
   
   ### Actual result
   
   controller start fail
   
   ### Error log
   
   2022-11-02T11:55:43+08:00    info   ingress/ingress.go:128  apisix 
ingress controller started
   2022-11-02T11:55:43+08:00    info   ingress/ingress.go:130  version:
   Version: 1.5.0
   Git SHA: no-git-module
   Go Version: go1.18.7
   Building OS/Arch: linux/aarch64
   Running OS/Arch: linux/arm64
   
   2022-11-02T11:55:43+08:00    info   ingress/ingress.go:136  use 
configuration
   {
        "cert_file": "/etc/webhook/certs/cert.pem",
        "key_file": "/etc/webhook/certs/key.pem",
        "log_level": "info",
        "log_output": "stderr",
        "log_rotate_output_path": "",
        "log_rotation_max_size": 100,
        "log_rotation_max_age": 0,
        "log_rotation_max_backups": 0,
        "http_listen": ":8080",
        "https_listen": ":8443",
        "ingress_publish_service": "",
        "ingress_status_address": [],
        "enable_profiling": true,
        "kubernetes": {
                "kubeconfig": "",
                "resync_interval": "6h0m0s",
                "app_namespaces": [
                        ""
                ],
                "namespace_selector": null,
                "election_id": "ingress-apisix-leader",
                "ingress_class": "apisix",
                "ingress_version": "networking/v1",
                "watch_endpoint_slices": false,
                "api_version": "apisix.apache.org/v2",
                "enable_gateway_api": false
        },
        "apisix": {
                "default_cluster_name": "default",
                "default_cluster_base_url": 
"http://apisix-admin.apisix:9180/apisix/admin";,
                "default_cluster_admin_key": "edd1c9f034335f136f87ad84b625c8f1"
        },
        "apisix-resource-sync-interval": "5m0s"
   }
   panic: runtime error: invalid memory address or nil pointer dereference
   [signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x10f61e0]
   
   goroutine 1 [running]:
   
github.com/apache/apisix-ingress-controller/pkg/apisix.(*cluster).listResource(0x400024d040,
 {0x19e67b8?, 0x4000132000?}, {0x400058e440, 0x3a}, {0x171e39d, 0xb})
        /build/pkg/apisix/cluster.go:579 +0xd0
   
github.com/apache/apisix-ingress-controller/pkg/apisix.newStreamRouteClient(0x400024d040)
        /build/pkg/apisix/stream_route.go:37 +0x74
   
github.com/apache/apisix-ingress-controller/pkg/apisix.newCluster({0x19e67b8?, 
0x4000132008}, 0x40005ce0a0)
        /build/pkg/apisix/cluster.go:142 +0x4f0
   
github.com/apache/apisix-ingress-controller/pkg/apisix.(*apisix).AddCluster(0x40005b8b40,
 {0x19e67b8, 0x4000132008}, 0x40005ce0a0)
        /build/pkg/apisix/apisix.go:210 +0xa4
   
github.com/apache/apisix-ingress-controller/pkg/api/validation.GetSchemaClient.func1()
        /build/pkg/api/validation/utils.go:49 +0x1b0
   sync.(*Once).doSlow(0x144c920?, 0x40003511d0?)
        /usr/local/go/src/sync/once.go:68 +0x10c
   sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:59
   
github.com/apache/apisix-ingress-controller/pkg/api/validation.GetSchemaClient(0x278ffe0?)
        /build/pkg/api/validation/utils.go:42 +0x50
   
github.com/apache/apisix-ingress-controller/pkg/api/router.MountWebhooks(0x4000104820,
 0x40005b7908?)
        /build/pkg/api/router/webhook.go:28 +0x28
   github.com/apache/apisix-ingress-controller/pkg/api.NewServer(0x4000003520)
        /build/pkg/api/server.go:83 +0x6f4
   
github.com/apache/apisix-ingress-controller/pkg/providers.NewController(0x4000003520)
        /build/pkg/providers/controller.go:107 +0x1f8
   
github.com/apache/apisix-ingress-controller/cmd/ingress.NewIngressCommand.func1(0x4000452c00?,
 {0x170f245?, 0x2?, 0x2?})
        /build/cmd/ingress/ingress.go:139 +0x5d8
   github.com/spf13/cobra.(*Command).execute(0x4000452c00, {0x4000479460, 0x2, 
0x2})
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:920 +0x5f4
   github.com/spf13/cobra.(*Command).ExecuteC(0x4000452900)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:1040 +0x360
   github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:968
   main.main()
        /build/main.go:26 +0x24
   
   
   ### Expected result
   
   start success


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to