Provide default inerval and timeout via config

This commit is contained in:
Volodymyr Zotov
2025-08-26 16:31:07 -05:00
parent 24edff22d4
commit 0c3caf88b6
5 changed files with 22 additions and 17 deletions

View File

@@ -23,17 +23,23 @@ import (
apiv1 "github.com/1Password/onepassword-operator/api/v1"
)
type ClusterConfig struct {
type TestConfig struct {
Timeout time.Duration
Interval time.Duration
}
type Config struct {
Namespace string
ManifestsDir string
TestConfig *TestConfig
}
type Kube struct {
Config *ClusterConfig
Config *Config
Client client.Client
}
func NewKubeClient(clusterConfig *ClusterConfig) *Kube {
func NewKubeClient(config *Config) *Kube {
By("Creating a kubernetes client")
kubeconfig := os.Getenv("KUBECONFIG")
if kubeconfig == "" {
@@ -62,12 +68,12 @@ func NewKubeClient(clusterConfig *ClusterConfig) *Kube {
ctx, ok := cfg.Contexts[currentContext]
Expect(ok).To(BeTrue(), fmt.Sprintf("current context %q not found in kubeconfig", currentContext))
ctx.Namespace = clusterConfig.Namespace
ctx.Namespace = config.Namespace
err = clientcmd.ModifyConfig(pathOpts, *cfg, true)
Expect(err).NotTo(HaveOccurred())
return &Kube{
Config: clusterConfig,
Config: config,
Client: kubernetesClient,
}
}