@@ -24,8 +24,17 @@ import (
24
24
25
25
libsveltosv1alpha1 "github.com/projectsveltos/libsveltos/api/v1alpha1"
26
26
clusterproxy "github.com/projectsveltos/libsveltos/lib/clusterproxy"
27
+ "github.com/go-logr/logr"
28
+ "k8s.io/apimachinery/pkg/runtime"
27
29
)
28
30
31
+ // k8sAccess is a struct that holds the client and other necessary fields like logger and scheme
32
+ type k8sAccess struct {
33
+ client client.Client
34
+ logger logr.Logger
35
+ scheme * runtime.Scheme
36
+ }
37
+
29
38
// GetDebuggingConfiguration gets default DebuggingConfiguration in the specified namespace and cluster
30
39
func (a * k8sAccess ) GetDebuggingConfiguration (
31
40
ctx context.Context ,
@@ -41,7 +50,7 @@ func (a *k8sAccess) GetDebuggingConfiguration(
41
50
if namespace == "" && clusterName == "" && clusterType == "" {
42
51
c = a .client
43
52
} else {
44
- c , err = clusterproxy .GetSveltosKubernetesClient (ctx , a .client , namespace , clusterName , clusterType )
53
+ c , err = clusterproxy .GetSveltosKubernetesClient (ctx , a .logger , a . client , a . scheme , namespace , clusterName )
45
54
if err != nil {
46
55
return nil , err
47
56
}
@@ -50,7 +59,6 @@ func (a *k8sAccess) GetDebuggingConfiguration(
50
59
reqName := client.ObjectKey {
51
60
Namespace : namespace ,
52
61
Name : clusterName ,
53
- Type : clusterType ,
54
62
}
55
63
56
64
if err := c .Get (ctx , reqName , req ); err != nil {
@@ -76,7 +84,7 @@ func (a *k8sAccess) UpdateDebuggingConfiguration(
76
84
if namespace == "" && clusterName == "" && clusterType == "" {
77
85
c = a .client
78
86
} else {
79
- c , err = clusterproxy .GetSveltosKubernetesClient (ctx , a .client , namespace , clusterName , clusterType )
87
+ c , err = clusterproxy .GetSveltosKubernetesClient (ctx , a .logger , a . client , a . scheme , namespace , clusterName )
80
88
if err != nil {
81
89
return err
82
90
}
@@ -85,7 +93,6 @@ func (a *k8sAccess) UpdateDebuggingConfiguration(
85
93
reqName := client.ObjectKey {
86
94
Namespace : namespace ,
87
95
Name : clusterName ,
88
- Type : clusterType ,
89
96
}
90
97
91
98
tmp := & libsveltosv1alpha1.DebuggingConfiguration {}
0 commit comments