Skip to content

Commit 22dc8ff

Browse files
committed
Merge branch 'wktui-412' into 'main'
adding service type to ingress controller installation See merge request weblogic-cloud/weblogic-toolkit-ui!245
2 parents 641bc4a + 41fab37 commit 22dc8ff

11 files changed

+133
-35
lines changed

electron/app/locales/en/webui.json

+6
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,16 @@
730730
"ingress-design-type-nginx-label": "Nginx",
731731
"ingress-design-type-traefik-label": "Traefik",
732732
"ingress-design-type-voyager-label": "Voyager",
733+
"ingress-design-service-type-load-balancer-label": "Load Balancer",
734+
"ingress-design-service-type-node-port-label": "Node Port",
735+
"ingress-design-service-type-cluster-ip-label": "Cluster IP",
736+
"ingress-design-service-type-external-name-label": "External Name",
733737
"ingress-design-install-ingress-controller-label": "Install Ingress Controller",
734738
"ingress-design-install-ingress-controller-help": "Whether to install the selected ingress controller.",
735739
"ingress-design-ingress-name-label": "Helm Release Name to Use",
736740
"ingress-design-ingress-name-help": "The Helm release name used to install the ingress controller.",
741+
"ingress-design-ingress-service-type-label": "Ingress Controller Service Type",
742+
"ingress-design-ingress-service-type-help": "The type of service used in front of the ingress controller to make it accessible. This should only be changed if installing an a Kubernetes cluster without an external load balancer, in which case you should typically choose Node Port.",
737743
"ingress-design-helm-timeout-label": "Helm Timeout in Minutes",
738744
"ingress-design-helm-timeout-help": "The number of minutes that the Helm command will wait for the Ingress Controller install command to complete.",
739745
"ingress-design-ingress-namespace-label": "Ingress Controller Namespace",

