rback icon indicating copy to clipboard operation
rback copied to clipboard

Error interface conversion

Open fferraro87 opened this issue 4 years ago • 4 comments

Hi, i've installed rback as kubectl plugin so i've launch :

root@061-ildm ~]# kubectl rback -n gateway
panic: interface conversion: interface {} is nil, not []interface {}

goroutine 1 [running]:
main.toRole(0xc000326f90, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/hausenbl/go/src/github.com/mhausenblas/rback/parse.go:95 +0x51a
main.(*Rback).parseRBAC(0xc00028fec8, 0x53c180, 0xc00000e010, 0xc000046250, 0x1)
        /Users/hausenbl/go/src/github.com/mhausenblas/rback/parse.go:56 +0x46d
main.main()
        /Users/hausenbl/go/src/github.com/mhausenblas/rback/main.go:45 +0xf6

why i've that error?

fferraro87 avatar Jul 26 '21 13:07 fferraro87

@fferraro87 does the namespace gateway exist? Can you paste the output of the following command please:

kubectl get ns

mhausenblas avatar Jul 26 '21 14:07 mhausenblas

yes it exists.

root@061-ildm ~]# kubectl get ns
NAME                   STATUS   AGE
anter                  Active   481d
cattle-system          Active   67d
default                Active   481d
fencing                Active   133d
fleet-system           Active   67d
gateway                Active   481d
kube-node-lease        Active   481d
kube-public            Active   481d
kube-system            Active   481d
kubernetes-dashboard   Active   130d
prometheus             Active   203d

fferraro87 avatar Jul 26 '21 14:07 fferraro87

Thanks for confirming! And one more thing: you have sufficient permissions, yes? As in: when you do, for example:

kubectl -n gateway get roles,clusterroles 

… you see some results?

mhausenblas avatar Jul 26 '21 15:07 mhausenblas

Similar problem for me:

$ kubectl get sa,roles,rolebindings,clusterroles,clusterrolebindings --all-namespaces -o json | rback
panic: interface conversion: interface {} is nil, not []interface {}

goroutine 1 [running]:
main.toRole(0xc0006defc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/hausenbl/go/src/github.com/mhausenblas/rback/parse.go:95 +0x51a
main.(*Rback).parseRBAC(0xc00007dec8, 0x53c180, 0xc00000e010, 0xc000010270, 0x1)
        /Users/hausenbl/go/src/github.com/mhausenblas/rback/parse.go:56 +0x46d
main.main()
        /Users/hausenbl/go/src/github.com/mhausenblas/rback/main.go:45 +0xf6

Command: kubectl get sa,roles,rolebindings,clusterroles,clusterrolebindings --all-namespaces -o json works.

mimmus avatar Feb 22 '22 09:02 mimmus