mateimicu / kdiscover

Discover all K8s clusters on AWS, Google, etc ..
MIT License
9 stars 2 forks source link

CLI fails if a cluster is still creating in AWS #858

Open mateimicu opened 11 months ago

mateimicu commented 11 months ago

Describe the bug When a cluster is still creating in AWS, there is a panic if you run the CLI.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x102bbc4dc]

goroutine 60 [running]:
github.com/mateimicu/kdiscover/internal/aws.(*EKSClient).detailCluster(0x14000122ac0, {0x1400016c030, 0x12})
        /.../kdiscover/internal/aws/eks.go:95 +0x38c
github.com/mateimicu/kdiscover/internal/aws.(*EKSClient).GetClusters.func1(0x14000702180, 0x1)
        /.../kdiscover/internal/aws/eks.go:44 +0x3b0
github.com/aws/aws-sdk-go/service/eks.(*EKS).ListClustersPagesWithContext(0x1400011e238, {0x1031a80a8?, 0x1400003c0f8}, 0x140003d3b00, 0x140003a03a8, {0x0, 0x0, 0x0})
        /Users/matei/go/pkg/mod/github.com/aws/aws-sdk-go@v1.44.224/service/eks/api.go:2430 +0x178
github.com/aws/aws-sdk-go/service/eks.(*EKS).ListClustersPages(0x0?, 0x0?, 0x0?)
        /Users/matei/go/pkg/mod/github.com/aws/aws-sdk-go@v1.44.224/service/eks/api.go:2404 +0x48
github.com/mateimicu/kdiscover/internal/aws.(*EKSClient).GetClusters(0x14000122ac0, 0x1400008c6c0)
        /.../kdiscover/internal/aws/eks.go:33 +0xac
created by github.com/mateimicu/kdiscover/internal/aws.getEKSClusters
        /.../kdiscover/internal/aws/eks_cluster.go:73 +0x128

I think this is because some Cluster information is not present but we assume it is.

Environment:

To Reproduce Steps to reproduce the behavior:

  1. Go to run kdiscover aws list

Expected behavior The list found clusters.

mateimicu commented 5 months ago

Extra loggs

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104671f3c]

goroutine 60 [running]:
github.com/mateimicu/kdiscover/internal/aws.(*EKSClient).detailCluster(0x140004baae0, {0x140007b2318, 0x12})
        /.../kdiscover/kdiscover/internal/aws/eks.go:95 +0x4dc
github.com/mateimicu/kdiscover/internal/aws.(*EKSClient).GetClusters.func1(0x14000160180, 0x1)
        /.../kdiscover/kdiscover/internal/aws/eks.go:44 +0x4e0
github.com/aws/aws-sdk-go/service/eks.(*EKS).ListClustersPagesWithContext(0x1400000e280, {0x104be9d70, 0x140001ac008}, 0x1400061e6f0, 0x1400019c450, {0x0, 0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/aws/aws-sdk-go@v1.44.57/service/eks/api.go:2344 +0x14c
github.com/aws/aws-sdk-go/service/eks.(*EKS).ListClustersPages(0x1400000e280, 0x1400061e6f0, 0x1400019c450)
        /home/runner/go/pkg/mod/github.com/aws/aws-sdk-go@v1.44.57/service/eks/api.go:2318 +0x60
github.com/mateimicu/kdiscover/internal/aws.(*EKSClient).GetClusters(0x140004baae0, 0x140001827e0)
        /.../kdiscover/kdiscover/internal/aws/eks.go:33 +0xc0
created by github.com/mateimicu/kdiscover/internal/aws.getEKSClusters
        /.../kdiscover/kdiscover/internal/aws/eks_cluster.go:73 +0x2ac