FairwindsOps / polaris

Validation of best practices in your Kubernetes clusters

Home Page:https://www.fairwinds.com/polaris

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

admission controller unhandled panic

sudermanjr opened this issue · comments

What happened?

time="2022-09-13T21:42:16Z" level=info msg="Injecting decoder"
time="2022-09-13T21:42:16Z" level=info msg="Injecting decoder"
time="2022-09-13T21:42:16Z" level=info msg="Polaris webhook server listening on port 9876"
time="2022-09-13T21:42:33Z" level=info msg="Starting request"
2022/09/13 21:42:33 http: panic serving 10.244.0.1:2695: runtime error: invalid memory address or nil pointer dereference
goroutine 108 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1802 +0xb9
panic({0x176fa40, 0x29ca220})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Decoder).DecodeRaw(0xc00054d000, {{0xc0000bd300, 0x11fe, 0x1300}, {0x0, 0x0}}, {0x1cb1d50, 0xc00054d000})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/decode.go:70 +0xdb
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Decoder).Decode(_, {{{0xc0005b0210, 0x24}, {{0x0, 0x0}, {0xc00046d510, 0x2}, {0xc00046d512, 0x3}}, {{0x0, ...}, ...}, ...}}, ...)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/decode.go:47 +0x8e
github.com/fairwindsops/polaris/pkg/webhook.GetValidatedResults({_, _}, _, {{{0xc0005b0210, 0x24}, {{0x0, 0x0}, {0xc00046d510, 0x2}, {0xc00046d512, ...}}, ...}}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:67 +0xd0
github.com/fairwindsops/polaris/pkg/webhook.(*Mutator).mutate(_, {{{0xc0005b0210, 0x24}, {{0x0, 0x0}, {0xc00046d510, 0x2}, {0xc00046d512, 0x3}}, {{0x0, ...}, ...}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/mutate.go:47 +0xd8
github.com/fairwindsops/polaris/pkg/webhook.(*Mutator).Handle(_, {_, _}, {{{0xc0005b0210, 0x24}, {{0x0, 0x0}, {0xc00046d510, 0x2}, {0xc00046d512, ...}}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/mutate.go:58 +0xe5
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc0005b0210, 0x24}, {{0x0, 0x0}, {0xc00046d510, 0x2}, {0xc00046d512, ...}}, ...}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0008e5140, {0x7f822afee8b8, 0xc0005a6460}, 0xc0005a8400)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/http.go:98 +0xef6
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f822afee8b8, 0xc0005a6460}, 0xc0005a6460)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1cc1510, {0x7f822afee8b8, 0xc0005a6460}, 0xc00058fa60)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1cc1510, 0xc0002480e0}, 0xc0005a8400)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117 +0xa8
net/http.HandlerFunc.ServeHTTP(0x1, {0x1cc1510, 0xc0002480e0}, 0x29f10a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1cc1510, 0xc0002480e0}, 0xc0005a8400)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84 +0xbf
net/http.HandlerFunc.ServeHTTP(0xc0c05c327069e39c, {0x1cc1510, 0xc0002480e0}, 0xc0002480e0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0005b018d, {0x1cc1510, 0xc0002480e0}, 0xc0005a8400)
	/usr/local/go/src/net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0x1cb41e0}, {0x1cc1510, 0xc0002480e0}, 0xc0005a8400)
	/usr/local/go/src/net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc00024d900, {0x1cc69f8, 0xc0008fa420})
	/usr/local/go/src/net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3034 +0x4e8
