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

popeye 0.9.0 with K8S 1.21.0 bug on PodDisruptionBudget - Wrong default API #163

Open
pierreilki opened this issue Apr 28, 2021 · 7 comments
Open

Comments

@pierreilki
Copy link

@pierreilki pierreilki commented Apr 28, 2021

Hi,
Popeye 0.9.0 has been released before Kubernetes K8S 1.21.0.
By default Popeye watch for PodDisruptionBudget resources on K8S API "policy/v1beta1/poddisruptionbudgets"
On K8S 1.21.0, PodDisruptionBudget has been migrated to API "policy/v1/poddisruptionbudgets"

In the next Popeye release, please add a check to force Popeye to watch for PodDisruptionBudget at API "policy/v1beta1/poddisruptionbudgets" for K8S < 1.21.X, and "policy/v1/poddisruptionbudgets" for K8S >= 1.21.X

@mingcheng
Copy link

@mingcheng mingcheng commented May 12, 2021

and "policy/v1beta1/poddisruptionbudgets" for K8S >= 1.21.X

maybe

and "policy/v1/poddisruptionbudgets" for K8S >= 1.21.X

@johanfleury
Copy link

@johanfleury johanfleury commented Jul 12, 2021

This makes popeye unusable on 1.21 (unless there’s a workaround that I couldn’t find).

IMO, this should be qualified as bug.

I’ll see if I can provide a PR for that.

@johanfleury
Copy link

@johanfleury johanfleury commented Jul 13, 2021

I came with this diff, but I’m not sure it’ll actually work for < 1.21:

diff --git a/pkg/popeye.go b/pkg/popeye.go
index 78b44d8..bda13b8 100644
--- a/pkg/popeye.go
+++ b/pkg/popeye.go
@@ -128,7 +128,6 @@ func (p *Popeye) scannedGVRs(rev *version.Info) []string {
                "apps/v1/replicasets",
                "apps/v1/daemonsets",
                "apps/v1/statefulsets",
-               "policy/v1beta1/poddisruptionbudgets",
                "policy/v1beta1/podsecuritypolicies",
                "networking.k8s.io/v1/networkpolicies",
                "autoscaling/v1/horizontalpodautoscalers",
@@ -144,6 +143,12 @@ func (p *Popeye) scannedGVRs(rev *version.Info) []string {
                mm = append(mm, "networking.k8s.io/v1/ingresses")
        }

+       if rev.Minor == "20+" || rev.Minor == "19+" || rev.Minor == "18+" || rev.Minor == "17+" {
+               mm = append(mm, "policy/v1beta1/poddisruptionbudgets")
+       } else {
+               mm = append(mm, "policy/v1/poddisruptionbudgets")
+       }
+
        return mm
 }

@@ -213,6 +218,10 @@ func (p *Popeye) sanitizers(rev *version.Info) map[string]scrubFn {
                mm["networking.k8s.io/v1beta1/ingresses"] = scrub.NewIngress
        }

+       if rev.Minor == "20+" || rev.Minor == "19+" || rev.Minor == "18+" || rev.Minor == "17+" {
+               mm["policy/v1beta1/poddisruptionbudgets"] = scrub.NewPodDisruptionBudget
+       }
+
        return mm
 }

derailed added a commit that referenced this issue Jul 15, 2021
derailed added a commit that referenced this issue Jul 15, 2021
POP-v0.9.4: fix #184 #181 #163
@derailed
Copy link
Owner

@derailed derailed commented Jul 15, 2021

Fixed v0.9.4. Thank you all for weighting in!

@derailed derailed closed this Jul 15, 2021
@lee-harmonic
Copy link

@lee-harmonic lee-harmonic commented Jul 20, 2021

This appears to still be happening with popeye v0.9.6 and kubernetes 1.21.3. Also, the category is repeated.

PODDISRUPTIONBUDGETS (1 SCANNED)                                               💥 0 😱 1 🔊 0 ✅ 0 0٪
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
  · test-ns/test-pdb...................................................................😱
    😱 [POP-403] Deprecated PodDisruptionBudget API group "policy/v1". Use "policy/v1beta1" instead.


PODDISRUPTIONBUDGETS (1 SCANNED)                                               💥 0 😱 1 🔊 0 ✅ 0 0٪
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
  · test-ns/test-pdb...................................................................😱
    😱 [POP-403] Deprecated PodDisruptionBudget API group "policy/v1". Use "policy/v1beta1" instead.

@pierreilki
Copy link
Author

@pierreilki pierreilki commented Jul 20, 2021

@lee-harmonic,

Does your "kubectl" version is 1.21.x too ?

@derailed
Copy link
Owner

@derailed derailed commented Jul 20, 2021

@lee-harmonic Doh - Great catch! Thank you Lee!! Will fix in the next drop.

@derailed derailed reopened this Jul 20, 2021
derailed added a commit that referenced this issue Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants