From 4173a546aeb8a741ecb1619ca3b150118ad28110 Mon Sep 17 00:00:00 2001 From: Sahil Badla <146279034+sbadla1@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:11:54 -0800 Subject: [PATCH] update autoscaling and pdb APIs (#127) * update pdb policy to PolicyV1 Signed-off-by: Sahil Badla * update unit tests Signed-off-by: Sahil Badla --------- Signed-off-by: Sahil Badla Co-authored-by: Sahil Badla --- pkg/kube/structured/structured.go | 4 ++-- pkg/kube/structured/structured_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/kube/structured/structured.go b/pkg/kube/structured/structured.go index af81065..36829e9 100644 --- a/pkg/kube/structured/structured.go +++ b/pkg/kube/structured/structured.go @@ -402,9 +402,9 @@ func ResourceInNamespace(kubeClientset kubernetes.Interface, resourceType, name, case "service": _, err = kubeClientset.CoreV1().Services(namespace).Get(context.Background(), name, metav1.GetOptions{}) case "hpa", "horizontalpodautoscaler": - _, err = kubeClientset.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).Get(context.Background(), name, metav1.GetOptions{}) + _, err = kubeClientset.AutoscalingV2().HorizontalPodAutoscalers(namespace).Get(context.Background(), name, metav1.GetOptions{}) case "pdb", "poddisruptionbudget": - _, err = kubeClientset.PolicyV1beta1().PodDisruptionBudgets(namespace).Get(context.Background(), name, metav1.GetOptions{}) + _, err = kubeClientset.PolicyV1().PodDisruptionBudgets(namespace).Get(context.Background(), name, metav1.GetOptions{}) case "sa", "serviceaccount": _, err = kubeClientset.CoreV1().ServiceAccounts(namespace).Get(context.Background(), name, metav1.GetOptions{}) default: diff --git a/pkg/kube/structured/structured_test.go b/pkg/kube/structured/structured_test.go index 2e998f1..3c232bb 100644 --- a/pkg/kube/structured/structured_test.go +++ b/pkg/kube/structured/structured_test.go @@ -23,10 +23,10 @@ import ( "github.com/keikoproj/kubedog/internal/util" "github.com/keikoproj/kubedog/pkg/kube/common" appsv1 "k8s.io/api/apps/v1" - "k8s.io/api/autoscaling/v2beta2" + v2 "k8s.io/api/autoscaling/v2" corev1 "k8s.io/api/core/v1" networkingv1 "k8s.io/api/networking/v1" - v1beta1 "k8s.io/api/policy/v1beta1" + v1 "k8s.io/api/policy/v1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -693,7 +693,7 @@ func getResourceWithAll(t *testing.T, resourceType, name, namespace, label strin }, } case "hpa", hpaType: - return &v2beta2.HorizontalPodAutoscaler{ + return &v2.HorizontalPodAutoscaler{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, @@ -701,7 +701,7 @@ func getResourceWithAll(t *testing.T, resourceType, name, namespace, label strin }, } case "pdb", pdbType: - return &v1beta1.PodDisruptionBudget{ + return &v1.PodDisruptionBudget{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace,