44 *-----------------------------------------------------------------------------------------------*/
55
66import { KubernetesObject } from '@kubernetes/client-node' ;
7- import { Uri , WorkspaceFolder , commands , workspace } from 'vscode' ;
7+ import { Uri , WorkspaceFolder , workspace } from 'vscode' ;
88import { CommandOption , CommandText } from '../base/command' ;
99import * as cliInstance from '../cli' ;
1010import { ToolsConfig } from '../tools' ;
1111import { ChildProcessUtil , CliExitData } from '../util/childProcessUtil' ;
12- import { KubeConfigUtils } from '../util/kubeUtils' ;
1312import { VsCommandError } from '../vscommand' ;
1413import { Command } from './command' ;
1514import { AnalyzeResponse , ComponentTypeAdapter , ComponentTypeDescription , DevfileComponentType , Registry } from './componentType' ;
@@ -33,47 +32,6 @@ export class Odo {
3332 // no state
3433 }
3534
36- /**
37- * Returns the URL of the API of the current active cluster,
38- * or undefined if there are no active clusters.
39- *
40- * @return the URL of the API of the current active cluster,
41- * or undefined if there are no active clusters
42- */
43- public async getActiveCluster ( ) : Promise < string > {
44- const result : CliExitData = await this . execute (
45- Command . printOdoVersion ( ) ,
46- process . cwd ( ) ,
47- false ,
48- ) ;
49-
50- const odoCluster = result . stdout
51- . trim ( )
52- . split ( '\n' )
53- . filter ( ( value ) => value . includes ( 'Server:' ) )
54- . map ( ( value ) => {
55- return value . substring ( value . indexOf ( ':' ) + 1 ) . trim ( ) ;
56- } ) ;
57- if ( odoCluster . length !== 0 ) {
58- void commands . executeCommand ( 'setContext' , 'isLoggedIn' , true ) ;
59- return odoCluster [ 0 ] ;
60- }
61-
62- // odo didn't report an active cluster, try reading it from KubeConfig
63- try {
64- const kubeConfigCurrentCluster = new KubeConfigUtils ( ) . getCurrentCluster ( ) . server ;
65- if ( kubeConfigCurrentCluster ) {
66- void commands . executeCommand ( 'setContext' , 'isLoggedIn' , true ) ;
67- return kubeConfigCurrentCluster ;
68- }
69- } catch ( e ) {
70- // ignored
71- }
72-
73- // no active cluster
74- void commands . executeCommand ( 'setContext' , 'isLoggedIn' , false ) ;
75- }
76-
7735 public async getComponentTypes ( ) : Promise < ComponentTypeAdapter [ ] > {
7836 // if kc is produced, KUBECONFIG env var is empty or pointing
7937
0 commit comments