cloud-ark / kubeplus

Kubernetes Operator for multi-instance multi-tenancy
https://cloudark.io/
Apache License 2.0
662 stars 81 forks source link

Fails to find all the children of StatefulSet #507

Closed devdattakulkarni closed 4 years ago

devdattakulkarni commented 4 years ago

txaumacl17:kubeplus-plugins kulkade$ kubectl connections service hazelcast-service Discovering connections - Level: 0, Kind:Service, instance:hazelcast-service Discovering connections - Level: 1, Kind:Pod, instance:hazelcast-0 Discovering connections - Level: 2, Kind:StatefulSet, instance:hazelcast panic: the server could not find the requested resource

goroutine 1 [running]: github.com/cloud-ark/kubediscovery/pkg/discovery.findChildrenConnections(0xc00026d200, 0x5, 0x8, 0x3, 0xc0007d4f20, 0xb, 0xc0007d4f30, 0x9, 0x7ffeefbffb8b, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:444 +0xb65 github.com/cloud-ark/kubediscovery/pkg/discovery.findRelatives(0xc000331b00, 0x4, 0x4, 0x3, 0xc0007d4f20, 0xb, 0xc0007d4f30, 0x9, 0x2ae39ec, 0x3, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:142 +0x6c8 github.com/cloud-ark/kubediscovery/pkg/discovery.GetRelatives(0xc000331b00, 0x4, 0x4, 0x2, 0xc0007d4f20, 0xb, 0xc0007d4f30, 0x9, 0x2ae39ec, 0x3, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:44 +0x343 github.com/cloud-ark/kubediscovery/pkg/discovery.findParentConnections(0xc000331b00, 0x4, 0x4, 0x2, 0x2ae39ec, 0x3, 0xc000054f40, 0xb, 0x7ffeefbffb8b, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:412 +0x479 github.com/cloud-ark/kubediscovery/pkg/discovery.findRelatives(0xc000331b00, 0x4, 0x4, 0x2, 0x2ae39ec, 0x3, 0xc000054f40, 0xb, 0x7ffeefbffb71, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:141 +0x64b github.com/cloud-ark/kubediscovery/pkg/discovery.GetRelatives(0xc000331b00, 0x4, 0x4, 0x1, 0x2ae39ec, 0x3, 0xc000054f40, 0xb, 0x7ffeefbffb71, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:44 +0x343 github.com/cloud-ark/kubediscovery/pkg/discovery.searchNextLevel(0xc000331b00, 0x4, 0x4, 0x1, 0xc000331440, 0x3, 0x4, 0x7ffeefbffb71, 0x7, 0x7ffeefbffb79, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:488 +0x198 github.com/cloud-ark/kubediscovery/pkg/discovery.buildGraph(0xc0005846c0, 0x1, 0x1, 0x1, 0x7ffeefbffb71, 0x7, 0x7ffeefbffb79, 0x11, 0xc000334000, 0x3, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:209 +0x322 github.com/cloud-ark/kubediscovery/pkg/discovery.findDownstreamRelatives(0xc0005846c0, 0x1, 0x1, 0x1, 0x7ffeefbffb71, 0x7, 0x7ffeefbffb79, 0x11, 0x7ffeefbffb8b, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:156 +0x9cc github.com/cloud-ark/kubediscovery/pkg/discovery.findRelatives(0x3d55f08, 0x0, 0x0, 0x1, 0x7ffeefbffb71, 0x7, 0x7ffeefbffb79, 0x11, 0x7ffeefbffb71, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:136 +0x461 github.com/cloud-ark/kubediscovery/pkg/discovery.GetRelatives(0x3d55f08, 0x0, 0x0, 0x0, 0x7ffeefbffb71, 0x7, 0x7ffeefbffb79, 0x11, 0x7ffeefbffb71, 0x7, ...) /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/pkg/discovery/relationships.go:44 +0x343 main.main() /Users/devdatta/go/src/github.com/cloud-ark/kubediscovery/main.go:57 +0x4d2

devdattakulkarni commented 4 years ago

This issue happened because the cluster on which this was run had ReplicaSets under apps/v1 API group. The code currently makes an assumption that ReplicaSets are available in extensions/v1beta1 group. The way to solve this is to support multiple API groups per Kind.

devdattakulkarni commented 4 years ago

Fixed.