Skip to content

Commit 9562f21

Browse files
committed
Merge branch 'wktui-443' into 'main'
Changing default value for WKO image See merge request weblogic-cloud/weblogic-toolkit-ui!297
2 parents 4c671f4 + dea5268 commit 9562f21

6 files changed

+39
-2
lines changed

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ define(['utils/observable-properties', 'utils/validation-helper'],
1919
this.k8sServiceAccount.addValidator(...validationHelper.getK8sNameValidators());
2020

2121
this.versionTag = props.createProperty(window.api.ipc.invoke('get-latest-wko-version-number'));
22-
23-
this.operatorImage = props.createProperty('ghcr.io/oracle/weblogic-kubernetes-operator:${1}', this.versionTag.observable);
22+
this.operatorImage = props.createProperty();
2423
const operatorImageValidators = validationHelper.getImageTagValidators();
2524
this.operatorImage.addValidator(...operatorImageValidators);
2625

webui/src/js/models/wkt-project.js

+13
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,19 @@ function (ko, wdtConstructor, imageConstructor, kubectlConstructor, domainConstr
173173
}
174174
}
175175
}
176+
177+
// Version 1.7.1 changes the operator image default from populated to empty. If the
178+
// project value is the same as what the default currently is, remove it from the project.
179+
//
180+
if ('wko' in wktProjectJson && 'image' in wktProjectJson.wko) {
181+
const currentImageValue = wktProjectJson.wko.image;
182+
const defaultImageValue =
183+
`ghcr.io/oracle/weblogic-kubernetes-operator:${window.api.ipc.invoke('get-latest-wko-version-number')}`;
184+
185+
if (currentImageValue === defaultImageValue) {
186+
delete wktProjectJson.wko.image;
187+
}
188+
}
176189
};
177190

178191
this.setFromJson = (wktProjectJson, modelContentsJson) => {

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

+8
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ define(['utils/script-adapter-base'],
208208
}
209209

210210
const variableRef = this.getVariableReference(variableName);
211+
const imageTagLines = [
212+
`IF "${helmChartValues.image}" NEQ "" (`,
213+
`${this.indent(1)}SET "${variableName}=${variableRef} --set image=${helmChartValues.image}"`,
214+
')'
215+
];
216+
211217
const serviceAccountLines = [
212218
`IF "${helmChartValues.serviceAccount}" NEQ "" (`,
213219
`${this.indent(1)}SET "${variableName}=${variableRef} --set serviceAccount=${helmChartValues.serviceAccount}"`,
@@ -298,6 +304,8 @@ define(['utils/script-adapter-base'],
298304
this._lines.push(
299305
...strategyLines,
300306
'',
307+
...imageTagLines,
308+
'',
301309
...serviceAccountLines,
302310
'',
303311
...pullSecretsLines,

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

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ define(['models/wkt-project', 'utils/script-generator-base', 'utils/helm-helper'
212212

213213
_gatherHelmChartArgs() {
214214
return {
215+
image: this.adapter.getVariableReference('WKO_IMAGE_TAG'),
215216
serviceAccount: this.adapter.getVariableReference('WKO_SERVICE_ACCOUNT'),
216217
domainNamespaceSelectionStrategy: this.adapter.getVariableReference('WKO_DOMAIN_NAMESPACE_SELECTION_STRATEGY'),
217218
domainNamespaceLabelSelector: this.adapter.getVariableReference('WKO_DOMAIN_NAMESPACE_LABEL_SELECTOR'),

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

+8
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ define(['utils/script-adapter-base'],
161161
}
162162

163163
const variableRef = this.getVariableReference(variableName);
164+
const imageTagLines = [
165+
`if ("${helmChartValues.image}" -ne "") {`,
166+
`${this.indent(1)}${variableName} = "${variableRef} --set image=${helmChartValues.image}"`,
167+
'}'
168+
];
169+
164170
const serviceAccountLines = [
165171
`if ("${helmChartValues.serviceAccount}" -ne "") {`,
166172
`${this.indent(1)}${variableName} = "${variableRef} --set serviceAccount=${helmChartValues.serviceAccount}"`,
@@ -245,6 +251,8 @@ define(['utils/script-adapter-base'],
245251
this._lines.push(
246252
...strategyLines,
247253
'',
254+
...imageTagLines,
255+
'',
248256
...serviceAccountLines,
249257
'',
250258
...pullSecretsLines,

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

+8
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ define(['utils/script-adapter-base'],
164164
}
165165

166166
const variableRef = this.getVariableReference(variableName);
167+
const imageTagLines = [
168+
`if [ "${helmChartValues.image}" != "" ]; then`,
169+
`${this.indent(1)}${variableName}="${variableRef} --set image=${helmChartValues.image}"`,
170+
'fi'
171+
];
172+
167173
const serviceAccountLines = [
168174
`if [ "${helmChartValues.serviceAccount}" != "" ]; then`,
169175
`${this.indent(1)}${variableName}="${variableRef} --set serviceAccount=${helmChartValues.serviceAccount}"`,
@@ -248,6 +254,8 @@ define(['utils/script-adapter-base'],
248254
this._lines.push(
249255
...strategyLines,
250256
'',
257+
...imageTagLines,
258+
'',
251259
...serviceAccountLines,
252260
'',
253261
...pullSecretsLines,

0 commit comments

Comments
 (0)