Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic when using PodDisruptionBudget (pdb) filter #660

Closed
3 of 4 tasks
upr-kmd opened this issue Sep 15, 2023 · 2 comments
Closed
3 of 4 tasks

panic when using PodDisruptionBudget (pdb) filter #660

upr-kmd opened this issue Sep 15, 2023 · 2 comments

Comments

@upr-kmd
Copy link

upr-kmd commented Sep 15, 2023

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

v0.3.15, v0.3.9

Kubernetes Version

v1.25.11+1485cc9

Host OS and its Version

Ubuntu 22.04.3

Steps to reproduce

v0.3.15

$ k8sgpt analyze --filter PodDisruptionBudget
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1e95a69]

goroutine 22 [running]:
github.com/k8sgpt-ai/k8sgpt/pkg/analyzer.PdbAnalyzer.Analyze({}, {0xc0007e2120, {0x2c73560, 0xc000054130}, {0x0, 0x0}, {0x2c73c98, 0x3fc8bc0}, 0x0, {0x0, ...}, ...})
        /home/runner/work/k8sgpt/k8sgpt/pkg/analyzer/pdb.go:61 +0x409
github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis.func2({0x2c576a0?, 0x4008160?}, {0xc000843320, 0x13})
        /home/runner/work/k8sgpt/k8sgpt/pkg/analysis/analysis.go:198 +0xe2
created by github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis
        /home/runner/work/k8sgpt/k8sgpt/pkg/analysis/analysis.go:196 +0x8df
$ oc get  PodDisruptionBudget -A
NAMESPACE                              NAME                                    MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
eck                                    elasticsearch-pwk-es-default            N/A             1                 0                     17d
openshift-apiserver                    openshift-apiserver-pdb                 N/A             1                 1                     651d
openshift-cluster-csi-drivers          azure-disk-csi-driver-controller-pdb    N/A             1                 1                     479d
openshift-cluster-csi-drivers          azure-file-csi-driver-controller-pdb    N/A             1                 1                     308d
openshift-cluster-storage-operator     csi-snapshot-controller-pdb             N/A             1                 1                     651d
openshift-cluster-storage-operator     csi-snapshot-webhook-pdb                N/A             1                 1                     651d
openshift-console                      console                                 N/A             1                 1                     308d
openshift-console                      downloads                               N/A             1                 1                     308d
openshift-etcd                         etcd-guard-pdb                          2               N/A               1                     22d
openshift-image-registry               image-registry                          1               N/A               1                     651d
openshift-ingress                      router-default                          N/A             50%               1                     651d
openshift-kube-apiserver               kube-apiserver-guard-pdb                2               N/A               1                     479d
openshift-kube-controller-manager      kube-controller-manager-guard-pdb       2               N/A               1                     479d
openshift-kube-scheduler               openshift-kube-scheduler-guard-pdb      2               N/A               1                     479d
openshift-monitoring                   alertmanager-main                       N/A             1                 1                     479d
openshift-monitoring                   prometheus-adapter                      1               N/A               1                     651d
openshift-monitoring                   prometheus-k8s                          1               N/A               1                     479d
openshift-monitoring                   prometheus-operator-admission-webhook   1               N/A               1                     308d
openshift-monitoring                   thanos-querier-pdb                      1               N/A               1                     651d
openshift-oauth-apiserver              oauth-apiserver-pdb                     N/A             1                 1                     651d
openshift-operator-lifecycle-manager   packageserver-pdb                       N/A             1                 1                     651d
openshift-ovn-kubernetes               ovn-raft-quorum-guard                   2               N/A               1                     651d
openshift-user-workload-monitoring     prometheus-user-workload                1               N/A               1                     479d
openshift-user-workload-monitoring     thanos-ruler-user-workload              1               N/A               1                     479d

v0.3.9

$ ./k8sgpt version
k8sgpt: 0.3.9 (ad112ea), built at: unknown

$ ./k8sgpt analyze --filter PodDisruptionBudget
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1e4bde9]

goroutine 13 [running]:
github.com/k8sgpt-ai/k8sgpt/pkg/analyzer.PdbAnalyzer.Analyze({}, {0xc000797ec0, {0x2a58710, 0xc00011c028}, {0x0, 0x0}, {0x2a58e10, 0x3d6bb60}, 0x0, {0x0, ...}, ...})
        /home/runner/work/k8sgpt/k8sgpt/pkg/analyzer/pdb.go:61 +0x409
github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis.func2({0x2a3d380?, 0x3dab0b8?}, {0xc0008565e8, 0x13})
        /home/runner/work/k8sgpt/k8sgpt/pkg/analysis/analysis.go:198 +0xe2
created by github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis
        /home/runner/work/k8sgpt/k8sgpt/pkg/analysis/analysis.go:196 +0x8df

Expected behaviour

No panic :)

Actual behaviour

Application crashes

Additional Information

No response

@AlexsJones
Copy link
Member

My initial guess is this line pdb.Spec.Selector.MatchLabels means there are labels missing on the pdb spec.
Of couse it shouldn't panic so I'll put in a predictive fix and you can tell me how it looks okay?

@AlexsJones
Copy link
Member

#664

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants