@@ -114,18 +114,21 @@ func (c *Cluster) WithPath(path string) support.E2EClusterProvider {
114
114
c .path = path
115
115
return c
116
116
}
117
+
117
118
func (c * Cluster ) WithOpts (opts ... support.ClusterOpts ) support.E2EClusterProvider {
118
119
for _ , opt := range opts {
119
120
opt (c )
120
121
}
121
122
return c
122
123
}
124
+
123
125
func (c * Cluster ) SetDefaults () support.E2EClusterProvider {
124
126
if c .path == "" {
125
127
c .path = "vcluster"
126
128
}
127
129
return c
128
130
}
131
+
129
132
func (c * Cluster ) Create (ctx context.Context , args ... string ) (string , error ) {
130
133
log .V (4 ).Info ("Creating vcluster " , c .name )
131
134
if err := c .findOrInstallVcluster (); err != nil {
@@ -180,13 +183,15 @@ func (c *Cluster) Create(ctx context.Context, args ...string) (string, error) {
180
183
181
184
return kConfig , nil
182
185
}
186
+
183
187
func (c * Cluster ) CreateWithConfig (ctx context.Context , configFile string ) (string , error ) {
184
188
var args []string
185
189
if configFile != "" {
186
190
args = append (args , "--values" , configFile )
187
191
}
188
192
return c .Create (ctx , args ... )
189
193
}
194
+
190
195
func (c * Cluster ) GetKubeconfig () string {
191
196
return c .kubecfgFile
192
197
}
@@ -206,10 +211,12 @@ func (c *Cluster) GetKubectlContext() string {
206
211
}
207
212
return kc .CurrentContext
208
213
}
214
+
209
215
func (c * Cluster ) ExportLogs (ctx context.Context , dest string ) error {
210
216
// Not implemented
211
217
return nil
212
218
}
219
+
213
220
func (c * Cluster ) Destroy (ctx context.Context ) error {
214
221
log .V (4 ).Info ("Destroying vcluster " , c .name )
215
222
if err := c .findOrInstallVcluster (); err != nil {
@@ -258,6 +265,7 @@ func (c *Cluster) WaitForControlPlane(ctx context.Context, client klient.Client)
258
265
}
259
266
return nil
260
267
}
268
+
261
269
func (c * Cluster ) KubernetesRestConfig () * rest.Config {
262
270
return c .rc
263
271
}
0 commit comments