kubernetes-retired / kubefed

Kubernetes Cluster Federation
Apache License 2.0
2.5k stars 531 forks source link

controller-manager panic when field insecure-skip-tls-verify of kubeconfig is ture #1504

Closed xyz-li closed 2 years ago

xyz-li commented 2 years ago

What happened: controller-manager panic when field insecure-skip-tls-verify of kubeconfig is ture

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true    # Set this field to true.

Anything else we need to know?:

Environment:

/kind bug

I0524 14:47:21.700517       1 cluster_util.go:96] Cluster member will use a custom transport for TLS certificate validation
E0524 14:47:21.700806       1 runtime.go:78] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 696 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x1bce7a0, 0x2d883a0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:74 +0x95
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:48 +0x86
panic(0x1bce7a0, 0x2d883a0)
    /usr/local/go/src/runtime/panic.go:965 +0x1b9
sigs.k8s.io/kubefed/pkg/controller/util.CustomizeCertificateValidation(0xc000cc48b0, 0x0, 0x0, 0x0)
    /app/pkg/controller/util/cluster_util.go:155 +0x37
sigs.k8s.io/kubefed/pkg/controller/util.CustomizeTLSTransport(0xc000cc48b0, 0xc000403d40, 0x0, 0x0)
    /app/pkg/controller/util/cluster_util.go:127 +0x23a
sigs.k8s.io/kubefed/pkg/controller/util.BuildClusterConfig(0xc000cc48b0, 0x20e6fb8, 0xc000850550, 0xc0000482b8, 0x16, 0x0, 0x40e278, 0xb6)
    /app/pkg/controller/util/cluster_util.go:97 +0x49a
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.NewClusterClientSet(0xc000cc48b0, 0x20e6fb8, 0xc000850550, 0xc0000482b8, 0x16, 0xb2d05e00, 0x1e81ebd, 0x2c, 0xc0009457d0)
    /app/pkg/controller/kubefedcluster/clusterclient.go:70 +0x5d
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.(*ClusterController).addToClusterSet(0xc00026a0e0, 0xc000cc48b0)
    /app/pkg/controller/kubefedcluster/controller.go:185 +0x1f0
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.newClusterController.func2(0x1e08800, 0xc000cc48b0)
    /app/pkg/controller/kubefedcluster/controller.go:139 +0x45
k8s.io/client-go/tools/cache.ResourceEventHandlerFuncs.OnAdd(...)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:231
k8s.io/client-go/tools/cache.newInformer.func1(0x1bf3cc0, 0xc0005d8d50, 0x1, 0xc0005d8d50)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:407 +0x198
k8s.io/client-go/tools/cache.(*DeltaFIFO).Pop(0xc0004cee60, 0xc0006d1110, 0x0, 0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/delta_fifo.go:544 +0x322
k8s.io/client-go/tools/cache.(*controller).processLoop(0xc000a5c7e0)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:183 +0x42
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000c0ff90)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc000e3df90, 0x20998e0, 0xc000b0f9b0, 0xc0007b2e01, 0xc00093d560)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:156 +0x9b
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000c0ff90, 0x3b9aca00, 0x0, 0xc000416501, 0xc00093d560)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.Until(...)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:90
k8s.io/client-go/tools/cache.(*controller).Run(0xc000a5c7e0, 0xc00093d560)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:154 +0x2e5
created by sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.(*ClusterController).Run
    /app/pkg/controller/kubefedcluster/controller.go:197 +0x88
