cloud-ark / kubeplus

Kubernetes Operator for multi-instance multi-tenancy
https://cloudark.io/
Apache License 2.0
662 stars 82 forks source link

Recovering deleted application Pods #1141

Closed devdattakulkarni closed 1 year ago

devdattakulkarni commented 1 year ago

In testing whether application Pods are re-created if deleted, we saw following error in KubePlus (crd-hook) container:

Inside checkServiceLevelPolicyApplicabilityNamespace:%s jens1 Namespace1:jens1 ownerKind:ReplicaSet ownerName:jenkinsservice-jens1-77474c9b76 ownerAPIVersion:apps/v1 Group:apps Version:v1 ResName:jenkinsservice-jens1-77474c9b76 Namespace:jens1 ownerResKindPlural:replicasets ownerResApiVersion:v1 ownerResGroup:apps OwnerRes:apps/v1, Resource=replicasets Group:apps Version:v1 ResName:jenkinsservice-jens1 Namespace:jens1 ownerResKindPlural:deployments ownerResApiVersion:v1 ownerResGroup:apps OwnerRes:apps/v1, Resource=deployments 2023/04/15 10:25:52 http: panic serving 172.17.0.1:2027: interface conversion: interface {} is nil, not v1.AdmissionReview goroutine 40421159 [running]: net/http.(conn).serve.func1() /usr/local/go/src/net/http/server.go:1825 +0xbf panic({0x13bb660, 0xc00059d3b0}) /usr/local/go/src/runtime/panic.go:844 +0x258 main.getFieldValueFromInstance({0xc000027f20?, 0xc00000e018?}, {0xc000331abe, 0xe}, {0xc000596b37, 0x5}) /home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:820 +0x35a main.applyPolicies(0xc000681650?, {0xc000681650, 0x2c}, {0xc000331abe, 0xe}, {0xc000596b37, 0x5}, {0x17398c0?, 0xc00039d5e0?}) /home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:792 +0xd49 main.(WebhookServer).mutate(0x173a140?, 0xc000630ea0, {0xc00056fb96, 0x6}) /home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:249 +0x93a main.(WebhookServer).serve(0x0?, {0x174b7f0, 0xc0001ba0e0}, 0xc00014f400) /home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:1602 +0x44f net/http.HandlerFunc.ServeHTTP(0x1348b20?, {0x174b7f0?, 0xc0001ba0e0?}, 0xc0003f08e0?) /usr/local/go/src/net/http/server.go:2084 +0x2f net/http.(ServeMux).ServeHTTP(0xc00068066d?, {0x174b7f0, 0xc0001ba0e0}, 0xc00014f400) /usr/local/go/src/net/http/server.go:2462 +0x149 net/http.serverHandler.ServeHTTP({0x173f6c0?}, {0x174b7f0, 0xc0001ba0e0}, 0xc00014f400) /usr/local/go/src/net/http/server.go:2916 +0x43b net/http.(conn).serve(0xc0000ca280, {0x174bf58, 0xc00009c570}) /usr/local/go/src/net/http/server.go:1966 +0x5d7 created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:3071 +0x4db Intermediate Root kind:Deployment Intermediate Root name:jenkinsservice-jens1 Intermediate Root APIVersion:apps/v1 KindPluralMap2:map[jenkinsservice:jenkinsservices] OPlural:jenkinsservices OInstance:jens1 CustomAPI:platformapi.kubeplus/v1alpha1/JenkinsService capiGroup:platformapi.kubeplus capiVersion:v1alpha1 capiKind:JenkinsService