Skip to content

Commit

Permalink
Fix HPA API version derailed#207
Browse files Browse the repository at this point in the history
  • Loading branch information
taintedkernel committed Mar 16, 2022
1 parent 6db27f0 commit bf29afc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/popeye.go
Expand Up @@ -128,7 +128,6 @@ func (p *Popeye) scannedGVRs(rev *client.Revision) []string {
"apps/v1/statefulsets",
"policy/v1beta1/podsecuritypolicies",
"networking.k8s.io/v1/networkpolicies",
"autoscaling/v1/horizontalpodautoscalers",
"rbac.authorization.k8s.io/v1/clusterroles",
"rbac.authorization.k8s.io/v1/clusterrolebindings",
"rbac.authorization.k8s.io/v1/roles",
Expand All @@ -145,6 +144,11 @@ func (p *Popeye) scannedGVRs(rev *client.Revision) []string {
} else {
mm = append(mm, "policy/v1beta1/poddisruptionbudgets")
}
if rev.Minor >= 23 {
mm = append(mm, "autoscaling/v2/horizontalpodautoscalers")
} else {
mm = append(mm, "autoscaling/v1/horizontalpodautoscalers")
}

return mm
}
Expand Down Expand Up @@ -215,7 +219,6 @@ func (p *Popeye) sanitizers(rev *client.Revision) map[string]scrubFn {
"apps/v1/deployments": scrub.NewDeployment,
"apps/v1/replicasets": scrub.NewReplicaSet,
"apps/v1/statefulsets": scrub.NewStatefulSet,
"autoscaling/v1/horizontalpodautoscalers": scrub.NewHorizontalPodAutoscaler,
"networking.k8s.io/v1/networkpolicies": scrub.NewNetworkPolicy,
"policy/v1beta1/podsecuritypolicies": scrub.NewPodSecurityPolicy,
"rbac.authorization.k8s.io/v1/clusterroles": scrub.NewClusterRole,
Expand All @@ -234,6 +237,11 @@ func (p *Popeye) sanitizers(rev *client.Revision) map[string]scrubFn {
} else {
mm["policy/v1beta1/poddisruptionbudgets"] = scrub.NewPodDisruptionBudget
}
if rev.Minor >= 23 {
mm["autoscaling/v2/horizontalpodautoscalers"] = scrub.NewHorizontalPodAutoscaler
} else {
mm["autoscaling/v1/horizontalpodautoscalers"] = scrub.NewHorizontalPodAutoscaler
}

return mm
}
Expand Down

0 comments on commit bf29afc

Please sign in to comment.