@@ -32,7 +32,7 @@ export class ClusterCommandTasks {
32
32
33
33
constructor (
34
34
parent ,
35
- private readonly K0009 : K8 ,
35
+ private readonly K0009 : K0018 ,
36
36
) {
37
37
this . parent = parent ;
38
38
}
@@ -46,14 +46,14 @@ export class ClusterCommandTasks {
46
46
if ( ! context ) {
47
47
const isQuiet = self . parent . getConfigManager ( ) . getFlag ( flags . quiet ) ;
48
48
if ( isQuiet ) {
49
- context = self . parent . getK8 ( ) . contexts ( ) . readCurrent ( ) ;
49
+ context = self . parent . getK0018 ( ) . contexts ( ) . readCurrent ( ) ;
50
50
} else {
51
51
context = await self . promptForContext ( parentTask , cluster ) ;
52
52
}
53
53
54
54
localConfig . clusterContextMapping [ cluster ] = context ;
55
55
}
56
- if ( ! ( await self . parent . getK8 ( ) . contexts ( ) . testContextConnection ( context ) ) ) {
56
+ if ( ! ( await self . parent . getK0018 ( ) . contexts ( ) . testContextConnection ( context ) ) ) {
57
57
subTask . title = `${ subTask . title } - ${ chalk . red ( 'Cluster connection failed' ) } ` ;
58
58
throw new SoloError ( `${ ErrorMessages . INVALID_CONTEXT_FOR_CLUSTER_DETAILED ( context , cluster ) } ` ) ;
59
59
}
@@ -72,7 +72,7 @@ export class ClusterCommandTasks {
72
72
title : `Pull and validate remote configuration for cluster: ${ chalk . cyan ( cluster ) } ` ,
73
73
task : async ( _ , subTask : ListrTaskWrapper < any , any , any > ) => {
74
74
const context = localConfig . clusterContextMapping [ cluster ] ;
75
- self . parent . getK8 ( ) . contexts ( ) . updateCurrent ( context ) ;
75
+ self . parent . getK0018 ( ) . contexts ( ) . updateCurrent ( context ) ;
76
76
const remoteConfigFromOtherCluster = await self . parent . getRemoteConfigManager ( ) . get ( ) ;
77
77
if ( ! RemoteConfigManager . compare ( currentRemoteConfig , remoteConfigFromOtherCluster ) ) {
78
78
throw new SoloError ( ErrorMessages . REMOTE_CONFIGS_DO_NOT_MATCH ( currentClusterName , cluster ) ) ;
@@ -87,7 +87,7 @@ export class ClusterCommandTasks {
87
87
title : 'Read clusters from remote config' ,
88
88
task : async ( ctx , task ) => {
89
89
const localConfig = this . parent . getLocalConfig ( ) ;
90
- const currentClusterName = this . parent . getK8 ( ) . clusters ( ) . readCurrent ( ) ;
90
+ const currentClusterName = this . parent . getK0018 ( ) . clusters ( ) . readCurrent ( ) ;
91
91
const currentRemoteConfig : RemoteConfigDataWrapper = await this . parent . getRemoteConfigManager ( ) . get ( ) ;
92
92
const subTasks = [ ] ;
93
93
const remoteConfigClusters = Object . keys ( currentRemoteConfig . clusters ) ;
@@ -162,7 +162,7 @@ export class ClusterCommandTasks {
162
162
} else if ( ! localConfig . clusterContextMapping [ cluster ] ) {
163
163
// In quiet mode, use the currently selected context to update the mapping
164
164
if ( isQuiet ) {
165
- localConfig . clusterContextMapping [ cluster ] = this . parent . getK8 ( ) . contexts ( ) . readCurrent ( ) ;
165
+ localConfig . clusterContextMapping [ cluster ] = this . parent . getK0018 ( ) . contexts ( ) . readCurrent ( ) ;
166
166
}
167
167
168
168
// Prompt the user to select a context if mapping value is missing
@@ -185,7 +185,7 @@ export class ClusterCommandTasks {
185
185
) {
186
186
let selectedContext ;
187
187
if ( isQuiet ) {
188
- selectedContext = this . parent . getK8 ( ) . contexts ( ) . readCurrent ( ) ;
188
+ selectedContext = this . parent . getK0018 ( ) . contexts ( ) . readCurrent ( ) ;
189
189
} else {
190
190
selectedContext = await this . promptForContext ( task , selectedCluster ) ;
191
191
localConfig . clusterContextMapping [ selectedCluster ] = selectedContext ;
@@ -194,7 +194,7 @@ export class ClusterCommandTasks {
194
194
}
195
195
196
196
private async promptForContext ( task : SoloListrTaskWrapper < SelectClusterContextContext > , cluster : string ) {
197
- const kubeContexts = this . parent . getK8 ( ) . contexts ( ) . list ( ) ;
197
+ const kubeContexts = this . parent . getK0018 ( ) . contexts ( ) . list ( ) ;
198
198
return flags . context . prompt ( task , kubeContexts , cluster ) ;
199
199
}
200
200
@@ -306,8 +306,8 @@ export class ClusterCommandTasks {
306
306
else {
307
307
// Add the deployment to the LocalConfig with the currently selected cluster and context in KubeConfig
308
308
if ( isQuiet ) {
309
- selectedContext = this . parent . getK8 ( ) . contexts ( ) . readCurrent ( ) ;
310
- selectedCluster = this . parent . getK8 ( ) . clusters ( ) . readCurrent ( ) ;
309
+ selectedContext = this . parent . getK0018 ( ) . contexts ( ) . readCurrent ( ) ;
310
+ selectedCluster = this . parent . getK0018 ( ) . clusters ( ) . readCurrent ( ) ;
311
311
localConfig . deployments [ deploymentName ] = {
312
312
clusters : [ selectedCluster ] ,
313
313
namespace : namespace ? namespace . name : '' ,
@@ -335,11 +335,11 @@ export class ClusterCommandTasks {
335
335
}
336
336
}
337
337
338
- const connectionValid = await this . parent . getK8 ( ) . contexts ( ) . testContextConnection ( selectedContext ) ;
338
+ const connectionValid = await this . parent . getK0018 ( ) . contexts ( ) . testContextConnection ( selectedContext ) ;
339
339
if ( ! connectionValid ) {
340
340
throw new SoloError ( ErrorMessages . INVALID_CONTEXT_FOR_CLUSTER ( selectedContext , selectedCluster ) ) ;
341
341
}
342
- this . parent . getK8 ( ) . contexts ( ) . updateCurrent ( selectedContext ) ;
342
+ this . parent . getK0018 ( ) . contexts ( ) . updateCurrent ( selectedContext ) ;
343
343
this . parent . getConfigManager ( ) . setFlag ( flags . context , selectedContext ) ;
344
344
} ,
345
345
} ;
@@ -361,14 +361,14 @@ export class ClusterCommandTasks {
361
361
362
362
showClusterList ( ) {
363
363
return new Task ( 'List all available clusters' , async ( ctx : any , task : ListrTaskWrapper < any , any , any > ) => {
364
- this . parent . logger . showList ( 'Clusters' , this . parent . getK8 ( ) . clusters ( ) . list ( ) ) ;
364
+ this . parent . logger . showList ( 'Clusters' , this . parent . getK0018 ( ) . clusters ( ) . list ( ) ) ;
365
365
} ) ;
366
366
}
367
367
368
368
getClusterInfo ( ) {
369
369
return new Task ( 'Get cluster info' , async ( ctx : any , task : ListrTaskWrapper < any , any , any > ) => {
370
370
try {
371
- const clusterName = this . parent . getK8 ( ) . clusters ( ) . readCurrent ( ) ;
371
+ const clusterName = this . parent . getK0018 ( ) . clusters ( ) . readCurrent ( ) ;
372
372
this . parent . logger . showUser ( `Cluster Name (${ clusterName } )` ) ;
373
373
this . parent . logger . showUser ( '\n' ) ;
374
374
} catch ( e : Error | unknown ) {
0 commit comments