Skip to content

Runtime error when deleting ResourceComposition when no instances are present #1196

@devdattakulkarni

Description

@devdattakulkarni

Encountered the following error when trying to delete resourcecomposition for which no application instances exist:

kubectl delete resourcecompositions wordpressservice-res-composition --kubeconfig=/home/vagrant/.kubeplus/org-test1/config
Error from server (InternalError): Internal error occurred: failed calling webhook "platform-as-code.crd-binding.v1": failed to call webhook: Post "https://crd-hook-service.default.svc:443/mutate?timeout=30s": EOF

Mutating webhook logs:
kubectl logs kubeplus-deployment-7586f8bbc-vrm82 -c crd-hook

=== User ===
Delete ResourceComposition
Namespace: default
Kind:WordpressService, Group:platformapi.kubeplus, Version:v1alpha1, Plural:wordpressservices
GVR: platformapi.kubeplus/v1alpha1, Resource=wordpressservices
Error:the server could not find the requested resource
...checking at cluster-scopeError:the server could not find the requested resource
2023/12/10 12:57:58 http: panic serving 10.244.0.1:48634: runtime error: invalid memory address or nil pointer dereference
goroutine 369801509 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1854 +0xbf
panic({0x1460dc0, 0x21f8e80})
/usr/local/go/src/runtime/panic.go:890 +0x263
main.handleDelete(0xc00056dd70)
/home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:412 +0xda4
main.(*WebhookServer).mutate(0x17ecc20?, 0xc00056dd70, {0xc00052b148, 0x6})
/home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:205 +0x3b4
main.(*WebhookServer).serve(0xc000023ae0?, {0x17fe5f0, 0xc0001322a0}, 0xc0004bb700)
/home/vagrant/go/src/github.com/cloud-ark/kubeplus/mutating-webhook/webhook.go:1686 +0x45d
net/http.HandlerFunc.ServeHTTP(0xc0001322a0?, {0x17fe5f0?, 0xc0001322a0?}, 0x15f8f9f?)
/usr/local/go/src/net/http/server.go:2122 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc000632d8d?, {0x17fe5f0, 0xc0001322a0}, 0xc0004bb700)
/usr/local/go/src/net/http/server.go:2500 +0x149
net/http.serverHandler.ServeHTTP({0x17f2220?}, {0x17fe5f0, 0xc0001322a0}, 0xc0004bb700)
/usr/local/go/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc000423200, {0x17fed28, 0xc0003673b0})
/usr/local/go/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3089 +0x5ed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions