Version
v2.1.0
What happened?
Thanks for this project. It looks like it meets my use case exactly. However, when I first tried to use this on my minikube setup, I hit a panic. I'm on a slightly older version of Kubernetes. Not sure if the issue is related to that:
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.14", GitCommit:"0f77da5bd4809927e15d1658fb4aa8f13ad890a5", GitTreeState:"clean", BuildDate:"2022-06-15T14:11:36Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
Relevant log output
{"level":"debug","routine":"suspender","namespace":"cogito","step":"3/3 - handle desiredState","resource":"statefulsets","time":"2022-12-14T17:26:00+01:00","message":"checking suspended Conformity"}
{"level":"info","routine":"suspender","namespace":"cogito","statefulset":"keycloak","time":"2022-12-14T17:26:00+01:00","message":"scaling keycloak from 1 to 0 replicas"}
{"level":"info","routine":"suspender","namespace":"cogito","deployment":"compute-manager","time":"2022-12-14T17:26:00+01:00","message":"scaling compute-manager from 1 to 0 replicas"}
E1214 17:26:00.378244 1 runtime.go:78] Observed a panic: "assignment to entry in nil map" (assignment to entry in nil map)
goroutine 61 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic({0x13287a0, 0x1661690})
/go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:74 +0x85
k8s.io/apimachinery/pkg/util/runtime.HandleCrash({0x0, 0x0, 0xc0001c0000})
/go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:48 +0x75
panic({0x13287a0, 0x1661690})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/govirtuo/kube-ns-suspender/engine.patchStatefulsetReplicas.func1()
/build/engine/statefulset.go:61 +0x186
k8s.io/client-go/util/retry.OnError.func1()
/go/pkg/mod/k8s.io/[email protected]/util/retry/util.go:51 +0x33
k8s.io/apimachinery/pkg/util/wait.ConditionFunc.WithContext.func1({0x40ce34, 0xc0000a1848})
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:217 +0x1b
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtectionWithContext({0x168bb88, 0xc000046038}, 0xc0000a1950)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:230 +0x7c
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection(0x13aa440)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:223 +0x39
k8s.io/apimachinery/pkg/util/wait.ExponentialBackoff({0x989680, 0x3ff0000000000000, 0x3fb999999999999a, 0x5, 0x0}, 0x40d187)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:418 +0x5f
k8s.io/client-go/util/retry.OnError({0x989680, 0x3ff0000000000000, 0x3fb999999999999a, 0x5, 0x0}, 0x15600d0, 0xc000604840)
/go/pkg/mod/k8s.io/[email protected]/util/retry/util.go:50 +0xf1
k8s.io/client-go/util/retry.RetryOnConflict(...)
/go/pkg/mod/k8s.io/[email protected]/util/retry/util.go:104
github.com/govirtuo/kube-ns-suspender/engine.patchStatefulsetReplicas({0x168bb88, 0xc000046030}, 0xc0003af4a0, {0xc00048acf0, 0x6}, {0xc0002de930, 0x8}, {0x14b63de, 0x12}, 0x0)
/build/engine/statefulset.go:53 +0x1d2
github.com/govirtuo/kube-ns-suspender/engine.checkSuspendedStatefulsetsConformity({0x168bb88, 0xc000046030}, {{0x167daa8, 0xc00038bee0}, 0x0, {0x0, 0x0}, {0xc00042e600, 0x2b, 0x1f4}, ...}, ...)
/build/engine/statefulset.go:43 +0x1f1
github.com/govirtuo/kube-ns-suspender/engine.(*Engine).Suspender.func6()
/build/engine/suspender.go:266 +0xa8
created by github.com/govirtuo/kube-ns-suspender/engine.(*Engine).Suspender
/build/engine/suspender.go:265 +0x3a05
panic: assignment to entry in nil map [recovered]
panic: assignment to entry in nil map
goroutine 61 [running]:
k8s.io/apimachinery/pkg/util/runtime.HandleCrash({0x0, 0x0, 0xc0001c0000})
/go/pkg/mod/k8s.io/[email protected]/pkg/util/runtime/runtime.go:55 +0xd8
panic({0x13287a0, 0x1661690})
/usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/govirtuo/kube-ns-suspender/engine.patchStatefulsetReplicas.func1()
/build/engine/statefulset.go:61 +0x186
k8s.io/client-go/util/retry.OnError.func1()
/go/pkg/mod/k8s.io/[email protected]/util/retry/util.go:51 +0x33
k8s.io/apimachinery/pkg/util/wait.ConditionFunc.WithContext.func1({0x40ce34, 0xc0000a1848})
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:217 +0x1b
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtectionWithContext({0x168bb88, 0xc000046038}, 0xc0000a1950)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:230 +0x7c
k8s.io/apimachinery/pkg/util/wait.runConditionWithCrashProtection(0x13aa440)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:223 +0x39
k8s.io/apimachinery/pkg/util/wait.ExponentialBackoff({0x989680, 0x3ff0000000000000, 0x3fb999999999999a, 0x5, 0x0}, 0x40d187)
/go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:418 +0x5f
k8s.io/client-go/util/retry.OnError({0x989680, 0x3ff0000000000000, 0x3fb999999999999a, 0x5, 0x0}, 0x15600d0, 0xc000604840)
/go/pkg/mod/k8s.io/[email protected]/util/retry/util.go:50 +0xf1
k8s.io/client-go/util/retry.RetryOnConflict(...)
/go/pkg/mod/k8s.io/[email protected]/util/retry/util.go:104
github.com/govirtuo/kube-ns-suspender/engine.patchStatefulsetReplicas({0x168bb88, 0xc000046030}, 0xc0003af4a0, {0xc00048acf0, 0x6}, {0xc0002de930, 0x8}, {0x14b63de, 0x12}, 0x0)
/build/engine/statefulset.go:53 +0x1d2
github.com/govirtuo/kube-ns-suspender/engine.checkSuspendedStatefulsetsConformity({0x168bb88, 0xc000046030}, {{0x167daa8, 0xc00038bee0}, 0x0, {0x0, 0x0}, {0xc00042e600, 0x2b, 0x1f4}, ...}, ...)
/build/engine/statefulset.go:43 +0x1f1
github.com/govirtuo/kube-ns-suspender/engine.(*Engine).Suspender.func6()
/build/engine/suspender.go:266 +0xa8
created by github.com/govirtuo/kube-ns-suspender/engine.(*Engine).Suspender
/build/engine/suspender.go:265 +0x3a05
Anything else?
No response
bug