diff --git a/electron/app/js/helmUtils.js b/electron/app/js/helmUtils.js index f7be1f03a..5313a0692 100644 --- a/electron/app/js/helmUtils.js +++ b/electron/app/js/helmUtils.js @@ -231,12 +231,22 @@ function getHelmEnv(httpsProxyUrl, bypassProxyHosts, helmOptions) { function processHelmChartValues(args, helmChartValues) { if (helmChartValues) { for (const [propertyName, propertyValue] of Object.entries(helmChartValues)) { - if (propertyName === 'imagePullSecrets') { - args.push(...formatArrayOfObjectsSetArgument(propertyName, propertyValue)); - } else if (propertyName === 'nodeSelector') { - args.push(...formatNodeSelectorSetArgument(propertyValue)); - } else { - args.push('--set', formatSetArgument(propertyName, propertyValue)); + switch (propertyName) { + case 'imagePullSecrets': + args.push(...formatArrayOfObjectsSetArgument(propertyName, propertyValue)); + break; + + case 'nodeSelector': + args.push(...formatNodeSelectorSetArgument(propertyValue)); + break; + + case 'timeout': + args.push('--timeout', `${propertyValue}m`); + break; + + default: + args.push('--set', formatSetArgument(propertyName, propertyValue)); + break; } } } diff --git a/electron/app/locales/en/webui.json b/electron/app/locales/en/webui.json index c9a2a847c..45e7ff2e4 100644 --- a/electron/app/locales/en/webui.json +++ b/electron/app/locales/en/webui.json @@ -474,6 +474,9 @@ "wko-design-node-selector-label-value-header": "Label Value", "wko-design-node-selector-add-row-tooltip": "Add Node Selector Label", "wko-design-node-selector-delete-row-tooltip": "Delete Node Selector Label", + "wko-design-helm-settings-title": "Helm Settings", + "wko-design-helm-timeout-label": "Helm Timeout in Minutes", + "wko-design-helm-timeout-help": "The number of minutes that the Helm command will wait for the WebLogic Kubernetes Operator install or update command to complete.", "domain-page-hints-deployDomain": "Deploy WebLogic Domain to Kubernetes", "domain-page-button-deployDomain": "Deploy Domain", @@ -697,6 +700,8 @@ "ingress-design-install-ingress-controller-help": "Whether to install the selected ingress controller.", "ingress-design-ingress-name-label": "Helm Release Name to Use", "ingress-design-ingress-name-help": "The Helm release name used to install the ingress controller.", + "ingress-design-helm-timeout-label": "Helm Timeout in Minutes", + "ingress-design-helm-timeout-help": "The number of minutes that the Helm command will wait for the Ingress Controller install command to complete.", "ingress-design-ingress-namespace-label": "Ingress Controller Namespace", "ingress-design-ingress-namespace-help": "The Kubernetes namespace to use for the ingress controller.", "ingress-design-voyager-provider-label": "Kubernetes Cluster Provider for Voyager", diff --git a/webui/src/js/models/ingress-definition.js b/webui/src/js/models/ingress-definition.js index df2788dea..a68228b07 100644 --- a/webui/src/js/models/ingress-definition.js +++ b/webui/src/js/models/ingress-definition.js @@ -40,6 +40,8 @@ define(['knockout', 'utils/observable-properties', 'utils/validation-helper'], this.specifyDockerRegSecret = props.createProperty(false); this.specifyIngressTLSSecret = props.createProperty(false); + this.helmTimeoutMinutes = props.createProperty(5); + this.ingressRouteKeys = [ 'uid', 'name', 'virtualHost', 'targetServiceNameSpace', 'targetService', 'targetPort', 'path', 'annotations', 'accessPoint', 'tlsOption', 'markedForDeletion', 'isConsoleService' diff --git a/webui/src/js/models/wko-definition.js b/webui/src/js/models/wko-definition.js index 18f99d17b..8e216af3f 100644 --- a/webui/src/js/models/wko-definition.js +++ b/webui/src/js/models/wko-definition.js @@ -68,6 +68,8 @@ define(['utils/observable-properties', 'utils/validation-helper'], // this.nodeSelector = props.createListProperty(['uid', 'name', 'value']); + this.helmTimeoutMinutes = props.createProperty(5); + // internal fields that should not be read or written to the project file. this.internal = { operatorImagePullRegistryAddress: props.createProperty() diff --git a/webui/src/js/utils/cmd-script-adapter.js b/webui/src/js/utils/cmd-script-adapter.js index cdfebdbc2..bc39a2f0c 100644 --- a/webui/src/js/utils/cmd-script-adapter.js +++ b/webui/src/js/utils/cmd-script-adapter.js @@ -77,6 +77,19 @@ define(['utils/script-adapter-base'], return this.getEnvironmentVariableReference(name); } + addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) { + if (comment) { + this.addComment(comment); + } + + this._lines.push( + `IF DEFINED ${this._getVariableNameFromReference(timeoutVarRef)} (`, + `${this.indent(1)}SET "${collectVarName}=${this.getVariableReference(collectVarName)} ${timeoutVarRef}m"`, + ')', + '' + ); + } + addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) { let value = `"${varRef}"`; if (valuePrefix) { @@ -256,6 +269,12 @@ define(['utils/script-adapter-base'], ')' ]; + const helmTimeoutLines = [ + `IF "${helmChartValues.timeout}" NEQ "" (`, + `${this.indent(1)}SET "${variableName}=${variableRef} --timeout ${helmChartValues.timeout}m"`, + ')', + ]; + const initialValue = `--set domainNamespaceSelectionStrategy=${helmChartValues.domainNamespaceSelectionStrategy}`; this.addVariableDefinition(variableName, initialValue); this._lines.push( @@ -274,6 +293,8 @@ define(['utils/script-adapter-base'], ...elkIntegrationLines, '', ...javaLoggingLines, + '', + ...helmTimeoutLines, '' ); } diff --git a/webui/src/js/utils/ingress-controller-installer.js b/webui/src/js/utils/ingress-controller-installer.js index 1f8460c79..fd042321d 100644 --- a/webui/src/js/utils/ingress-controller-installer.js +++ b/webui/src/js/utils/ingress-controller-installer.js @@ -249,6 +249,10 @@ function(IngressActionsBase, project, wktConsole, k8sHelper, i18n, dialogHelper, if (ingressControllerProvider === 'nginx' && this.project.ingress.allowNginxSSLPassThrough) { helmChartData['controller.extraArgs.enable-ssl-passthrough'] = true; } + + if (this.project.ingress.helmTimeoutMinutes.hasValue()) { + helmChartData['timeout'] = this.project.ingress.helmTimeoutMinutes.value; + } return helmChartData; } } diff --git a/webui/src/js/utils/ingress-install-script-generator.js b/webui/src/js/utils/ingress-install-script-generator.js index b419bb41f..d9386b67a 100644 --- a/webui/src/js/utils/ingress-install-script-generator.js +++ b/webui/src/js/utils/ingress-install-script-generator.js @@ -62,6 +62,11 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper' this.adapter.addVariableDefinition('DOCKER_HUB_EMAIL', this.project.ingress.dockerRegSecretUserEmail.value); this.adapter.addEmptyLine(); + comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ]; + this.adapter.addVariableDefinition('HELM_TIMEOUT', + this._getOptionalScalarFieldValue(this.project.ingress.helmTimeoutMinutes), comment); + this.adapter.addEmptyLine(); + this.adapter.addVariableEndBanner(); this.adapter.addKubectlExportAndUseContextBlock(); @@ -98,6 +103,10 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper' this.adapter.addVoyagerHelmChartArgsBlock(comment, ingressControllerType, voyagerProvider, voyagerApiEnableHealthCheck, voyagerApiEnableWebhook); + comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ]; + const helmTimeout = this.adapter.getVariableReference('HELM_TIMEOUT'); + this.adapter.addIngressHelmChartTimeoutArgBlock(comment, helmTimeout); + comment = [ 'Add Docker Hub pull secret, if specified' ]; this.adapter.addIngressHelmChartPullSecretArgBlock(comment, ingressControllerType, useDockerHubSecret, dockerHubSecretName); @@ -121,6 +130,14 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper' this.adapter.addScriptFooter(); return this.adapter.getScript(); } + + _getOptionalScalarFieldValue(property) { + let result = ''; + if (this._isSet(property)) { + result = property.value; + } + return result; + } } return IngressInstallScriptGenerator; diff --git a/webui/src/js/utils/operator-script-generator.js b/webui/src/js/utils/operator-script-generator.js index f47642f8f..eed363b38 100644 --- a/webui/src/js/utils/operator-script-generator.js +++ b/webui/src/js/utils/operator-script-generator.js @@ -125,6 +125,11 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper' this._getOptionalScalarFieldValue(this.project.wko.javaLoggingFileCount), comment); this.adapter.addEmptyLine(); + comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ]; + this.adapter.addVariableDefinition('HELM_TIMEOUT', + this._getOptionalScalarFieldValue(this.project.wko.helmTimeoutMinutes), comment); + this.adapter.addEmptyLine(); + this.adapter.addVariableEndBanner(); const wkoHelmChartData = helmHelper.getOperatorHelmChartData(); @@ -224,7 +229,8 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper' elasticSearchPort: this.adapter.getVariableReference('WKO_ELASTICSEARCH_PORT'), javaLoggingLevel: this.adapter.getVariableReference('WKO_JAVA_LOGGING_LEVEL'), javaLoggingFileSizeLimit: this.adapter.getVariableReference('WKO_JAVA_LOGGING_FILE_SIZE_LIMIT'), - javaLoggingFileCount: this.adapter.getVariableReference('WKO_JAVA_LOGGING_FILE_COUNT') + javaLoggingFileCount: this.adapter.getVariableReference('WKO_JAVA_LOGGING_FILE_COUNT'), + timeout: this.adapter.getVariableReference('HELM_TIMEOUT'), }; } diff --git a/webui/src/js/utils/powershell-script-adapter.js b/webui/src/js/utils/powershell-script-adapter.js index ee3013341..6bd0e36b6 100644 --- a/webui/src/js/utils/powershell-script-adapter.js +++ b/webui/src/js/utils/powershell-script-adapter.js @@ -50,6 +50,19 @@ define(['utils/script-adapter-base'], return `$${name}`; } + addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) { + if (comment) { + this.addComment(comment); + } + + this._lines.push( + `if ("${timeoutVarRef}" -ne "") {`, + `${this.indent(1)}$${collectVarName} = "${this.getVariableReference(collectVarName)} $(${timeoutVarRef})m"`, + '}', + '' + ); + } + addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) { let value = `""${varRef}""`; if (valuePrefix) { @@ -204,6 +217,12 @@ define(['utils/script-adapter-base'], '}' ]; + const helmTimeoutLines = [ + `if ("${helmChartValues.timeout}" -ne "") {`, + `${this.indent(1)}$${variableName}="${variableRef} --timeout $(${helmChartValues.timeout})m"`, + '}', + ]; + const initialValue = `--set domainNamespaceSelectionStrategy=${helmChartValues.domainNamespaceSelectionStrategy}`; this.addVariableDefinition(variableName, initialValue); this._lines.push( @@ -222,6 +241,8 @@ define(['utils/script-adapter-base'], ...elkIntegrationLines, '', ...javaLoggingLines, + '', + ...helmTimeoutLines, '' ); } diff --git a/webui/src/js/utils/script-adapter-base.js b/webui/src/js/utils/script-adapter-base.js index 5e7e6a5af..a1fc1a054 100644 --- a/webui/src/js/utils/script-adapter-base.js +++ b/webui/src/js/utils/script-adapter-base.js @@ -335,6 +335,10 @@ define([], this._lines.push(...this._formatVoyagerHelmChartArgsBlock(comment, 'HELM_CHART_ARGS', ingressType, options), ''); } + addIngressHelmChartTimeoutArgBlock(comment, timeoutArg) { + this.addHelmTimeoutCollectArgsBlock(comment, 'HELM_CHART_ARGS', timeoutArg); + } + addIngressHelmChartPullSecretArgBlock(comment, ingressType, useSecret, secretName) { this._lines.push(...this._formatIngressHelmChartPullSecretBlock(comment, 'HELM_CHART_ARGS', ingressType, useSecret, secretName), ''); @@ -431,6 +435,11 @@ define([], /* subclasses must implement. */ } + // eslint-disable-next-line no-unused-vars + addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) { + /* subclasses must implement. */ + } + // eslint-disable-next-line no-unused-vars addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) { /* subclasses must implement. */ diff --git a/webui/src/js/utils/sh-script-adapter.js b/webui/src/js/utils/sh-script-adapter.js index 8b97ea198..1e9c938be 100644 --- a/webui/src/js/utils/sh-script-adapter.js +++ b/webui/src/js/utils/sh-script-adapter.js @@ -54,6 +54,19 @@ define(['utils/script-adapter-base'], this._lines.push(...block, ''); } + addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) { + if (comment) { + this.addComment(comment); + } + + this._lines.push( + `if [ "${timeoutVarRef}" != "" ]; then`, + `${this.indent(1)}${collectVarName}="${this.getVariableReference(collectVarName)} ${timeoutVarRef}m"`, + 'fi', + '' + ); + } + addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) { let value = `"${varRef}"`; if (valuePrefix) { @@ -207,6 +220,12 @@ define(['utils/script-adapter-base'], 'fi' ]; + const helmTimeoutLines = [ + `if [ "${helmChartValues.timeout}" != "" ]; then`, + `${this.indent(1)}${variableName}="${variableRef} --timeout ${helmChartValues.timeout}m"`, + 'fi', + ]; + const initialValue = `--set domainNamespaceSelectionStrategy=${helmChartValues.domainNamespaceSelectionStrategy}`; this.addVariableDefinition(variableName, initialValue); this._lines.push( @@ -225,6 +244,8 @@ define(['utils/script-adapter-base'], ...elkIntegrationLines, '', ...javaLoggingLines, + '', + ...helmTimeoutLines, '' ); } diff --git a/webui/src/js/utils/wko-actions-base.js b/webui/src/js/utils/wko-actions-base.js index 9d9430c67..199bdf22a 100644 --- a/webui/src/js/utils/wko-actions-base.js +++ b/webui/src/js/utils/wko-actions-base.js @@ -205,6 +205,7 @@ function(WktActionsBase, project, wktConsole, i18n, projectIo, dialogHelper, val this.addHelmChartValueIfSet(helmChartValues, 'enableClusterRoleBinding', this.project.wko.enableClusterRoleBinding); this.addHelmChartValueIfSet(helmChartValues, 'image', this.project.wko.operatorImage); this.addHelmChartValueIfSet(helmChartValues, 'imagePullPolicy', this.project.wko.operatorImagePullPolicy); + this.addHelmChartValueIfSet(helmChartValues, 'timeout', this.project.wko.helmTimeoutMinutes); if (this.project.wko.operatorImagePullRequiresAuthentication.value) { const imagePullSecret = this.project.wko.operatorImagePullSecretName.value; diff --git a/webui/src/js/views/ingress-design-view.html b/webui/src/js/views/ingress-design-view.html index b98dbe6a6..194047d8d 100644 --- a/webui/src/js/views/ingress-design-view.html +++ b/webui/src/js/views/ingress-design-view.html @@ -32,6 +32,12 @@