@@ -112,6 +112,9 @@ const installRuntimeCmd = new Command({
112
112
. option ( 'make-default-runtime' , {
113
113
describe : 'should all pipelines run on the this runtime (default is false)' ,
114
114
} )
115
+ . option ( 'skip-cluster-creation' , {
116
+ description : 'If set to true, will skip cluster integration creation for this runtime' ,
117
+ } )
115
118
. option ( 'verbose' , {
116
119
describe : 'Print logs' ,
117
120
} ) ,
@@ -121,6 +124,7 @@ const installRuntimeCmd = new Command({
121
124
'agent-name' : agentName ,
122
125
'runtime-name' : reName ,
123
126
'skip-re-creation' : skipRuntimeCreation ,
127
+ 'skip-cluster-creation' : skipClusterCreation ,
124
128
'dry-run' : dryRun ,
125
129
'in-cluster' : inCluster ,
126
130
'kube-node-selector' : kubeNodeSelector ,
@@ -200,18 +204,19 @@ const installRuntimeCmd = new Command({
200
204
}
201
205
202
206
// 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 } ` ) ;
208
215
}
209
- } catch ( error ) {
210
- console . log ( `Failed to fetch account clusters, cause: ${ error . message } ` ) ;
211
216
}
212
217
213
218
// create the cluster in codefresh if does not exists
214
- if ( ! clusterExists ) {
219
+ if ( createCluster ) {
215
220
console . log ( `Adding cluster "${ colors . cyan ( kubeContextName ) } " integration to your Codefresh account` ) ;
216
221
try {
217
222
await createClusterCmd . handler ( {
0 commit comments