kubernetes / apiserver

Library for writing a Kubernetes-style API server.
Apache License 2.0
654 stars 406 forks source link

Panic if RecommendedOptions.CoreAPI is nil #111

Closed 0x5457 closed 2 months ago

0x5457 commented 2 months ago

I set the following configuration:

o.RecommendedOptions.CoreAPI = nil

Based on this https://github.com/kubernetes/apiserver/blob/fb0703a685b00618d25dfa36b1f76713e6140c4f/pkg/server/options/feature.go#L74-L76 I expected to receive the following error:

Error: invalid configuration: priority and fairness requires a core Kubernetes client

However, instead, I encountered the following panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102735a38]
goroutine 4293 [running]:
k8s.io/client-go/kubernetes.(*Clientset).FlowcontrolV1(0x0)
  /path/to/kubernetes/staging/src/k8s.io/client-go/kubernetes/clientset.go:350 +0x18
k8s.io/apiserver/pkg/server/options.(*FeatureOptions).ApplyTo(0x140004b04e0, 0x14007fd3408, {0x1050dc9b0, 0x0}, {0x0, 0x0})
  /path/to/kubernetes/staging/src/k8s.io/apiserver/pkg/server/options/feature.go:83 +0x22c
k8s.io/apiserver/pkg/server/options.(*RecommendedOptions).ApplyTo(0x14001c107e0, 0x14007fd3408)
  /path/to/kubernetes/staging/src/k8s.io/apiserver/pkg/server/options/recommended.go:136 +0x424