webui/src/js/models/ingress-definition.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright (c) 2021, Oracle and/or its affiliates.
3+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates.
44
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
*/
66
'use strict';
@@ -41,6 +41,7 @@ define(['knockout', 'utils/observable-properties', 'utils/validation-helper'],
4141
this.specifyIngressTLSSecret = props.createProperty(false);
4242

4343
this.helmTimeoutMinutes = props.createProperty(5);
44+
this.ingressServiceType = props.createProperty('LoadBalancer');
4445

4546
this.ingressRouteKeys = [
4647
'uid', 'name', 'virtualHost', 'targetServiceNameSpace', 'targetService', 'targetPort',

webui/src/js/utils/cmd-script-adapter.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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';
@@ -77,6 +77,24 @@ define(['utils/script-adapter-base'],
7777
return this.getEnvironmentVariableReference(name);
7878
}
7979

80+
addHelmServiceTypeCollectArgsBlock(comment, collectVarName, ingressControllerTypeVarRef, serviceTypeVarRef) {
81+
if (comment) {
82+
this.addComment(comment);
83+
}
84+
85+
this._lines.push(
86+
`IF "${serviceTypeVarRef}" == "LoadBalancer" (`,
87+
`${this.indent(1)}IF "${ingressControllerTypeVarRef}" == "traefik" (`,
88+
`${this.indent(2)}SET "${collectVarName}=${this.getVariableReference(collectVarName)} --set service.type=${serviceTypeVarRef}"`,
89+
`${this.indent(1)})`,
90+
`${this.indent(1)}IF "${ingressControllerTypeVarRef}" == "nginx) ("`,
91+
`${this.indent(2)}SET "${collectVarName}=${this.getVariableReference(collectVarName)} --set controller.service.type=${serviceTypeVarRef}"`,
92+
`${this.indent(1)})`,
93+
')',
94+
''
95+
);
96+
}
97+
8098
addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) {
8199
if (comment) {
82100
this.addComment(comment);

webui/src/js/utils/ingress-controller-installer.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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 v 1.0 as shown at https://oss.oracle.com/licenses/upl.
55
*/
66
'use strict';
@@ -253,6 +253,14 @@ function(IngressActionsBase, project, wktConsole, k8sHelper, i18n, dialogHelper,
253253
helmChartData['controller.extraArgs.enable-ssl-passthrough'] = true;
254254
}
255255

256+
if (this.project.ingress.ingressServiceType.hasValue()) {
257+
if (ingressControllerProvider === 'traefik') {
258+
helmChartData['service.type'] = this.project.ingress.ingressServiceType.value;
259+
} else if (ingressControllerProvider === 'nginx') {
260+
helmChartData['controller.service.type'] = this.project.ingress.ingressServiceType.value;
261+
}
262+
}
263+
256264
if (this.project.ingress.helmTimeoutMinutes.hasValue()) {
257265
helmChartData['timeout'] = this.project.ingress.helmTimeoutMinutes.value;
258266
}

webui/src/js/utils/ingress-install-script-generator.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright (c) 2021, 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';
@@ -62,6 +62,11 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
6262
this.adapter.addVariableDefinition('DOCKER_HUB_EMAIL', this.project.ingress.dockerRegSecretUserEmail.value);
6363
this.adapter.addEmptyLine();
6464

65+
comment = [ 'If not using an external load balancer, the ingress controller service type to use (e.g., NodePort)' ];
66+
this.adapter.addVariableDefinition('SERVICE_TYPE',
67+
this._getOptionalScalarFieldValue(this.project.ingress.ingressServiceType), comment);
68+
this.adapter.addEmptyLine();
69+
6570
comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ];
6671
this.adapter.addVariableDefinition('HELM_TIMEOUT',
6772
this._getOptionalScalarFieldValue(this.project.ingress.helmTimeoutMinutes), comment);
@@ -78,7 +83,7 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
7883
let alreadyExistsMessage = `Namespace ${ingressNamespace} already exists`;
7984
this.adapter.addCreateNamespaceBlock(comment, kubectlExe, ingressNamespace, createErrorMessage, alreadyExistsMessage);
8085

81-
comment = [ ' Create Docker Hub credentials secret, if needed.' ];
86+
comment = [ 'Create Docker Hub credentials secret, if needed.' ];
8287
const useDockerHubSecret = this.adapter.getVariableReference('USE_DOCKER_HUB_SECRET');
8388
const useExistingDockerHubSecret = this.adapter.getVariableReference('USE_EXISTING_DOCKER_HUB_SECRET');
8489
const dockerHubSecretName = this.adapter.getVariableReference('DOCKER_HUB_SECRET_NAME');
@@ -103,6 +108,10 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
103108
this.adapter.addVoyagerHelmChartArgsBlock(comment, ingressControllerType, voyagerProvider,
104109
voyagerApiEnableHealthCheck, voyagerApiEnableWebhook);
105110

111+
comment = [ 'If not using an external load balancer, set the service type for the ingress controller' ];
112+
const serviceType = this.adapter.getVariableReference('SERVICE_TYPE');
113+
this.adapter.addIngressServiceTypeArgBlock(comment, ingressControllerType, serviceType);
114+
106115
comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ];
107116
const helmTimeout = this.adapter.getVariableReference('HELM_TIMEOUT');
108117
this.adapter.addIngressHelmChartTimeoutArgBlock(comment, helmTimeout);

webui/src/js/utils/ingress-routes-updater.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ function(IngressActionsBase, project, wktConsole, k8sHelper, i18n, projectIo, di
431431
//
432432
let found = false;
433433
for (const item of results.serviceDetails.items) {
434-
if (item.spec['type'] === 'LoadBalancer') {
434+
if (item.spec['type'] === 'LoadBalancer' || item.spec['type'] === 'NodePort') {
435435
serviceDetail = item;
436436
found = true;
437437
break;
@@ -443,7 +443,7 @@ function(IngressActionsBase, project, wktConsole, k8sHelper, i18n, projectIo, di
443443
}
444444
}
445445
// For Voyager it may be a nodepot service if the voyagerProvider is 'baremetal'
446-
if (serviceDetail.spec['type'] === 'LoadBalancer' ||
446+
if (serviceDetail.spec['type'] === 'LoadBalancer' || serviceDetail.spec['type'] === 'NodePort' ||
447447
(ingressControllerProvider === 'voyager' && serviceDetail.spec['type'] === 'NodePort')) {
448448
if ('loadBalancer' in serviceDetail.status) {
449449
if (JSON.stringify(serviceDetail.status.loadBalancer) === '{}') {

webui/src/js/utils/powershell-script-adapter.js

+42-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

Comments
 (0)