File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ const inquirer = require('inquirer');
55const colors = require ( 'colors' ) ;
66const _ = require ( 'lodash' ) ;
77const { addProxyVariables, detectProxy, keyValueArrayToObject } = require ( '../../helpers/general' ) ;
8- const { getAllKubeContexts, getKubeContext } = require ( '../../helpers/kubernetes' ) ;
8+ const { getAllKubeContexts, getKubeContext, isInCluster } = require ( '../../helpers/kubernetes' ) ;
99const installMonitoring = require ( '../monitor/install.cmd' ) ;
1010const createClusterCmd = require ( '../cluster/create.cmd' ) ;
1111const createContext = require ( '../auth/create-context.cmd' ) ;
@@ -635,6 +635,10 @@ const initCmd = new Command({
635635 } ,
636636 installationEvent : installationProgress . events . CLUSTER_INTEGRATION_ADDED ,
637637 condition : async ( ) => {
638+ if ( isInCluster ( ) ) {
639+ console . log ( 'Cluster integration was not added , please add it via codefresh create clusters [name] ' ) ;
640+ return false ;
641+ }
638642 const clusters = await sdk . clusters . list ( ) || [ ] ;
639643 if ( clusters . find ( cluster => cluster . selector === kubeContextName ) ) {
640644 return false ; // cluster already exists
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ const _getKubeConfig = (kubeconfigPath) => {
1717 return kc ;
1818} ;
1919
20+ const isInCluster = ( ) => {
21+ return fs . existsSync ( '/var/run/secrets/kubernetes.io/serviceaccount' ) ;
22+ } ;
23+
2024const getKubeContext = ( kubeconfigPath ) => {
2125 const kubeconfig = _getKubeConfig ( kubeconfigPath ) ;
2226 return kubeconfig . currentContext ;
@@ -49,4 +53,5 @@ module.exports = {
4953 getKubeContext,
5054 getAllKubeContexts,
5155 getAllNamespaces,
56+ isInCluster,
5257} ;
Original file line number Diff line number Diff line change 11{
22 "name" : " codefresh" ,
3- "version" : " 0.73.23 " ,
3+ "version" : " 0.73.24 " ,
44 "description" : " Codefresh command line utility" ,
55 "main" : " index.js" ,
66 "preferGlobal" : true ,
You can’t perform that action at this time.
0 commit comments