Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix: Use NetworkingV1 instead of deprecated ExtensionsV1beta1 (#492)
Browse files Browse the repository at this point in the history
Fixes keptn/keptn#4432

Signed-off-by: Nitanshu Vashistha <nitanshu.vzard@gmail.com>
  • Loading branch information
nvzard committed Jul 5, 2022
1 parent 8369229 commit 0fc8c36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/common/kubeutils/endpoint_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/common/kubeutils/endpoint_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand All @@ -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",
},
Expand Down

0 comments on commit 0fc8c36

Please sign in to comment.