11/**
22 * @license
3- * Copyright (c) 2021, 2022 , Oracle and/or its affiliates.
3+ * Copyright (c) 2021, 2023 , Oracle and/or its affiliates.
44 * Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
55 */
66'use strict' ;
@@ -50,6 +50,23 @@ define(['utils/script-adapter-base'],
5050 return `$${ name } ` ;
5151 }
5252
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+
5370 addHelmTimeoutCollectArgsBlock ( comment , collectVarName , timeoutVarRef ) {
5471 if ( comment ) {
5572 this . addComment ( comment ) ;
@@ -146,80 +163,80 @@ define(['utils/script-adapter-base'],
146163 const variableRef = this . getVariableReference ( variableName ) ;
147164 const serviceAccountLines = [
148165 `if ("${ helmChartValues . serviceAccount } " -ne "") {` ,
149- `${ this . indent ( 1 ) } ${ variableName } = "${ variableRef } --set serviceAccount=${ helmChartValues . serviceAccount } "` ,
166+ `${ this . indent ( 1 ) } ${ variableName } = "${ variableRef } --set serviceAccount=${ helmChartValues . serviceAccount } "` ,
150167 '}'
151168 ] ;
152169
153170 const strategyLines = [
154171 `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 } "` ,
156173 `} 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 } "` ,
158175 `} 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 } "` ,
160177 '}'
161178 ] ;
162179
163180 const pullSecretsLines = [
164181 `if ("${ wkoPullRequiresAuthentication } " -eq "true") {` ,
165- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullSecrets=${ helmChartValues . imagePullSecrets } "` ,
182+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullSecrets=${ helmChartValues . imagePullSecrets } "` ,
166183 '}'
167184 ] ;
168185
169186 const roleBindingLines = [
170187 `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 } "` ,
172189 '}'
173190 ] ;
174191
175192 const pullPolicyLines = [
176193 `if ("${ helmChartValues . imagePullPolicy } " -ne "") {` ,
177- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullPolicy=${ helmChartValues . imagePullPolicy } "` ,
194+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set imagePullPolicy=${ helmChartValues . imagePullPolicy } "` ,
178195 '}'
179196 ] ;
180197
181198 const externalRestLines = [
182199 `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 } "` ,
184201 `${ 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 } "` ,
186203 `${ this . indent ( 1 ) } }` ,
187204 `${ 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 } "` ,
189206 `${ this . indent ( 1 ) } }` ,
190207 '}'
191208 ] ;
192209
193210 const elkIntegrationLines = [
194211 `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 } "` ,
196213 `${ 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 } "` ,
198215 `${ this . indent ( 1 ) } }` ,
199216 `${ 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 } "` ,
201218 `${ this . indent ( 1 ) } }` ,
202219 `${ 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 } "` ,
204221 `${ this . indent ( 1 ) } }` ,
205222 '}'
206223 ] ;
207224
208225 const javaLoggingLines = [
209226 `if ("${ helmChartValues . javaLoggingLevel } " -ne "") {` ,
210- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingLevel=${ helmChartValues . javaLoggingLevel } "` ,
227+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingLevel=${ helmChartValues . javaLoggingLevel } "` ,
211228 '}' ,
212229 `if ("${ helmChartValues . javaLoggingFileSizeLimit } " -ne "") {` ,
213- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileSizeLimit=${ helmChartValues . javaLoggingFileSizeLimit } "` ,
230+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileSizeLimit=${ helmChartValues . javaLoggingFileSizeLimit } "` ,
214231 '}' ,
215232 `if ("${ helmChartValues . javaLoggingFileCount } " -ne "") {` ,
216- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileCount=${ helmChartValues . javaLoggingFileCount } "` ,
233+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --set javaLoggingFileCount=${ helmChartValues . javaLoggingFileCount } "` ,
217234 '}'
218235 ] ;
219236
220237 const helmTimeoutLines = [
221238 `if ("${ helmChartValues . timeout } " -ne "") {` ,
222- `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --timeout $(${ helmChartValues . timeout } )m"` ,
239+ `${ this . indent ( 1 ) } $${ variableName } = "${ variableRef } --timeout $(${ helmChartValues . timeout } )m"` ,
223240 '}' ,
224241 ] ;
225242
@@ -444,16 +461,16 @@ define(['utils/script-adapter-base'],
444461
445462 const collectVar = this . getVariableReference ( collectVariableName ) ;
446463 return [
447- `$${ collectVariableName } = ""` ,
464+ `$${ collectVariableName } = ""` ,
448465 `if ("${ ingressType } " -eq "Voyager") {` ,
449466 `${ 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 } "` ,
451468 `${ this . indent ( 1 ) } }` ,
452469 `${ 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' ] } "` ,
454471 `${ this . indent ( 1 ) } }` ,
455472 `${ 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' ] } "` ,
457474 `${ this . indent ( 1 ) } }` ,
458475 '}'
459476 ] ;
@@ -468,9 +485,9 @@ define(['utils/script-adapter-base'],
468485 return [
469486 `if ("${ useSecret } " -eq "true") {` ,
470487 `${ 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 } "` ,
472489 `${ 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 } "` ,
474491 `${ this . indent ( 1 ) } }` ,
475492 '}'
476493 ] ;
0 commit comments