File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,15 @@ func WithMachineLogCollector(logCollector ClusterLogCollector) Option {
141
141
}
142
142
}
143
143
144
+ // WithRESTConfigModifier allows to modify the rest config in GetRESTConfig.
145
+ // Using this function it is possible to create ClusterProxy that can work with workload clusters hosted in places
146
+ // not directly accessible from the machine where we run the E2E tests, e.g. inside kind.
147
+ func WithRESTConfigModifier (f func (* rest.Config )) Option {
148
+ return func (c * clusterProxy ) {
149
+ c .restConfigModifier = f
150
+ }
151
+ }
152
+
144
153
// clusterProxy provides a base implementation of the ClusterProxy interface.
145
154
type clusterProxy struct {
146
155
name string
@@ -150,6 +159,8 @@ type clusterProxy struct {
150
159
logCollector ClusterLogCollector
151
160
cache cache.Cache
152
161
onceCache sync.Once
162
+
163
+ restConfigModifier func (* rest.Config )
153
164
}
154
165
155
166
// NewClusterProxy returns a clusterProxy given a KubeconfigPath and the scheme defining the types hosted in the cluster.
@@ -321,6 +332,11 @@ func (p *clusterProxy) GetRESTConfig() *rest.Config {
321
332
Expect (err ).ToNot (HaveOccurred (), "Failed to get ClientConfig from %q" , p .kubeconfigPath )
322
333
323
334
restConfig .UserAgent = "cluster-api-e2e"
335
+
336
+ if p .restConfigModifier != nil {
337
+ p .restConfigModifier (restConfig )
338
+ }
339
+
324
340
return restConfig
325
341
}
326
342
You can’t perform that action at this time.
0 commit comments