rback: Error using v 0.1

Hi,

Nice project!

I was trying to use it into my environment and I’m facing the following error:

/usr/local/bin/kubectl get sa --all-namespaces --output json
/usr/local/bin/kubectl get roles --all-namespaces --output json
/usr/local/bin/kubectl get rolebindings --all-namespaces --output json
/usr/local/bin/kubectl get clusterroles --output json
/usr/local/bin/kubectl get clusterrolebindings --output json
panic: interface conversion: interface {} is nil, not []interface {}

goroutine 1 [running]:
main.lookupRoles(0xc0000a1650, 0x7, 0xc0000a1640, 0x7, 0xc000060150, 0xc000192270, 0xc0000ea400, 0x1c, 0x20, 0xc00023eb40, ...)
	/Users/hausenbl/go/src/github.com/mhausenblas/rback/main.go:199 +0x586
main.genGraph(0xc000060150, 0xc000192270, 0xc0000ea400, 0x1c, 0x20, 0xc00023eb40, 0xc0000eae00, 0x1c, 0x20, 0x0)
	/Users/hausenbl/go/src/github.com/mhausenblas/rback/main.go:310 +0xc01
main.main()
	/Users/hausenbl/go/src/github.com/mhausenblas/rback/main.go:27 +0x141

My env:

OS CentOS 7.6 64 bit K8S version: 1.13.4

Tks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

Yes, this was strange. Anyway it seems Kubernetes API supports RoleBinding without subjects. This should be an empty array other then a null field, but it happens this is a cluster created while it was version 1.7 and then being upgraded. Probably we’ve hit some old migration issue

@mhausenblas could figure out the problem here: when you have a RoleBinding with no subjects it returns the error.

The following is a RoleBinding that can reproduce the error:

{
"apiVersion":"rbac.authorization.k8s.io/v1",
"kind":"RoleBinding",
"metadata":{
"creationTimestamp":"2017-04-24T22:53:27Z",
"name":"admin",
"namespace":"namespace1",
"resourceVersion":"27780594",
"selfLink":"/apis/rbac.authorization.k8s.io/v1/namespaces/namespace1/rolebindings/admin",
"uid":"d487bbe2-2940-11e7-bff1-0050568f9e1c"
},
"roleRef":{
"apiGroup":"rbac.authorization.k8s.io",
"kind":"ClusterRole",
"name":"admin"
}
}