Skip to content

The apiserver crash when I delete crd #58427

Closed
@carlory

Description

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened:

The apiserver crash when I delete crd.

What you expected to happen:

The apiserver should correctly valiate crd when I create a crd with validation field.

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

test.yaml

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: tests.example.com
spec:
  group: example.com
  names:
    kind: Test
    listKind: TestList
    plural: tests
  scope: Namespaced
  version: v1
  validation:
    openAPIV3Schema:
      type: "object"
      properties:
        spec:
          $ref: "#/definitions/zeta"
  1. create crd
kubectl create -f test.yaml
  1. delete crd
kubectl delete  -f test.yaml

Anything else we need to know?:

the logs of apiserver

I0118 03:26:56.117246       1 cache.go:32] Waiting for caches to sync for autoregister controller
E0118 03:26:56.120677       1 customresource_handler.go:283] object has no key "zeta"
E0118 03:26:56.120771       1 runtime.go:66] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:72
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:65
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:51
/usr/local/go/src/runtime/asm_amd64.s:509
/usr/local/go/src/runtime/panic.go:491
/usr/local/go/src/runtime/panic.go:63
/usr/local/go/src/runtime/signal_unix.go:367
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go:285
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:158
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:126
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:90
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:269
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:257
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:250
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88
/usr/local/go/src/runtime/asm_amd64.s:2337
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=0x10 pc=0x2a1bcc9]
goroutine 2235 [running]:
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:58 +0x111
panic(0x3339cc0, 0x8f2b500)
	/usr/local/go/src/runtime/panic.go:491 +0x283
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver.(*crdHandler).GetCustomResourceListerCollectionDeleter(0xc42028d100, 0xc4251a9680, 0xc4201228f0, 0xc42bc65978)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go:285 +0x49
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).deleteInstances(0xc42089d720, 0xc4251a9680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:158 +0x87
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).sync(0xc42089d720, 0xc424d244a0, 0x11, 0xc42b258de0, 0x0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:126 +0x2cb
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).(k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.sync)-fm(0xc424d244a0, 0x11, 0xc420a9a640, 0x30c6320)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:90 +0x3e
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).processNextWorkItem(0xc42089d720, 0x956200)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:269 +0xd4
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).runWorker(0xc42089d720)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:257 +0x2b
k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).(k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.runWorker)-fm()
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:250 +0x2a
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1(0xc42562adc0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133 +0x5e
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc42562adc0, 0x3b9aca00, 0x0, 0x1, 0xc420055500)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134 +0xbd
k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait.Until(0xc42562adc0, 0x3b9aca00, 0xc420055500)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88 +0x4d
created by k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer.(*CRDFinalizer).Run
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver/pkg/controller/finalizer/crd_finalizer.go:250 +0x193

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T11:52:23Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T11:40:06Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"linux/amd64"}
  • OS (e.g. from /etc/os-release):
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
  • Kernel (e.g. uname -a):
Linux 10-144-91-87 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Install tools:

kubeadm

Metadata

Assignees

No one assigned

    Labels

    area/custom-resourceskind/bugCategorizes issue or PR as related to a bug.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions