1
1
/**
2
2
* @license
3
- * Copyright (c) 2021, 2022 , Oracle and/or its affiliates.
3
+ * Copyright (c) 2021, 2023 , Oracle and/or its affiliates.
4
4
* Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
5
5
*/
6
6
'use strict' ;
@@ -50,6 +50,23 @@ define(['utils/script-adapter-base'],
50
50
return `$${ name } ` ;
51
51
}
52
52
53
+ addHelmServiceTypeCollectArgsBlock ( comment , collectVarName , ingressControllerTypeVarRef , serviceTypeVarRef ) {
54
+ if ( comment ) {
55
+ this . addComment ( comment ) ;
56
+ }
57
+
58
+ this . _lines . push (
59
+ `if ("${ serviceTypeVarRef } " -ne "LoadBalancer") {` ,
60
+ `${ this . indent ( 1 ) } if ("${ ingressControllerTypeVarRef } " -eq "traefik") {` ,
61
+ `${ this . indent ( 2 ) } $${ collectVarName } = "${ this . getVariableReference ( collectVarName ) } --set service.type=${ serviceTypeVarRef } "` ,
62
+ `${ this . indent ( 1 ) } elseif ("${ ingressControllerTypeVarRef } " -eq "nginx) {"` ,
63
+ `${ this . indent ( 2 ) } $${ collectVarName } = "${ this . getVariableReference ( collectVarName ) } --set controller.service.type=${ serviceTypeVarRef } "` ,
64
+ `${ this . indent ( 1 ) } }` ,
65
+ '}' ,
66
+ ''
67
+ ) ;
68
+ }
69
+
53
70
addHelmTimeoutCollectArgsBlock ( comment , collectVarName , timeoutVarRef ) {
54
71
if ( comment ) {
55
72
this . addComment ( comment ) ;
@@ -146,80 +163,80 @@ define(['utils/script-adapter-base'],
146
163
const variableRef = this . getVariableReference ( variableName ) ;
147
164
const serviceAccountLines = [
148
165
`if ("${ helmChartValues . serviceAccount } " -ne "") {` ,
149
- `${ this . indent ( 1 ) } ${ variableName } = "${ variableRef } --set serviceAccount=${ helmChartValues . serviceAccount } "` ,
166
+ `${ this . indent ( 1 ) } ${ variableName } = "${ variableRef } --set serviceAccount=${ helmChartValues . serviceAccount } "` ,
150
167
'}'
151
168
] ;
152
169
153
170
const strategyLines = [
154
171
`if ("${ helmChartValues . domainNamespaceSelectionStrategy } " -eq "LabelSelector") {` ,
155
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set domainNamespaceLabelSelector=${ helmChartValues . domainNamespaceLabelSelector } "` ,
172
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set domainNamespaceLabelSelector=${ helmChartValues . domainNamespaceLabelSelector } "` ,
156
173
`} elseif (("${ helmChartValues . domainNamespaceSelectionStrategy } " -eq "List") -and ("${ helmChartValues . domainNamespaces } " -ne "")) {` ,
157
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set domainNamespaces=${ helmChartValues . domainNamespaces } "` ,
174
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set domainNamespaces=${ helmChartValues . domainNamespaces } "` ,
158
175
`} elseif ("${ helmChartValues . domainNamespaceSelectionStrategy } " -eq "RegExp") {` ,
159
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set domainNamespaceRegExp=${ helmChartValues . domainNamespaceRegExp } "` ,
176
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set domainNamespaceRegExp=${ helmChartValues . domainNamespaceRegExp } "` ,
160
177
'}'
161
178
] ;
162
179
163
180
const pullSecretsLines = [
164
181
`if ("${ wkoPullRequiresAuthentication } " -eq "true") {` ,
165
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullSecrets=${ helmChartValues . imagePullSecrets } "` ,
182
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullSecrets=${ helmChartValues . imagePullSecrets } "` ,
166
183
'}'
167
184
] ;
168
185
169
186
const roleBindingLines = [
170
187
`if ("${ helmChartValues . enableClusterRoleBinding } " -eq "true") {` ,
171
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set enableClusterRoleBinding=${ helmChartValues . enableClusterRoleBinding } "` ,
188
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set enableClusterRoleBinding=${ helmChartValues . enableClusterRoleBinding } "` ,
172
189
'}'
173
190
] ;
174
191
175
192
const pullPolicyLines = [
176
193
`if ("${ helmChartValues . imagePullPolicy } " -ne "") {` ,
177
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullPolicy=${ helmChartValues . imagePullPolicy } "` ,
194
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullPolicy=${ helmChartValues . imagePullPolicy } "` ,
178
195
'}'
179
196
] ;
180
197
181
198
const externalRestLines = [
182
199
`if ("${ helmChartValues . externalRestEnabled } " -eq "true") {` ,
183
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set externalRestEnabled=${ helmChartValues . externalRestEnabled } "` ,
200
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set externalRestEnabled=${ helmChartValues . externalRestEnabled } "` ,
184
201
`${ this . indent ( 1 ) } if ("${ helmChartValues . externalRestHttpsPort } " -ne "") {` ,
185
- `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set externalRestHttpsPort=${ helmChartValues . externalRestHttpsPort } "` ,
202
+ `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set externalRestHttpsPort=${ helmChartValues . externalRestHttpsPort } "` ,
186
203
`${ this . indent ( 1 ) } }` ,
187
204
`${ this . indent ( 1 ) } if ("${ helmChartValues . externalRestIdentitySecret } " -ne "") {` ,
188
- `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set externalRestIdentitySecret=${ helmChartValues . externalRestIdentitySecret } "` ,
205
+ `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set externalRestIdentitySecret=${ helmChartValues . externalRestIdentitySecret } "` ,
189
206
`${ this . indent ( 1 ) } }` ,
190
207
'}'
191
208
] ;
192
209
193
210
const elkIntegrationLines = [
194
211
`if ("${ helmChartValues . elkIntegrationEnabled } " -eq "true") {` ,
195
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set elkIntegrationEnabled=${ helmChartValues . elkIntegrationEnabled } "` ,
212
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set elkIntegrationEnabled=${ helmChartValues . elkIntegrationEnabled } "` ,
196
213
`${ this . indent ( 1 ) } if ("${ helmChartValues . logStashImage } " -ne "") {` ,
197
- `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set logStashImage=${ helmChartValues . logStashImage } "` ,
214
+ `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set logStashImage=${ helmChartValues . logStashImage } "` ,
198
215
`${ this . indent ( 1 ) } }` ,
199
216
`${ this . indent ( 1 ) } if ("${ helmChartValues . elasticSearchHost } " -ne "") {` ,
200
- `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set elasticSearchHost=${ helmChartValues . elasticSearchHost } "` ,
217
+ `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set elasticSearchHost=${ helmChartValues . elasticSearchHost } "` ,
201
218
`${ this . indent ( 1 ) } }` ,
202
219
`${ this . indent ( 1 ) } if ("${ helmChartValues . elasticSearchPort } " -ne "") {` ,
203
- `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set elasticSearchPort=${ helmChartValues . elasticSearchPort } "` ,
220
+ `${ this . indent ( 2 ) } $${ variableName } = "${ variableRef } --set elasticSearchPort=${ helmChartValues . elasticSearchPort } "` ,
204
221
`${ this . indent ( 1 ) } }` ,
205
222
'}'
206
223
] ;
207
224
208
225
const javaLoggingLines = [
209
226
`if ("${ helmChartValues . javaLoggingLevel } " -ne "") {` ,
210
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingLevel=${ helmChartValues . javaLoggingLevel } "` ,
227
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingLevel=${ helmChartValues . javaLoggingLevel } "` ,
211
228
'}' ,
212
229
`if ("${ helmChartValues . javaLoggingFileSizeLimit } " -ne "") {` ,
213
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileSizeLimit=${ helmChartValues . javaLoggingFileSizeLimit } "` ,
230
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileSizeLimit=${ helmChartValues . javaLoggingFileSizeLimit } "` ,
214
231
'}' ,
215
232
`if ("${ helmChartValues . javaLoggingFileCount } " -ne "") {` ,
216
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileCount=${ helmChartValues . javaLoggingFileCount } "` ,
233
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileCount=${ helmChartValues . javaLoggingFileCount } "` ,
217
234
'}'
218
235
] ;
219
236
220
237
const helmTimeoutLines = [
221
238
`if ("${ helmChartValues . timeout } " -ne "") {` ,
222
- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --timeout $(${ helmChartValues . timeout } )m"` ,
239
+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --timeout $(${ helmChartValues . timeout } )m"` ,
223
240
'}' ,
224
241
] ;
225
242
@@ -444,16 +461,16 @@ define(['utils/script-adapter-base'],
444
461
445
462
const collectVar = this . getVariableReference ( collectVariableName ) ;
446
463
return [
447
- `$${ collectVariableName } = ""` ,
464
+ `$${ collectVariableName } = ""` ,
448
465
`if ("${ ingressType } " -eq "Voyager") {` ,
449
466
`${ this . indent ( 1 ) } if ("${ options . cloudProvider } " -ne "") {` ,
450
- `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set cloudProvider=${ options . cloudProvider } "` ,
467
+ `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set cloudProvider=${ options . cloudProvider } "` ,
451
468
`${ this . indent ( 1 ) } }` ,
452
469
`${ this . indent ( 1 ) } if ("${ options [ 'apiserver.healthcheck.enabled' ] } " -ne "") {` ,
453
- `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set apiserver.healthcheck.enabled=${ options [ 'apiserver.healthcheck.enabled' ] } "` ,
470
+ `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set apiserver.healthcheck.enabled=${ options [ 'apiserver.healthcheck.enabled' ] } "` ,
454
471
`${ this . indent ( 1 ) } }` ,
455
472
`${ this . indent ( 1 ) } if ("${ options [ 'apiserver.enableValidationWebhook' ] } " -ne "") {` ,
456
- `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set apiserver.enableValidationWebhook=${ options [ 'apiserver.enableValidationWebhook' ] } "` ,
473
+ `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set apiserver.enableValidationWebhook=${ options [ 'apiserver.enableValidationWebhook' ] } "` ,
457
474
`${ this . indent ( 1 ) } }` ,
458
475
'}'
459
476
] ;
@@ -468,9 +485,9 @@ define(['utils/script-adapter-base'],
468
485
return [
469
486
`if ("${ useSecret } " -eq "true") {` ,
470
487
`${ this . indent ( 1 ) } if ("${ ingressType } " -eq "Traefik") {` ,
471
- `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set deployment.imagePullSecrets[0].name=${ secretName } "` ,
488
+ `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set deployment.imagePullSecrets[0].name=${ secretName } "` ,
472
489
`${ this . indent ( 1 ) } } elseif ("${ ingressType } " -eq "Voyager") {` ,
473
- `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set imagePullSecrets[0].name=${ secretName } "` ,
490
+ `${ this . indent ( 2 ) } $${ collectVariableName } = "${ collectVar } --set imagePullSecrets[0].name=${ secretName } "` ,
474
491
`${ this . indent ( 1 ) } }` ,
475
492
'}'
476
493
] ;
0 commit comments