mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 18:09:58 +00:00
Using matrix strategy for e2e on multiple k8s versions (#111)
* Using matrix strategy for e2e on multiple k8s versions * EndpointSlice version support according to Kubernetes release * Utility helper for testing various Kubernetes versions
This commit is contained in:
committed by
GitHub
parent
a7f7c00558
commit
ee6e3aa0df
@@ -20,6 +20,7 @@ package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
@@ -28,6 +29,8 @@ import (
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/version"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/clastix/capsule/api/v1alpha1"
|
||||
@@ -127,3 +130,22 @@ func GroupShouldBeUsedInTenantRoleBinding(ns *corev1.Namespace, t *v1alpha1.Tena
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func GetKubernetesSemVer() (major, minor int, ver string) {
|
||||
var v *version.Info
|
||||
var err error
|
||||
var cs kubernetes.Interface
|
||||
|
||||
cs, err = kubernetes.NewForConfig(cfg)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
v, err = cs.Discovery().ServerVersion()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
major, err = strconv.Atoi(v.Major)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
minor, err = strconv.Atoi(v.Minor)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
ver = v.String()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user