mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-14 17:55:34 -04:00
implement e2e test lb (#815)
* implement e2e test lb * add lb e2e test to weekly schedule Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
parent
f1bee6dab8
commit
83f09e1058
9 changed files with 292 additions and 4 deletions
40
e2e/internal/kubectl/kubectl.go
Normal file
40
e2e/internal/kubectl/kubectl.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
)
|
||||
|
||||
// New creates a new k8s client. The kube config file is expected to be set
|
||||
// via environment variable KUBECONFIG or located at ./constellation-admin.conf.
|
||||
func New() (*kubernetes.Clientset, error) {
|
||||
cfgPath := ""
|
||||
if envPath := os.Getenv("KUBECONFIG"); envPath != "" {
|
||||
cfgPath = envPath
|
||||
fmt.Printf("K8s config path empty. Using environment variable %s=%s.\n", "KUBECONFIG", envPath)
|
||||
} else {
|
||||
cfgPath = "constellation-admin.conf"
|
||||
fmt.Printf("K8s config path empty. Assuming '%s'.\n", cfgPath)
|
||||
}
|
||||
|
||||
kubeConfig, err := clientcmd.BuildConfigFromFlags("", cfgPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
k8sClient, err := kubernetes.NewForConfig(kubeConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return k8sClient, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue