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 {
141141 }
142142}
143143
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+
144153// clusterProxy provides a base implementation of the ClusterProxy interface.
145154type clusterProxy struct {
146155 name string
@@ -150,6 +159,8 @@ type clusterProxy struct {
150159 logCollector ClusterLogCollector
151160 cache cache.Cache
152161 onceCache sync.Once
162+
163+ restConfigModifier func (* rest.Config )
153164}
154165
155166// 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 {
321332 Expect (err ).ToNot (HaveOccurred (), "Failed to get ClientConfig from %q" , p .kubeconfigPath )
322333
323334 restConfig .UserAgent = "cluster-api-e2e"
335+
336+ if p .restConfigModifier != nil {
337+ p .restConfigModifier (restConfig )
338+ }
339+
324340 return restConfig
325341}
326342
You can’t perform that action at this time.
0 commit comments