s3sync-service
s3sync-service copied to clipboard
Passing configmap with wrong configuration causes nil pointer exception
Describe the bug I was playing with the service with configuration copied from examples, trying to mount configmap as file. I got an error that confused me, and it took me a shameful amount of time to figure out, that I should simply pass the flag "config" instead of "configmap".
To Reproduce
Running the service in K8s with the flag -configmap
without proper preparation causes exceptions which is hard to understand.
Expected behaviour
- No exception
- Understandable error log if configmap is unreachable
Screenshots
time="2022-10-27T16:25:41Z" level=error msg="an empty namespace may not be set when a resource name is provided" app=s3sync-service version=0.3.12
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x15f99d5]
goroutine 1 [running]:
github.com/mazay/s3sync-service/service.(*Config).setDefaults(...)
/go/src/github.com/mazay/s3sync-service/service/config.go:63
github.com/mazay/s3sync-service/service.readConfigString({0x0?, 0xc000442300?})
/go/src/github.com/mazay/s3sync-service/service/config.go:175 +0x55
github.com/mazay/s3sync-service/service.getConfig()
/go/src/github.com/mazay/s3sync-service/service/config.go:140 +0x4d
github.com/mazay/s3sync-service/service.Start()
/go/src/github.com/mazay/s3sync-service/service/main.go:126 +0x34a
main.main()
/go/src/github.com/mazay/s3sync-service/main.go:24 +0x17
Environment (please complete the following information):
- OS: [Docker in K8s, quay image]
- Version [e.g. 0.3.12]