E0524 14:47:21.701082       1 runtime.go:78] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 696 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic(0x1bce7a0, 0x2d883a0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:74 +0x95
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:48 +0x86
panic(0x1bce7a0, 0x2d883a0)
    /usr/local/go/src/runtime/panic.go:965 +0x1b9
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:55 +0x109
panic(0x1bce7a0, 0x2d883a0)
    /usr/local/go/src/runtime/panic.go:965 +0x1b9
sigs.k8s.io/kubefed/pkg/controller/util.CustomizeCertificateValidation(0xc000cc48b0, 0x0, 0x0, 0x0)
    /app/pkg/controller/util/cluster_util.go:155 +0x37
sigs.k8s.io/kubefed/pkg/controller/util.CustomizeTLSTransport(0xc000cc48b0, 0xc000403d40, 0x0, 0x0)
    /app/pkg/controller/util/cluster_util.go:127 +0x23a
sigs.k8s.io/kubefed/pkg/controller/util.BuildClusterConfig(0xc000cc48b0, 0x20e6fb8, 0xc000850550, 0xc0000482b8, 0x16, 0x0, 0x40e278, 0xb6)
    /app/pkg/controller/util/cluster_util.go:97 +0x49a
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.NewClusterClientSet(0xc000cc48b0, 0x20e6fb8, 0xc000850550, 0xc0000482b8, 0x16, 0xb2d05e00, 0x1e81ebd, 0x2c, 0xc0009457d0)
    /app/pkg/controller/kubefedcluster/clusterclient.go:70 +0x5d
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.(*ClusterController).addToClusterSet(0xc00026a0e0, 0xc000cc48b0)
    /app/pkg/controller/kubefedcluster/controller.go:185 +0x1f0
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.newClusterController.func2(0x1e08800, 0xc000cc48b0)
    /app/pkg/controller/kubefedcluster/controller.go:139 +0x45
k8s.io/client-go/tools/cache.ResourceEventHandlerFuncs.OnAdd(...)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:231
k8s.io/client-go/tools/cache.newInformer.func1(0x1bf3cc0, 0xc0005d8d50, 0x1, 0xc0005d8d50)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:407 +0x198
k8s.io/client-go/tools/cache.(*DeltaFIFO).Pop(0xc0004cee60, 0xc0006d1110, 0x0, 0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/delta_fifo.go:544 +0x322
k8s.io/client-go/tools/cache.(*controller).processLoop(0xc000a5c7e0)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:183 +0x42
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000c0ff90)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc000e3df90, 0x20998e0, 0xc000b0f9b0, 0xc0007b2e01, 0xc00093d560)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:156 +0x9b
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000c0ff90, 0x3b9aca00, 0x0, 0xc000416501, 0xc00093d560)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.Until(...)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:90
k8s.io/client-go/tools/cache.(*controller).Run(0xc000a5c7e0, 0xc00093d560)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:154 +0x2e5
created by sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.(*ClusterController).Run
    /app/pkg/controller/kubefedcluster/controller.go:197 +0x88
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0x18e2e77]

goroutine 696 [running]:
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:55 +0x109
panic(0x1bce7a0, 0x2d883a0)
    /usr/local/go/src/runtime/panic.go:965 +0x1b9
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/runtime/runtime.go:55 +0x109
panic(0x1bce7a0, 0x2d883a0)
    /usr/local/go/src/runtime/panic.go:965 +0x1b9
sigs.k8s.io/kubefed/pkg/controller/util.CustomizeCertificateValidation(0xc000cc48b0, 0x0, 0x0, 0x0)
    /app/pkg/controller/util/cluster_util.go:155 +0x37
sigs.k8s.io/kubefed/pkg/controller/util.CustomizeTLSTransport(0xc000cc48b0, 0xc000403d40, 0x0, 0x0)
    /app/pkg/controller/util/cluster_util.go:127 +0x23a
sigs.k8s.io/kubefed/pkg/controller/util.BuildClusterConfig(0xc000cc48b0, 0x20e6fb8, 0xc000850550, 0xc0000482b8, 0x16, 0x0, 0x40e278, 0xb6)
    /app/pkg/controller/util/cluster_util.go:97 +0x49a
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.NewClusterClientSet(0xc000cc48b0, 0x20e6fb8, 0xc000850550, 0xc0000482b8, 0x16, 0xb2d05e00, 0x1e81ebd, 0x2c, 0xc0009457d0)
    /app/pkg/controller/kubefedcluster/clusterclient.go:70 +0x5d
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.(*ClusterController).addToClusterSet(0xc00026a0e0, 0xc000cc48b0)
    /app/pkg/controller/kubefedcluster/controller.go:185 +0x1f0
sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.newClusterController.func2(0x1e08800, 0xc000cc48b0)
    /app/pkg/controller/kubefedcluster/controller.go:139 +0x45
k8s.io/client-go/tools/cache.ResourceEventHandlerFuncs.OnAdd(...)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:231
k8s.io/client-go/tools/cache.newInformer.func1(0x1bf3cc0, 0xc0005d8d50, 0x1, 0xc0005d8d50)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:407 +0x198
k8s.io/client-go/tools/cache.(*DeltaFIFO).Pop(0xc0004cee60, 0xc0006d1110, 0x0, 0x0, 0x0, 0x0)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/delta_fifo.go:544 +0x322
k8s.io/client-go/tools/cache.(*controller).processLoop(0xc000a5c7e0)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:183 +0x42
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1(0xc000c0ff90)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:155 +0x5f
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0xc000e3df90, 0x20998e0, 0xc000b0f9b0, 0xc0007b2e01, 0xc00093d560)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:156 +0x9b
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc000c0ff90, 0x3b9aca00, 0x0, 0xc000416501, 0xc00093d560)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:133 +0x98
k8s.io/apimachinery/pkg/util/wait.Until(...)
    /go/pkg/mod/k8s.io/apimachinery@v0.21.2/pkg/util/wait/wait.go:90
k8s.io/client-go/tools/cache.(*controller).Run(0xc000a5c7e0, 0xc00093d560)
    /go/pkg/mod/k8s.io/client-go@v0.21.2/tools/cache/controller.go:154 +0x2e5
created by sigs.k8s.io/kubefed/pkg/controller/kubefedcluster.(*ClusterController).Run
    /app/pkg/controller/kubefedcluster/controller.go:197 +0x88