@@ -112,6 +112,9 @@ const installRuntimeCmd = new Command({
112112 . option ( 'make-default-runtime' , {
113113 describe : 'should all pipelines run on the this runtime (default is false)' ,
114114 } )
115+ . option ( 'skip-cluster-creation' , {
116+ description : 'If set to true, will skip cluster integration creation for this runtime' ,
117+ } )
115118 . option ( 'verbose' , {
116119 describe : 'Print logs' ,
117120 } ) ,
@@ -121,6 +124,7 @@ const installRuntimeCmd = new Command({
121124 'agent-name' : agentName ,
122125 'runtime-name' : reName ,
123126 'skip-re-creation' : skipRuntimeCreation ,
127+ 'skip-cluster-creation' : skipClusterCreation ,
124128 'dry-run' : dryRun ,
125129 'in-cluster' : inCluster ,
126130 'kube-node-selector' : kubeNodeSelector ,
@@ -200,18 +204,19 @@ const installRuntimeCmd = new Command({
200204 }
201205
202206 // check if cluster already exists
203- let clusterExists = false ;
204- try {
205- const clusters = await sdk . clusters . list ( ) || [ ] ;
206- if ( clusters . find ( cluster => cluster . selector === kubeContextName ) ) {
207- clusterExists = true ;
207+ let createCluster = false ;
208+ if ( ! skipClusterCreation ) {
209+ try {
210+ const clusters = await sdk . clusters . list ( ) || [ ] ;
211+ // should create cluster if it does not exist already
212+ createCluster = ! clusters . find ( cluster => cluster . selector === kubeContextName ) ;
213+ } catch ( error ) {
214+ console . log ( `Failed to fetch account clusters, cause: ${ error . message } ` ) ;
208215 }
209- } catch ( error ) {
210- console . log ( `Failed to fetch account clusters, cause: ${ error . message } ` ) ;
211216 }
212217
213218 // create the cluster in codefresh if does not exists
214- if ( ! clusterExists ) {
219+ if ( createCluster ) {
215220 console . log ( `Adding cluster "${ colors . cyan ( kubeContextName ) } " integration to your Codefresh account` ) ;
216221 try {
217222 await createClusterCmd . handler ( {
0 commit comments