Skip to content

Commit d332fe3

Browse files
adding helm timeout field for operator/ingress install/update (#166)
* adding helm timeout field for operator install/update * adding helm timeout for ingress controller
1 parent a49016c commit d332fe3

14 files changed

+143
-7
lines changed

electron/app/js/helmUtils.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,22 @@ function getHelmEnv(httpsProxyUrl, bypassProxyHosts, helmOptions) {
231231
function processHelmChartValues(args, helmChartValues) {
232232
if (helmChartValues) {
233233
for (const [propertyName, propertyValue] of Object.entries(helmChartValues)) {
234-
if (propertyName === 'imagePullSecrets') {
235-
args.push(...formatArrayOfObjectsSetArgument(propertyName, propertyValue));
236-
} else if (propertyName === 'nodeSelector') {
237-
args.push(...formatNodeSelectorSetArgument(propertyValue));
238-
} else {
239-
args.push('--set', formatSetArgument(propertyName, propertyValue));
234+
switch (propertyName) {
235+
case 'imagePullSecrets':
236+
args.push(...formatArrayOfObjectsSetArgument(propertyName, propertyValue));
237+
break;
238+
239+
case 'nodeSelector':
240+
args.push(...formatNodeSelectorSetArgument(propertyValue));
241+
break;
242+
243+
case 'timeout':
244+
args.push('--timeout', `${propertyValue}m`);
245+
break;
246+
247+
default:
248+
args.push('--set', formatSetArgument(propertyName, propertyValue));
249+
break;
240250
}
241251
}
242252
}

electron/app/locales/en/webui.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,9 @@
474474
"wko-design-node-selector-label-value-header": "Label Value",
475475
"wko-design-node-selector-add-row-tooltip": "Add Node Selector Label",
476476
"wko-design-node-selector-delete-row-tooltip": "Delete Node Selector Label",
477+
"wko-design-helm-settings-title": "Helm Settings",
478+
"wko-design-helm-timeout-label": "Helm Timeout in Minutes",
479+
"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.",
477480

478481
"domain-page-hints-deployDomain": "Deploy WebLogic Domain to Kubernetes",
479482
"domain-page-button-deployDomain": "Deploy Domain",
@@ -697,6 +700,8 @@
697700
"ingress-design-install-ingress-controller-help": "Whether to install the selected ingress controller.",
698701
"ingress-design-ingress-name-label": "Helm Release Name to Use",
699702
"ingress-design-ingress-name-help": "The Helm release name used to install the ingress controller.",
703+
"ingress-design-helm-timeout-label": "Helm Timeout in Minutes",
704+
"ingress-design-helm-timeout-help": "The number of minutes that the Helm command will wait for the Ingress Controller install command to complete.",
700705
"ingress-design-ingress-namespace-label": "Ingress Controller Namespace",
701706
"ingress-design-ingress-namespace-help": "The Kubernetes namespace to use for the ingress controller.",
702707
"ingress-design-voyager-provider-label": "Kubernetes Cluster Provider for Voyager",

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ define(['knockout', 'utils/observable-properties', 'utils/validation-helper'],
4040
this.specifyDockerRegSecret = props.createProperty(false);
4141
this.specifyIngressTLSSecret = props.createProperty(false);
4242

43+
this.helmTimeoutMinutes = props.createProperty(5);
44+
4345
this.ingressRouteKeys = [
4446
'uid', 'name', 'virtualHost', 'targetServiceNameSpace', 'targetService', 'targetPort',
4547
'path', 'annotations', 'accessPoint', 'tlsOption', 'markedForDeletion', 'isConsoleService'

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ define(['utils/observable-properties', 'utils/validation-helper'],
6868
//
6969
this.nodeSelector = props.createListProperty(['uid', 'name', 'value']);
7070

71+
this.helmTimeoutMinutes = props.createProperty(5);
72+
7173
// internal fields that should not be read or written to the project file.
7274
this.internal = {
7375
operatorImagePullRegistryAddress: props.createProperty()

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ define(['utils/script-adapter-base'],
7777
return this.getEnvironmentVariableReference(name);
7878
}
7979

80+
addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) {
81+
if (comment) {
82+
this.addComment(comment);
83+
}
84+
85+
this._lines.push(
86+
`IF DEFINED ${this._getVariableNameFromReference(timeoutVarRef)} (`,
87+
`${this.indent(1)}SET "${collectVarName}=${this.getVariableReference(collectVarName)} ${timeoutVarRef}m"`,
88+
')',
89+
''
90+
);
91+
}
92+
8093
addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) {
8194
let value = `"${varRef}"`;
8295
if (valuePrefix) {
@@ -256,6 +269,12 @@ define(['utils/script-adapter-base'],
256269
')'
257270
];
258271

272+
const helmTimeoutLines = [
273+
`IF "${helmChartValues.timeout}" NEQ "" (`,
274+
`${this.indent(1)}SET "${variableName}=${variableRef} --timeout ${helmChartValues.timeout}m"`,
275+
')',
276+
];
277+
259278
const initialValue = `--set domainNamespaceSelectionStrategy=${helmChartValues.domainNamespaceSelectionStrategy}`;
260279
this.addVariableDefinition(variableName, initialValue);
261280
this._lines.push(
@@ -274,6 +293,8 @@ define(['utils/script-adapter-base'],
274293
...elkIntegrationLines,
275294
'',
276295
...javaLoggingLines,
296+
'',
297+
...helmTimeoutLines,
277298
''
278299
);
279300
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ function(IngressActionsBase, project, wktConsole, k8sHelper, i18n, dialogHelper,
249249
if (ingressControllerProvider === 'nginx' && this.project.ingress.allowNginxSSLPassThrough) {
250250
helmChartData['controller.extraArgs.enable-ssl-passthrough'] = true;
251251
}
252+
253+
if (this.project.ingress.helmTimeoutMinutes.hasValue()) {
254+
helmChartData['timeout'] = this.project.ingress.helmTimeoutMinutes.value;
255+
}
252256
return helmChartData;
253257
}
254258
}

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ];
66+
this.adapter.addVariableDefinition('HELM_TIMEOUT',
67+
this._getOptionalScalarFieldValue(this.project.ingress.helmTimeoutMinutes), comment);
68+
this.adapter.addEmptyLine();
69+
6570
this.adapter.addVariableEndBanner();
6671

6772
this.adapter.addKubectlExportAndUseContextBlock();
@@ -98,6 +103,10 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
98103
this.adapter.addVoyagerHelmChartArgsBlock(comment, ingressControllerType, voyagerProvider,
99104
voyagerApiEnableHealthCheck, voyagerApiEnableWebhook);
100105

106+
comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ];
107+
const helmTimeout = this.adapter.getVariableReference('HELM_TIMEOUT');
108+
this.adapter.addIngressHelmChartTimeoutArgBlock(comment, helmTimeout);
109+
101110
comment = [ 'Add Docker Hub pull secret, if specified' ];
102111
this.adapter.addIngressHelmChartPullSecretArgBlock(comment, ingressControllerType, useDockerHubSecret,
103112
dockerHubSecretName);
@@ -121,6 +130,14 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
121130
this.adapter.addScriptFooter();
122131
return this.adapter.getScript();
123132
}
133+
134+
_getOptionalScalarFieldValue(property) {
135+
let result = '';
136+
if (this._isSet(property)) {
137+
result = property.value;
138+
}
139+
return result;
140+
}
124141
}
125142

126143
return IngressInstallScriptGenerator;

webui/src/js/utils/operator-script-generator.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
125125
this._getOptionalScalarFieldValue(this.project.wko.javaLoggingFileCount), comment);
126126
this.adapter.addEmptyLine();
127127

128+
comment = [ 'The number of minutes for the helm command to wait for completion (e.g., 10)' ];
129+
this.adapter.addVariableDefinition('HELM_TIMEOUT',
130+
this._getOptionalScalarFieldValue(this.project.wko.helmTimeoutMinutes), comment);
131+
this.adapter.addEmptyLine();
132+
128133
this.adapter.addVariableEndBanner();
129134

130135
const wkoHelmChartData = helmHelper.getOperatorHelmChartData();
@@ -224,7 +229,8 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
224229
elasticSearchPort: this.adapter.getVariableReference('WKO_ELASTICSEARCH_PORT'),
225230
javaLoggingLevel: this.adapter.getVariableReference('WKO_JAVA_LOGGING_LEVEL'),
226231
javaLoggingFileSizeLimit: this.adapter.getVariableReference('WKO_JAVA_LOGGING_FILE_SIZE_LIMIT'),
227-
javaLoggingFileCount: this.adapter.getVariableReference('WKO_JAVA_LOGGING_FILE_COUNT')
232+
javaLoggingFileCount: this.adapter.getVariableReference('WKO_JAVA_LOGGING_FILE_COUNT'),
233+
timeout: this.adapter.getVariableReference('HELM_TIMEOUT'),
228234
};
229235
}
230236

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ define(['utils/script-adapter-base'],
5050
return `$${name}`;
5151
}
5252

53+
addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) {
54+
if (comment) {
55+
this.addComment(comment);
56+
}
57+
58+
this._lines.push(
59+
`if ("${timeoutVarRef}" -ne "") {`,
60+
`${this.indent(1)}$${collectVarName} = "${this.getVariableReference(collectVarName)} $(${timeoutVarRef})m"`,
61+
'}',
62+
''
63+
);
64+
}
65+
5366
addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) {
5467
let value = `""${varRef}""`;
5568
if (valuePrefix) {
@@ -204,6 +217,12 @@ define(['utils/script-adapter-base'],
204217
'}'
205218
];
206219

220+
const helmTimeoutLines = [
221+
`if ("${helmChartValues.timeout}" -ne "") {`,
222+
`${this.indent(1)}$${variableName}="${variableRef} --timeout $(${helmChartValues.timeout})m"`,
223+
'}',
224+
];
225+
207226
const initialValue = `--set domainNamespaceSelectionStrategy=${helmChartValues.domainNamespaceSelectionStrategy}`;
208227
this.addVariableDefinition(variableName, initialValue);
209228
this._lines.push(
@@ -222,6 +241,8 @@ define(['utils/script-adapter-base'],
222241
...elkIntegrationLines,
223242
'',
224243
...javaLoggingLines,
244+
'',
245+
...helmTimeoutLines,
225246
''
226247
);
227248
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ define([],
335335
this._lines.push(...this._formatVoyagerHelmChartArgsBlock(comment, 'HELM_CHART_ARGS', ingressType, options), '');
336336
}
337337

338+
addIngressHelmChartTimeoutArgBlock(comment, timeoutArg) {
339+
this.addHelmTimeoutCollectArgsBlock(comment, 'HELM_CHART_ARGS', timeoutArg);
340+
}
341+
338342
addIngressHelmChartPullSecretArgBlock(comment, ingressType, useSecret, secretName) {
339343
this._lines.push(...this._formatIngressHelmChartPullSecretBlock(comment, 'HELM_CHART_ARGS',
340344
ingressType, useSecret, secretName), '');
@@ -431,6 +435,11 @@ define([],
431435
/* subclasses must implement. */
432436
}
433437

438+
// eslint-disable-next-line no-unused-vars
439+
addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) {
440+
/* subclasses must implement. */
441+
}
442+
434443
// eslint-disable-next-line no-unused-vars
435444
addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) {
436445
/* subclasses must implement. */

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ define(['utils/script-adapter-base'],
5454
this._lines.push(...block, '');
5555
}
5656

57+
addHelmTimeoutCollectArgsBlock(comment, collectVarName, timeoutVarRef) {
58+
if (comment) {
59+
this.addComment(comment);
60+
}
61+
62+
this._lines.push(
63+
`if [ "${timeoutVarRef}" != "" ]; then`,
64+
`${this.indent(1)}${collectVarName}="${this.getVariableReference(collectVarName)} ${timeoutVarRef}m"`,
65+
'fi',
66+
''
67+
);
68+
}
69+
5770
addNotEmptyCollectArgsBlock(collectVarName, varRef, valuePrefix) {
5871
let value = `"${varRef}"`;
5972
if (valuePrefix) {
@@ -207,6 +220,12 @@ define(['utils/script-adapter-base'],
207220
'fi'
208221
];
209222

223+
const helmTimeoutLines = [
224+
`if [ "${helmChartValues.timeout}" != "" ]; then`,
225+
`${this.indent(1)}${variableName}="${variableRef} --timeout ${helmChartValues.timeout}m"`,
226+
'fi',
227+
];
228+
210229
const initialValue = `--set domainNamespaceSelectionStrategy=${helmChartValues.domainNamespaceSelectionStrategy}`;
211230
this.addVariableDefinition(variableName, initialValue);
212231
this._lines.push(
@@ -225,6 +244,8 @@ define(['utils/script-adapter-base'],
225244
...elkIntegrationLines,
226245
'',
227246
...javaLoggingLines,
247+
'',
248+
...helmTimeoutLines,
228249
''
229250
);
230251
}

webui/src/js/utils/wko-actions-base.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ function(WktActionsBase, project, wktConsole, i18n, projectIo, dialogHelper, val
205205
this.addHelmChartValueIfSet(helmChartValues, 'enableClusterRoleBinding', this.project.wko.enableClusterRoleBinding);
206206
this.addHelmChartValueIfSet(helmChartValues, 'image', this.project.wko.operatorImage);
207207
this.addHelmChartValueIfSet(helmChartValues, 'imagePullPolicy', this.project.wko.operatorImagePullPolicy);
208+
this.addHelmChartValueIfSet(helmChartValues, 'timeout', this.project.wko.helmTimeoutMinutes);
208209

209210
if (this.project.wko.operatorImagePullRequiresAuthentication.value) {
210211
const imagePullSecret = this.project.wko.operatorImagePullSecretName.value;

webui/src/js/views/ingress-design-view.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ <h6 class="wkt-subheading">
3232
validators="[[project.ingress.validators.k8sNameValidator]]"
3333
help.instruction="[[labelMapper('ingress-name-help')]]">
3434
</oj-input-text>
35+
<oj-input-number label-hint="[[labelMapper('helm-timeout-label')]]"
36+
value="{{project.ingress.helmTimeoutMinutes.observable}}"
37+
min="1"
38+
max="60"
39+
help.instruction="[[labelMapper('helm-timeout-help')]]">
40+
</oj-input-number>
3541
<oj-bind-if test="[[isVoyager() === true]]">
3642
<oj-select-single label-hint="[[labelMapper('voyager-provider-label')]]"
3743
value="{{project.ingress.voyagerProvider.observable}}"

webui/src/js/views/operator-design-view.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,4 +263,15 @@ <h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('node-selector-tit
263263
</template>
264264
</oj-table>
265265
</div>
266+
<div class="oj-panel">
267+
<h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('helm-settings-title')]]"></oj-bind-text></h6>
268+
<oj-form-layout max-columns="2" direction="column">
269+
<oj-input-number label-hint="[[labelMapper('helm-timeout-label')]]"
270+
value="{{project.wko.helmTimeoutMinutes.observable}}"
271+
min="1"
272+
max="60"
273+
help.instruction="[[labelMapper('helm-timeout-help')]]">
274+
</oj-input-number>
275+
</oj-form-layout>
276+
</div>
266277
</oj-collapsible>

0 commit comments

Comments
 (0)