time="2022-09-13T21:42:33Z" level=info msg="Starting request"
time="2022-09-13T21:42:33Z" level=info msg="Allowing owned pod polaris/polaris-dashboard-f676bb447-jvqz6 to pass through webhook"
time="2022-09-13T21:42:34Z" level=info msg="Starting request"
2022/09/13 21:42:34 http: panic serving 10.244.0.1:56873: runtime error: invalid memory address or nil pointer dereference
goroutine 232 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1802 +0xb9
panic({0x176fa40, 0x29ca220})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
github.com/fairwindsops/polaris/pkg/validator.applySchemaCheck(0xc0009ae8f8, {0xc00054b280, 0x1a}, {{0x1987319, 0xa}, {{0xc0001a4f70, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc000804bd0}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:356 +0xa90
github.com/fairwindsops/polaris/pkg/validator.applySchemaChecks(0xc0009ae8f8, {{0x1987319, 0xa}, {{0xc0001a4f70, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc000804bd0}, 0xc000626600, {0x17542e0, ...}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:294 +0xe5
github.com/fairwindsops/polaris/pkg/validator.applyTopLevelSchemaChecks(0x1d11af0, 0x1965380, {{0xc0001a4f70, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc000804bd0}, 0xc000626600, {0x17542e0, 0xc0000d9770}, ...}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:267 +0xd8
github.com/fairwindsops/polaris/pkg/validator.applyControllerSchemaChecks(0xc000361620, 0xc0001a8808, {{0xc0001a4f70, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc000804bd0}, 0xc000626600, {0x17542e0, 0xc0000d9770}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:206 +0x199
github.com/fairwindsops/polaris/pkg/validator.ApplyAllSchemaChecks(0xc0000b5ee8, 0xc0001ac5d0, {{0xc0001a4f70, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc000804bd0}, 0xc000626600, {0x17542e0, 0xc0000d9770}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:186 +0xc5
github.com/fairwindsops/polaris/pkg/webhook.GetValidatedResults({_, _}, _, {{{0xc000536270, 0x24}, {{0xc0001a4bb0, 0x4}, {0xc0001a4bb4, 0x2}, {0xc0001a4bb6, ...}}, ...}}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:83 +0x405
github.com/fairwindsops/polaris/pkg/webhook.(*Mutator).mutate(_, {{{0xc000536270, 0x24}, {{0xc0001a4bb0, 0x4}, {0xc0001a4bb4, 0x2}, {0xc0001a4bb6, 0xa}}, {{0xc0001a4be0, ...}, ...}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/mutate.go:47 +0xd8
github.com/fairwindsops/polaris/pkg/webhook.(*Mutator).Handle(_, {_, _}, {{{0xc000536270, 0x24}, {{0xc0001a4bb0, 0x4}, {0xc0001a4bb4, 0x2}, {0xc0001a4bb6, ...}}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/mutate.go:58 +0xe5
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc000536270, 0x24}, {{0xc0001a4bb0, 0x4}, {0xc0001a4bb4, 0x2}, {0xc0001a4bb6, ...}}, ...}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0008e5140, {0x7f822afee8b8, 0xc000362320}, 0xc000528100)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/http.go:98 +0xef6
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f822afee8b8, 0xc000362320}, 0xc000362320)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1cc1510, {0x7f822afee8b8, 0xc000362320}, 0xc0004efa60)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1cc1510, 0xc00093a000}, 0xc000528100)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117 +0xa8
net/http.HandlerFunc.ServeHTTP(0x1, {0x1cc1510, 0xc00093a000}, 0x29f10a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1cc1510, 0xc00093a000}, 0xc000528100)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84 +0xbf
net/http.HandlerFunc.ServeHTTP(0xc0c05c329b4bf684, {0x1cc1510, 0xc00093a000}, 0xc00093a000)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0005361ed, {0x1cc1510, 0xc00093a000}, 0xc000528100)
	/usr/local/go/src/net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0x1cb41e0}, {0x1cc1510, 0xc00093a000}, 0xc000528100)
	/usr/local/go/src/net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc000460000, {0x1cc69f8, 0xc0008fa420})
	/usr/local/go/src/net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3034 +0x4e8
time="2022-09-13T21:42:34Z" level=info msg="Starting request"
2022/09/13 21:42:34 http: panic serving 10.244.0.1:21359: runtime error: invalid memory address or nil pointer dereference
goroutine 110 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1802 +0xb9
panic({0x176fa40, 0x29ca220})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
github.com/fairwindsops/polaris/pkg/validator.applySchemaCheck(0xc0007708f8, {0xc00054b280, 0x1a}, {{0x1987319, 0xa}, {{0xc0007965a0, 0xa}, {0x7f822af1bf58, 0xc0001a8820}, {0xc0007946c0}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:356 +0xa90
github.com/fairwindsops/polaris/pkg/validator.applySchemaChecks(0xc0007708f8, {{0x1987319, 0xa}, {{0xc0007965a0, 0xa}, {0x7f822af1bf58, 0xc0001a8820}, {0xc0007946c0}, 0xc000626200, {0x17542e0, ...}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:294 +0xe5
github.com/fairwindsops/polaris/pkg/validator.applyTopLevelSchemaChecks(0x1d11af0, 0x1965380, {{0xc0007965a0, 0xa}, {0x7f822af1bf58, 0xc0001a8820}, {0xc0007946c0}, 0xc000626200, {0x17542e0, 0xc0008fa0f0}, ...}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:267 +0xd8
github.com/fairwindsops/polaris/pkg/validator.applyControllerSchemaChecks(0xc000302ba0, 0xc0001a8820, {{0xc0007965a0, 0xa}, {0x7f822af1bf58, 0xc0001a8820}, {0xc0007946c0}, 0xc000626200, {0x17542e0, 0xc0008fa0f0}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:206 +0x199
github.com/fairwindsops/polaris/pkg/validator.ApplyAllSchemaChecks(0x13, 0x11, {{0xc0007965a0, 0xa}, {0x7f822af1bf58, 0xc0001a8820}, {0xc0007946c0}, 0xc000626200, {0x17542e0, 0xc0008fa0f0}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:186 +0xc5
github.com/fairwindsops/polaris/pkg/webhook.GetValidatedResults({_, _}, _, {{{0xc000536060, 0x24}, {{0xc000796070, 0x4}, {0xc000796074, 0x2}, {0xc000796076, ...}}, ...}}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:83 +0x405
github.com/fairwindsops/polaris/pkg/webhook.(*Validator).handleInternal(...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:58
github.com/fairwindsops/polaris/pkg/webhook.(*Validator).Handle(_, {_, _}, {{{0xc000536060, 0x24}, {{0xc000796070, 0x4}, {0xc000796074, 0x2}, {0xc000796076, ...}}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:93 +0x198
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc000536060, 0x24}, {{0xc000796070, 0x4}, {0xc000796074, 0x2}, {0xc000796076, ...}}, ...}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0008e4d00, {0x7f822afee8b8, 0xc0008ec500}, 0xc000528000)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/http.go:98 +0xef6
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f822afee8b8, 0xc0008ec500}, 0xc0008ec500)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1cc1510, {0x7f822afee8b8, 0xc0008ec500}, 0xc0007b3a60)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1cc1510, 0xc00093a2a0}, 0xc000528000)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117 +0xa8
net/http.HandlerFunc.ServeHTTP(0x1, {0x1cc1510, 0xc00093a2a0}, 0x29f10a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1cc1510, 0xc00093a2a0}, 0xc000528000)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84 +0xbf
net/http.HandlerFunc.ServeHTTP(0xc0c05c329f3cc0e8, {0x1cc1510, 0xc00093a2a0}, 0xc00093a2a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc00053600f, {0x1cc1510, 0xc00093a2a0}, 0xc000528000)
	/usr/local/go/src/net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0x1cb41e0}, {0x1cc1510, 0xc00093a2a0}, 0xc000528000)
	/usr/local/go/src/net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc00024dc20, {0x1cc69f8, 0xc0008fa420})
	/usr/local/go/src/net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3034 +0x4e8
time="2022-09-13T21:42:44Z" level=info msg="Starting request"
2022/09/13 21:42:44 http: panic serving 10.244.0.1:17173: runtime error: invalid memory address or nil pointer dereference
goroutine 178 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1802 +0xb9
panic({0x176fa40, 0x29ca220})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
github.com/fairwindsops/polaris/pkg/validator.applySchemaCheck(0xc0007ba8f8, {0xc00054b280, 0x1a}, {{0x1987319, 0xa}, {{0xc00068fba0, 0xa}, {0x7f822af1bf58, 0xc0003667c0}, {0xc0002268d0}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:356 +0xa90
github.com/fairwindsops/polaris/pkg/validator.applySchemaChecks(0xc0007ba8f8, {{0x1987319, 0xa}, {{0xc00068fba0, 0xa}, {0x7f822af1bf58, 0xc0003667c0}, {0xc0002268d0}, 0xc0003b6400, {0x17542e0, ...}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:294 +0xe5
github.com/fairwindsops/polaris/pkg/validator.applyTopLevelSchemaChecks(0x1d11af0, 0x1965380, {{0xc00068fba0, 0xa}, {0x7f822af1bf58, 0xc0003667c0}, {0xc0002268d0}, 0xc0003b6400, {0x17542e0, 0xc00018fe90}, ...}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:267 +0xd8
github.com/fairwindsops/polaris/pkg/validator.applyControllerSchemaChecks(0xc0004b71a0, 0xc0003667c0, {{0xc00068fba0, 0xa}, {0x7f822af1bf58, 0xc0003667c0}, {0xc0002268d0}, 0xc0003b6400, {0x17542e0, 0xc00018fe90}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:206 +0x199
github.com/fairwindsops/polaris/pkg/validator.ApplyAllSchemaChecks(0xc0005a1ee8, 0xc0008e4310, {{0xc00068fba0, 0xa}, {0x7f822af1bf58, 0xc0003667c0}, {0xc0002268d0}, 0xc0003b6400, {0x17542e0, 0xc00018fe90}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:186 +0xc5
github.com/fairwindsops/polaris/pkg/webhook.GetValidatedResults({_, _}, _, {{{0xc0008f2240, 0x24}, {{0xc00068fad0, 0x4}, {0xc00068fad4, 0x2}, {0xc00068fad6, ...}}, ...}}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:83 +0x405
github.com/fairwindsops/polaris/pkg/webhook.(*Mutator).mutate(_, {{{0xc0008f2240, 0x24}, {{0xc00068fad0, 0x4}, {0xc00068fad4, 0x2}, {0xc00068fad6, 0xa}}, {{0xc00068fae0, ...}, ...}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/mutate.go:47 +0xd8
github.com/fairwindsops/polaris/pkg/webhook.(*Mutator).Handle(_, {_, _}, {{{0xc0008f2240, 0x24}, {{0xc00068fad0, 0x4}, {0xc00068fad4, 0x2}, {0xc00068fad6, ...}}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/mutate.go:58 +0xe5
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc0008f2240, 0x24}, {{0xc00068fad0, 0x4}, {0xc00068fad4, 0x2}, {0xc00068fad6, ...}}, ...}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0008e5140, {0x7f822afee8b8, 0xc0005a6000}, 0xc00047a200)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/http.go:98 +0xef6
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f822afee8b8, 0xc0005a6000}, 0xc0005a6000)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1cc1510, {0x7f822afee8b8, 0xc0005a6000}, 0xc000497a60)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1cc1510, 0xc00050a000}, 0xc00047a200)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117 +0xa8
net/http.HandlerFunc.ServeHTTP(0x1, {0x1cc1510, 0xc00050a000}, 0x29f10a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1cc1510, 0xc00050a000}, 0xc00047a200)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84 +0xbf
net/http.HandlerFunc.ServeHTTP(0xc0c05c3525f491a9, {0x1cc1510, 0xc00050a000}, 0xc00050a000)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0008f21ed, {0x1cc1510, 0xc00050a000}, 0xc00047a200)
	/usr/local/go/src/net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0x1cb41e0}, {0x1cc1510, 0xc00050a000}, 0xc00047a200)
	/usr/local/go/src/net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc00057c000, {0x1cc69f8, 0xc0008fa420})
	/usr/local/go/src/net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3034 +0x4e8
time="2022-09-13T21:42:44Z" level=info msg="Starting request"
2022/09/13 21:42:44 http: panic serving 10.244.0.1:19791: runtime error: invalid memory address or nil pointer dereference
goroutine 152 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1802 +0xb9
panic({0x176fa40, 0x29ca220})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
github.com/fairwindsops/polaris/pkg/validator.applySchemaCheck(0xc0005f68f8, {0xc00054b280, 0x1a}, {{0x1987319, 0xa}, {{0xc00041c6f0, 0xa}, {0x7f822af1bf58, 0xc0001a91d0}, {0xc0000d8b70}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:356 +0xa90
github.com/fairwindsops/polaris/pkg/validator.applySchemaChecks(0xc0005f68f8, {{0x1987319, 0xa}, {{0xc00041c6f0, 0xa}, {0x7f822af1bf58, 0xc0001a91d0}, {0xc0000d8b70}, 0xc0003b6200, {0x17542e0, ...}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:294 +0xe5
github.com/fairwindsops/polaris/pkg/validator.applyTopLevelSchemaChecks(0x1d11af0, 0x1965380, {{0xc00041c6f0, 0xa}, {0x7f822af1bf58, 0xc0001a91d0}, {0xc0000d8b70}, 0xc0003b6200, {0x17542e0, 0xc000881440}, ...}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:267 +0xd8
github.com/fairwindsops/polaris/pkg/validator.applyControllerSchemaChecks(0xc0008f0f00, 0xc0001a91d0, {{0xc00041c6f0, 0xa}, {0x7f822af1bf58, 0xc0001a91d0}, {0xc0000d8b70}, 0xc0003b6200, {0x17542e0, 0xc000881440}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:206 +0x199
github.com/fairwindsops/polaris/pkg/validator.ApplyAllSchemaChecks(0x13, 0x11, {{0xc00041c6f0, 0xa}, {0x7f822af1bf58, 0xc0001a91d0}, {0xc0000d8b70}, 0xc0003b6200, {0x17542e0, 0xc000881440}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:186 +0xc5
github.com/fairwindsops/polaris/pkg/webhook.GetValidatedResults({_, _}, _, {{{0xc000536e70, 0x24}, {{0xc00041c600, 0x4}, {0xc00041c604, 0x2}, {0xc00041c606, ...}}, ...}}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:83 +0x405
github.com/fairwindsops/polaris/pkg/webhook.(*Validator).handleInternal(...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:58
github.com/fairwindsops/polaris/pkg/webhook.(*Validator).Handle(_, {_, _}, {{{0xc000536e70, 0x24}, {{0xc00041c600, 0x4}, {0xc00041c604, 0x2}, {0xc00041c606, ...}}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:93 +0x198
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc000536e70, 0x24}, {{0xc00041c600, 0x4}, {0xc00041c604, 0x2}, {0xc00041c606, ...}}, ...}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0008e4d00, {0x7f822afee8b8, 0xc0008ed310}, 0xc000529000)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/http.go:98 +0xef6
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f822afee8b8, 0xc0008ed310}, 0xc0008ed310)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1cc1510, {0x7f822afee8b8, 0xc0008ed310}, 0xc0004f3a60)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1cc1510, 0xc00093a7e0}, 0xc000529000)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117 +0xa8
net/http.HandlerFunc.ServeHTTP(0x1, {0x1cc1510, 0xc00093a7e0}, 0x29f10a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1cc1510, 0xc00093a7e0}, 0xc000529000)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84 +0xbf
net/http.HandlerFunc.ServeHTTP(0xc0c05c352689c534, {0x1cc1510, 0xc00093a7e0}, 0xc00093a7e0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc000536e1f, {0x1cc1510, 0xc00093a7e0}, 0xc000529000)
	/usr/local/go/src/net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0x1cb41e0}, {0x1cc1510, 0xc00093a7e0}, 0xc000529000)
	/usr/local/go/src/net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc00075b7c0, {0x1cc69f8, 0xc0008fa420})
	/usr/local/go/src/net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3034 +0x4e8
time="2022-09-13T21:43:40Z" level=info msg="Starting request"
2022/09/13 21:43:40 http: panic serving 10.244.0.1:63390: runtime error: invalid memory address or nil pointer dereference
goroutine 241 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1802 +0xb9
panic({0x176fa40, 0x29ca220})
	/usr/local/go/src/runtime/panic.go:1047 +0x266
github.com/fairwindsops/polaris/pkg/validator.applySchemaCheck(0xc0005f68f8, {0xc00054b280, 0x1a}, {{0x1987319, 0xa}, {{0xc0002479a0, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc0008e80c0}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:356 +0xa90
github.com/fairwindsops/polaris/pkg/validator.applySchemaChecks(0xc0005f68f8, {{0x1987319, 0xa}, {{0xc0002479a0, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc0008e80c0}, 0xc000626600, {0x17542e0, ...}, ...}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:294 +0xe5
github.com/fairwindsops/polaris/pkg/validator.applyTopLevelSchemaChecks(0x1d11af0, 0x1965380, {{0xc0002479a0, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc0008e80c0}, 0xc000626600, {0x17542e0, 0xc000572a80}, ...}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:267 +0xd8
github.com/fairwindsops/polaris/pkg/validator.applyControllerSchemaChecks(0xc00035f320, 0xc0001a8808, {{0xc0002479a0, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc0008e80c0}, 0xc000626600, {0x17542e0, 0xc000572a80}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:206 +0x199
github.com/fairwindsops/polaris/pkg/validator.ApplyAllSchemaChecks(0x13, 0x11, {{0xc0002479a0, 0xa}, {0x7f822af1bf58, 0xc0001a8808}, {0xc0008e80c0}, 0xc000626600, {0x17542e0, 0xc000572a80}, ...})
	/go/src/github.com/fairwindsops/polaris/pkg/validator/schema.go:186 +0xc5
github.com/fairwindsops/polaris/pkg/webhook.GetValidatedResults({_, _}, _, {{{0xc000536270, 0x24}, {{0xc0002478c0, 0x4}, {0xc0002478c4, 0x2}, {0xc0002478c6, ...}}, ...}}, ...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:83 +0x405
github.com/fairwindsops/polaris/pkg/webhook.(*Validator).handleInternal(...)
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:58
github.com/fairwindsops/polaris/pkg/webhook.(*Validator).Handle(_, {_, _}, {{{0xc000536270, 0x24}, {{0xc0002478c0, 0x4}, {0xc0002478c4, 0x2}, {0xc0002478c6, ...}}, ...}})
	/go/src/github.com/fairwindsops/polaris/pkg/webhook/webhook.go:93 +0x198
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).Handle(_, {_, _}, {{{0xc000536270, 0x24}, {{0xc0002478c0, 0x4}, {0xc0002478c4, 0x2}, {0xc0002478c6, ...}}, ...}})
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/webhook.go:146 +0xa2
sigs.k8s.io/controller-runtime/pkg/webhook/admission.(*Webhook).ServeHTTP(0xc0008e4d00, {0x7f822afee8b8, 0xc0005a6050}, 0xc0001f4400)
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.12.3/pkg/webhook/admission/http.go:98 +0xef6
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerInFlight.func1({0x7f822afee8b8, 0xc0005a6050}, 0xc0005a6050)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:40 +0xd4
net/http.HandlerFunc.ServeHTTP(0x1cc1510, {0x7f822afee8b8, 0xc0005a6050}, 0xc000497a60)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x1cc1510, 0xc00093a000}, 0xc0001f4400)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:117 +0xa8
net/http.HandlerFunc.ServeHTTP(0x1, {0x1cc1510, 0xc00093a000}, 0x29f10a0)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerDuration.func2({0x1cc1510, 0xc00093a000}, 0xc0001f4400)
	/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/promhttp/instrument_server.go:84 +0xbf
net/http.HandlerFunc.ServeHTTP(0xc0c05c432bcf98a3, {0x1cc1510, 0xc00093a000}, 0xc00093a000)
	/usr/local/go/src/net/http/server.go:2047 +0x2f
net/http.(*ServeMux).ServeHTTP(0xc0005361ef, {0x1cc1510, 0xc00093a000}, 0xc0001f4400)
	/usr/local/go/src/net/http/server.go:2425 +0x149
net/http.serverHandler.ServeHTTP({0x1cb41e0}, {0x1cc1510, 0xc00093a000}, 0xc0001f4400)
	/usr/local/go/src/net/http/server.go:2879 +0x43b
net/http.(*conn).serve(0xc00024c1e0, {0x1cc69f8, 0xc0008fa420})
	/usr/local/go/src/net/http/server.go:1930 +0xb08
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3034 +0x4e8

What did you expect to happen?

No panics in logs

How can we reproduce this?

Install polaris with the admission webhook. Use this values file:

config:
  checks:
    tagNotSpecified: danger
    livenessProbeMissing: danger
    imageRegistry: danger
    privilegeEscalationAllowed: warning
    runAsRootAllowed: warning
    insecureCapabilities: warning
    missingPodDisruptionBudget: danger
    teamLabel: danger
  customChecks:
    teamLabel:
      successMessage: Label app.kubernetes.io/name matches metadata.name
      failureMessage: Label app.kubernetes.io/name must match metadata.name
      target: Controller
      schema:
        '$schema': http://json-schema.org/draft-07/schema
        type: object
        properties:
          metadata:
            type: object
            required: ["labels"]
            properties:
              labels:
                type: object
                required: ["team"]
                properties:
                  team:
                    type: string
    imageRegistry:
      successMessage: Image comes from allowed registries
      failureMessage: Image should not be from disallowed registry
      category: Security
      target: Container
      schema:
        '$schema': http://json-schema.org/draft-07/schema
        type: object
        properties:
          image:
            type: string
            anyOf:
              - type: string
                pattern: ^us-docker.pkg.dev
              - pattern: ^docker.io/kindest
                type: string
              - pattern: ^k8s.gcr.io
                type: string
              - pattern: ^quay.io/fairwinds
                type: string
  mutations:
    - pullPolicyNotAlways
webhook:
  enable: true
  enableMutation: true
  mutate: true
  failurePolicy: Ignore
  namespaceSelector:
    matchExpressions:
    - key: control-plane
      operator: DoesNotExist
  rules: []
  # webhook.mutatingRules -- An array of additional rules for the MutatingWebhookConfiguration. Each requires a set of apiGroups, apiVersions, operations, resources, and a scope.
  mutatingRules: []
  # webhook.defaultRules -- An array of rules for common types for the ValidatingWebhookConfiguration
  defaultRules:
  - apiGroups:
    - apps
    apiVersions:
    - v1
    - v1beta1
    - v1beta2
    operations:
    - CREATE
    - UPDATE
    resources:
    - daemonsets
    - deployments
    - statefulsets
    scope: Namespaced
  - apiGroups:
    - batch
    apiVersions:
    - v1
    - v1beta1
    operations:
    - CREATE
    - UPDATE
    resources:
    - jobs
    - cronjobs
    scope: Namespaced
  - apiGroups:
    - ""
    apiVersions:
    - v1
    operations:
    - CREATE
    - UPDATE
    resources:
    - pods
    - replicationcontrollers
    scope: Namespaced

Apply any object to the cluster.

Version

Chart: polaris-5.5.0 Polaris: 7.0

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response