dbsystel/alertmanager-config-controller

cannot load receiver or route configmaps

Closed this issue · 1 comments

jpke commented

I'm able to setup alertmanager via the helm chart, and create the configmap-examples/alertmanager-config.yaml, and see it update in the alertmanger gui.

However, when I try to apply the other configmap-examples, the configmap-controller crashes. For example, applying alertmanager-receiver.yaml resulted in the following error log:

▶ kc logs alertmanager-668458849d-d4zxv  alertmanager-config-controller
{"caller":"main.go:78","level":"info","msg":"Starting Alertmanager Controller...","ts":"2019-06-27T15:01:36.567724594Z"}
{"caller":"controller.go:327","level":"info","msg":"Creating receiver: test_receiver.yaml","name":"receiver-one","namespace":"monitoring","ts":"2019-06-27T15:01:36.626203843Z"}
{"caller":"controller.go:563","err":"yaml: line 20: mapping values are not allowed in this context","level":"error","ts":"2019-06-27T15:01:36.626596804Z"}
{"caller":"controller.go:350","err":"yaml: line 2: mapping values are not allowed in this context","level":"error","msg":"Format error in route string: - name: default\n      webhook_configs:\n      - send_resolved: true\n        url: http://localhost\n- name: test1\n  webhook_configs:\n  - send_resolved: true\n    url: http://localhost\n- name: test2\n      webhook_configs:\n      - send_resolved: true\n        url: http://localhost\n- name: test3\n      webhook_configs:\n      - send_resolved: true\n        url: http://localhost","ts":"2019-06-27T15:01:36.626649226Z"}
E0627 15:01:36.626797       1 runtime.go:69] Observed a panic: "assignment to entry in nil map" (assignment to entry in nil map)
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/runtime/runtime.go:76
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/runtime/runtime.go:65
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/runtime/runtime.go:51
/home/travis/.gimme/versions/go1.12.6.linux.amd64/src/runtime/panic.go:522
/home/travis/.gimme/versions/go1.12.6.linux.amd64/src/runtime/map_faststr.go:204
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/controller/controller.go:354
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/controller/controller.go:379
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/controller/controller.go:89
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/controller.go:195
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/shared_informer.go:554
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:265
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/shared_informer.go:548
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:152
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:153
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:88
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/shared_informer.go:546
/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:71
/home/travis/.gimme/versions/go1.12.6.linux.amd64/src/runtime/asm_amd64.s:1337
panic: assignment to entry in nil map [recovered]
	panic: assignment to entry in nil map

goroutine 8 [running]:
k8s.io/apimachinery/pkg/util/runtime.HandleCrash(0x0, 0x0, 0x0)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/runtime/runtime.go:58 +0x105
panic(0x11cdde0, 0x14bff40)
	/home/travis/.gimme/versions/go1.12.6.linux.amd64/src/runtime/panic.go:522 +0x1b5
github.com/dbsystel/alertmanager-config-controller/controller.(*Controller).addContinueIfNotExist(0xc000357030, 0xc000250000, 0x171, 0x131da84, 0x1)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/controller/controller.go:354 +0x19e
github.com/dbsystel/alertmanager-config-controller/controller.(*Controller).createBackfile(0xc000357030, 0xc0004e1c90, 0x13228ae, 0x8)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/controller/controller.go:379 +0x276
github.com/dbsystel/alertmanager-config-controller/controller.(*Controller).Create(0xc000357030, 0x1304b40, 0xc0004e1c90)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/controller/controller.go:89 +0x5ab
k8s.io/client-go/tools/cache.ResourceEventHandlerFuncs.OnAdd(...)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/controller.go:195
k8s.io/client-go/tools/cache.(*processorListener).run.func1.1(0xc00026b980, 0xc00009e4b0, 0x0)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/shared_informer.go:554 +0x26d
k8s.io/apimachinery/pkg/util/wait.ExponentialBackoff(0x989680, 0x3ff0000000000000, 0x3fb999999999999a, 0x5, 0x0, 0xc0003abe38, 0x42b47f, 0xc00009e4e0)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:265 +0x51
k8s.io/client-go/tools/cache.(*processorListener).run.func1()
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/shared_informer.go:548 +0x79
k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1(0xc00005bf68)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:152 +0x54
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0xc0003abf68, 0xdf8475800, 0x0, 0x42bd01, 0xc00008a180)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:153 +0xf8
k8s.io/apimachinery/pkg/util/wait.Until(...)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:88
k8s.io/client-go/tools/cache.(*processorListener).run(0xc000363800)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/client-go@v11.0.0+incompatible/tools/cache/shared_informer.go:546 +0x9c
k8s.io/apimachinery/pkg/util/wait.(*Group).Start.func1(0xc000357100, 0xc000049080)
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:71 +0x4f
created by k8s.io/apimachinery/pkg/util/wait.(*Group).Start
	/home/travis/gopath/src/github.com/dbsystel/alertmanager-config-controller/vendor/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190313205120-d7deff9243b1/pkg/util/wait/wait.go:69 +0x62

Version info:

▶ kc version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-26T00:04:52Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.6-eks-d69f1b", GitCommit:"d69f1bf3669bf00b7f4a758e978e0e7a1e3a68f7", GitTreeState:"clean", BuildDate:"2019-02-28T20:26:10Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
NAME                        	REVISION	UPDATED                 	STATUS  	CHART                             	APP VERSION                 	NAMESPACE
alertmanager                	1       	Thu Jun 27 10:55:59 2019	DEPLOYED	alertmanager-0.1.0                	0.16.1

Hi @jpke , thank you for reporting. Should be fixed now (release 0.2.4).