From 0fc8c36d130663fbfe443872f4020a220c5cac24 Mon Sep 17 00:00:00 2001 From: Nitanshu Vashistha Date: Tue, 5 Jul 2022 14:55:36 +0530 Subject: [PATCH] fix: Use NetworkingV1 instead of deprecated ExtensionsV1beta1 (#492) Fixes https://github.com/keptn/keptn/issues/4432 Signed-off-by: Nitanshu Vashistha --- pkg/common/kubeutils/endpoint_provider.go | 2 +- pkg/common/kubeutils/endpoint_provider_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/common/kubeutils/endpoint_provider.go b/pkg/common/kubeutils/endpoint_provider.go index 2072b086..3d38e1f6 100644 --- a/pkg/common/kubeutils/endpoint_provider.go +++ b/pkg/common/kubeutils/endpoint_provider.go @@ -24,7 +24,7 @@ func NewKeptnEndpointProvider(useInClusterConfig bool) (*KeptnEndpointProvider, // GetKeptnEndpointFromIngress returns the host of ingress object Keptn Installation func (a *KeptnEndpointProvider) GetKeptnEndpointFromIngress(ctx context.Context, namespace string, ingressName string) (string, error) { - keptnIngress, err := a.clientSet.ExtensionsV1beta1().Ingresses(namespace).Get(ctx, ingressName, metav1.GetOptions{}) + keptnIngress, err := a.clientSet.NetworkingV1().Ingresses(namespace).Get(ctx, ingressName, metav1.GetOptions{}) if err != nil { return "", err } diff --git a/pkg/common/kubeutils/endpoint_provider_test.go b/pkg/common/kubeutils/endpoint_provider_test.go index 3b04e7d2..5a15ec3c 100644 --- a/pkg/common/kubeutils/endpoint_provider_test.go +++ b/pkg/common/kubeutils/endpoint_provider_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" v1 "k8s.io/api/core/v1" - "k8s.io/api/extensions/v1beta1" + networkingv1 "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes/fake" k8stesting "k8s.io/client-go/testing" @@ -28,7 +28,7 @@ func TestKeptnEndpointProvider_GetKeptnEndpointFromIngress_FailClientSet(t *test func TestKeptnEndpointProvider_GetKeptnEndpointFromIngress_Invalid(t *testing.T) { kubernetes := fake.NewSimpleClientset() kubernetes.Fake.PrependReactor("get", "ingresses", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &v1beta1.Ingress{Spec: v1beta1.IngressSpec{}}, nil + return true, &networkingv1.Ingress{Spec: networkingv1.IngressSpec{}}, nil }) keptnEndpointProvider := &KeptnEndpointProvider{clientSet: kubernetes} res, err := keptnEndpointProvider.GetKeptnEndpointFromIngress(context.TODO(), "keptn", "ingress") @@ -40,9 +40,9 @@ func TestKeptnEndpointProvider_GetKeptnEndpointFromIngress_Invalid(t *testing.T) func TestKeptnEndpointProvider_GetKeptnEndpointFromIngress_Valid(t *testing.T) { kubernetes := fake.NewSimpleClientset() kubernetes.Fake.PrependReactor("get", "ingresses", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) { - return true, &v1beta1.Ingress{ - Spec: v1beta1.IngressSpec{ - Rules: []v1beta1.IngressRule{ + return true, &networkingv1.Ingress{ + Spec: networkingv1.IngressSpec{ + Rules: []networkingv1.IngressRule{ { Host: "1.1.1.1", },