mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 18:09:58 +00:00
feat: detecting group discovery error for indexers
This commit is contained in:
@@ -7,7 +7,6 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -15,11 +14,11 @@ import (
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
networkingv1beta1 "k8s.io/api/networking/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("creating an Ingress with a wildcard when it is denied for the Tenant", func() {
|
||||
@@ -54,8 +53,7 @@ var _ = Describe("creating an Ingress with a wildcard when it is denied for the
|
||||
|
||||
It("should fail creating an extensions/v1beta1 Ingress with a wildcard hostname", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -135,8 +133,7 @@ var _ = Describe("creating an Ingress with a wildcard when it is denied for the
|
||||
|
||||
It("should fail creating an networking.k8s.io/v1beta1 Ingress with a wildcard hostname", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -216,8 +213,7 @@ var _ = Describe("creating an Ingress with a wildcard when it is denied for the
|
||||
|
||||
It("should fail creating an networking.k8s.io/v1 Ingress with a wildcard hostname", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/pointer"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1", func() {
|
||||
@@ -72,8 +71,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
|
||||
By("non-specifying at all", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -96,8 +94,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
})
|
||||
By("defining as deprecated annotation", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -123,8 +120,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
})
|
||||
By("using the ingressClassName", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -158,8 +154,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
for _, c := range tnt.Spec.IngressOptions.AllowedClasses.Exact {
|
||||
Eventually(func() (err error) {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -186,8 +181,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
|
||||
It("should allow enabled class using the ingressClassName field", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -232,8 +226,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
|
||||
Eventually(func() (err error) {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -267,8 +260,7 @@ var _ = Describe("when Tenant handles Ingress classes with extensions/v1beta1",
|
||||
|
||||
Eventually(func() (err error) {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -15,7 +14,6 @@ import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
@@ -25,6 +23,7 @@ import (
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1", func() {
|
||||
@@ -158,8 +157,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should block a non allowed class", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -241,8 +239,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should allow enabled class using the deprecated annotation for networking.k8s.io/v1", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -281,8 +278,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should allow enabled class using the ingressClassName field", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -319,8 +315,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should allow enabled Ingress by regex using the deprecated annotation", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -358,8 +353,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should allow enabled Ingress by regex using the ingressClassName field", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -395,8 +389,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should allow enabled Ingress by selector using the deprecated annotation", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -451,8 +444,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should allow enabled Ingress by selector using the ingressClassName field", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -535,8 +527,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should mutate to default tenant IngressClass (class exists)", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -575,8 +566,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("shoult mutate to default tenant IngressClass although the cluster global one is not allowed", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -622,8 +612,7 @@ var _ = Describe("when Tenant handles Ingress classes with networking.k8s.io/v1"
|
||||
|
||||
It("should mutate to default tenant IngressClass although the cluster global one is allowed", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when handling Cluster scoped Ingress hostnames collision", func() {
|
||||
@@ -156,8 +155,7 @@ var _ = Describe("when handling Cluster scoped Ingress hostnames collision", fun
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -191,8 +189,7 @@ var _ = Describe("when handling Cluster scoped Ingress hostnames collision", fun
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when disabling Ingress hostnames collision", func() {
|
||||
@@ -130,8 +129,7 @@ var _ = Describe("when disabling Ingress hostnames collision", func() {
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -171,8 +169,7 @@ var _ = Describe("when disabling Ingress hostnames collision", func() {
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when handling Namespace scoped Ingress hostnames collision", func() {
|
||||
@@ -130,8 +129,7 @@ var _ = Describe("when handling Namespace scoped Ingress hostnames collision", f
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -172,8 +170,7 @@ var _ = Describe("when handling Namespace scoped Ingress hostnames collision", f
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when handling Tenant scoped Ingress hostnames collision", func() {
|
||||
@@ -133,8 +132,7 @@ var _ = Describe("when handling Tenant scoped Ingress hostnames collision", func
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -168,8 +166,7 @@ var _ = Describe("when handling Tenant scoped Ingress hostnames collision", func
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,19 +7,18 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
@@ -129,8 +128,7 @@ var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -152,8 +150,7 @@ var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -175,8 +172,7 @@ var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -200,8 +196,7 @@ var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -225,8 +220,7 @@ var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
|
||||
By("testing networking.k8s.io", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -250,8 +244,7 @@ var _ = Describe("when Tenant handles Ingress hostnames", func() {
|
||||
|
||||
By("testing extensions", func() {
|
||||
if err := k8sClient.List(context.Background(), &extensionsv1beta1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -16,7 +15,6 @@ import (
|
||||
discoveryv1 "k8s.io/api/discovery/v1"
|
||||
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
|
||||
networkingv1 "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
@@ -25,6 +23,7 @@ import (
|
||||
|
||||
capsulev1beta2 "github.com/clastix/capsule/api/v1beta2"
|
||||
"github.com/clastix/capsule/pkg/api"
|
||||
"github.com/clastix/capsule/pkg/utils"
|
||||
)
|
||||
|
||||
var _ = Describe("adding metadata to Service objects", func() {
|
||||
@@ -222,8 +221,7 @@ var _ = Describe("adding metadata to Service objects", func() {
|
||||
|
||||
It("should apply them to EndpointSlice in v1", func() {
|
||||
if err := k8sClient.List(context.Background(), &networkingv1.IngressList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
@@ -254,8 +252,7 @@ var _ = Describe("adding metadata to Service objects", func() {
|
||||
var eps client.Object
|
||||
|
||||
if err := k8sClient.List(context.Background(), &discoveryv1.EndpointSliceList{}); err != nil {
|
||||
missingAPIError := &meta.NoKindMatchError{}
|
||||
if errors.As(err, &missingAPIError) {
|
||||
if utils.IsUnsupportedAPI(err) {
|
||||
Skip(fmt.Sprintf("Running test due to unsupported API kind: %s", err.Error()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user