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

Closed
pierrevillard opened this issue Apr 28, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@pierrevillard
Copy link

pierrevillard 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

@derailed derailed added the enhancement New feature or request label May 5, 2021
@mingcheng
Copy link

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

maybe

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

@johanfleury
Copy link

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

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
Copy link
Owner

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

@lee-harmonic
Copy link

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.

@pierrevillard
Copy link
Author

@lee-harmonic,

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

@derailed
Copy link
Owner

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

@derailed
Copy link
Owner

Fixed v0.20.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants