poeye报错not poddisruptionbudgets

here are the changes to make it work on K8s Rev: v1.21.1 switch “policy/*v1beta1*/poddisruptionbudgets” with “policy/*v1*/poddisruptionbudgets” changed files are pkg/popeye.go internal/dag/pdb.go

here git diff.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/internal/dag/pdb.go b/internal/dag/pdb.go
index 0ebe266..ad1b39a 100644
--- a/internal/dag/pdb.go
+++ b/internal/dag/pdb.go
@@ -43,7 +43,7 @@ func fetchPodDisruptionBudgets(ctx context.Context) (*polv1beta1.PodDisruptionBu
        }

        var res dao.Resource
-       res.Init(f, client.NewGVR("policy/v1beta1/poddisruptionbudgets"))
+       res.Init(f, client.NewGVR("policy/v1/poddisruptionbudgets"))
        oo, err := res.List(ctx)
        if err != nil {
                return nil, err
diff --git a/pkg/popeye.go b/pkg/popeye.go
index 78b44d8..a74007a 100644
--- a/pkg/popeye.go
+++ b/pkg/popeye.go
@@ -128,7 +128,7 @@ func (p *Popeye) scannedGVRs(rev *version.Info) []string {
                "apps/v1/replicasets",
                "apps/v1/daemonsets",
                "apps/v1/statefulsets",
-               "policy/v1beta1/poddisruptionbudgets",
+               "policy/v1/poddisruptionbudgets",
                "policy/v1beta1/podsecuritypolicies",
                "networking.k8s.io/v1/networkpolicies",
                "autoscaling/v1/horizontalpodautoscalers",
@@ -201,7 +201,7 @@ func (p *Popeye) sanitizers(rev *version.Info) map[string]scrubFn {
                "autoscaling/v1/horizontalpodautoscalers":          scrub.NewHorizontalPodAutoscaler,
                "networking.k8s.io/v1/ingresses":                   scrub.NewIngress,
                "networking.k8s.io/v1/networkpolicies":             scrub.NewNetworkPolicy,
-               "policy/v1beta1/poddisruptionbudgets":              scrub.NewPodDisruptionBudget,
+               "policy/v1/poddisruptionbudgets":              scrub.NewPodDisruptionBudget,
                "policy/v1beta1/podsecuritypolicies":               scrub.NewPodSecurityPolicy,
                "rbac.authorization.k8s.io/v1/clusterroles":        scrub.NewClusterRole,
                "rbac.authorization.k8s.io/v1/clusterrolebindings": scrub.NewClusterRoleBinding,

after that rebuild and run with

1
go build && ./popeye
Licensed under CC BY-NC-SA 4.0
最后更新于 Jan 06, 2025 05:52 UTC
comments powered by Disqus
Built with Hugo
主题 StackJimmy 设计
Caret Up