Skip to content

[Bug] Update PodDisruptionBudget API from policy/v1beta1 to policy/v1 #286

@sinharishabh402-meesho

Description

@sinharishabh402-meesho

The current implementation of Sloop uses policy/v1beta1 for tracking PodDisruptionBudget change events. This API version was deprecated in Kubernetes 1.21 and has been removed in Kubernetes 1.25.

Users running Sloop on modern Kubernetes clusters (1.25 and above) may encounter issues or missing events because the v1beta1 endpoint is no longer served. This needs to be updated to policy/v1 to ensure compatibility with current Kubernetes versions.

According to the Kubernetes official documentation, PodDisruptionBudget in the policy API group should use v1.

What should be changed:

In pkg/sloop/ingress/kubewatcher.go line 125 instead of

i.informerFactory.Policy().V1beta1().PodDisruptionBudgets().Informer().AddEventHandler(i.getEventHandlerForResource("PodDisruptionBudget", enableGranularMetrics))

we should rather have this

i.informerFactory.Policy().V1().PodDisruptionBudgets().Informer().AddEventHandler(i.getEventHandlerForResource("PodDisruptionBudget", enableGranularMetrics))

We can have a flag based picking where if the k8s version is less than 1.25, it take v1beta1 else it takes v1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions