diff --git a/electron/app/locales/en/webui.json b/electron/app/locales/en/webui.json index 0bb42980e..08d5acb8f 100644 --- a/electron/app/locales/en/webui.json +++ b/electron/app/locales/en/webui.json @@ -542,6 +542,10 @@ "domain-design-image-registry-address-help": "The image registry hostname and port to use to log in to the registry, if required. This field's value is parsed from the Primary Image Tag field and an empty value assumes Docker Hub is the registry being used.", "domain-design-image-pull-policy-label": "Primary Image Pull Policy", "domain-design-image-pull-policy-help": "When to pull the domain's primary image from the image registry.", + "domain-design-image-wdt-install-home-label": "WebLogic Deploy Tooling Install Home in Primary Image", + "domain-design-image-wdt-install-home-help": "The location of the WebLogic Deploy Tooling installation within the primary image.", + "domain-design-image-model-home-label": "WebLogic Deploy Tooling Model Home in Primary Image", + "domain-design-image-model-home-help": "The directory location of the WebLogic Deploy Tooling model files within the primary image.", "domain-design-image-registry-pull-requires-authentication-label": "Specify Image Pull Credentials", "domain-design-image-registry-pull-requires-authentication-help": "Whether you want to specify authentication credentials for pulling the image from the registry.", "domain-design-image-registry-use-existing-pull-secret-label": "Use Existing Image Pull Secret", diff --git a/webui/src/js/models/k8s-domain-definition.js b/webui/src/js/models/k8s-domain-definition.js index 6c3780f5a..2b91d1b0c 100644 --- a/webui/src/js/models/k8s-domain-definition.js +++ b/webui/src/js/models/k8s-domain-definition.js @@ -46,6 +46,13 @@ define(['knockout', 'utils/observable-properties', 'utils/common-utilities', 'ut this.imagePullPolicy = props.createProperty('IfNotPresent'); + // These fields are exposed to the user only when using an existing Primary Image and + // not using an Auxiliary Image at all. + // + this.imageModelHome = props.createProperty('/u01/wdt/models'); + this.imageWDTInstallHome = props.createProperty('/u01/wdt/weblogic-deploy'); + + // Auxiliary image-related properties this.auxImageRegistryPullRequireAuthentication = props.createProperty(false); this.auxImageRegistryUseExistingPullSecret = props.createProperty(true); @@ -56,6 +63,9 @@ define(['knockout', 'utils/observable-properties', 'utils/common-utilities', 'ut this.auxImageRegistryPullEmail = props.createProperty(); this.auxImageRegistryPullEmail.addValidator(...validationHelper.getEmailAddressValidators()); this.auxImagePullPolicy = props.createProperty('IfNotPresent'); + + // These fields are exposed to the user only when using an existing Auxiliary Image. + // this.auxImageSourceModelHome = props.createProperty('/auxiliary/models'); this.auxImageSourceWDTInstallHome = props.createProperty('/auxiliary/weblogic-deploy'); diff --git a/webui/src/js/utils/k8s-domain-v8-resource-generator.js b/webui/src/js/utils/k8s-domain-v8-resource-generator.js index d5908fe32..4bddb6da6 100644 --- a/webui/src/js/utils/k8s-domain-v8-resource-generator.js +++ b/webui/src/js/utils/k8s-domain-v8-resource-generator.js @@ -139,7 +139,7 @@ function(project, K8sDomainConfigMapGenerator, jsYaml, i18n) { } else { // Only set these if they are specified; otherwise, rely on the default values if (wdtRelatedPaths.wdtHome) { - domainResource.spec.configuration.model.wdtHome = wdtRelatedPaths.wdtHome; + domainResource.spec.configuration.model.wdtInstallHome = wdtRelatedPaths.wdtHome; } if (wdtRelatedPaths.modelHome) { domainResource.spec.configuration.model.modelHome = wdtRelatedPaths.modelHome; @@ -216,19 +216,39 @@ function(project, K8sDomainConfigMapGenerator, jsYaml, i18n) { result = { }; if (usingAuxImage()) { - const wdtHome = this.project.image.wdtHomePath.value; - const modelHome = this.project.image.modelHomePath.value; + let wdtHome; + let modelHome; + if (creatingAuxImage()) { + wdtHome = this.project.image.wdtHomePath.value; + modelHome = this.project.image.modelHomePath.value; + } else { + modelHome = this.project.k8sDomain.auxImageSourceModelHome.value; + wdtHome = this.project.k8sDomain.auxImageSourceWDTInstallHome.value; + const match = wdtHome.match(/(\/.+?)\/weblogic-deploy\/?/); + if (match) { + wdtHome = match[1]; + } + } result.targetWdtHomeDirName = 'weblogic-deploy'; result.sourceWdtHome = window.api.path.join(wdtHome, result.targetWdtHomeDirName); result.sourceModelHome = modelHome; result.targetModelHomeDirName = window.api.path.basename(modelHome); } else { - // Only set these if they are not the default - if (this.project.image.wdtHomePath.hasValue()) { - result.wdtHome = this.project.image.wdtHomePath.value; - } - if (this.project.image.modelHomePath.hasValue()) { - result.modelHome = this.project.image.modelHomePath.value; + if (usingExistingPrimaryImage()) { + if (this.project.k8sDomain.imageWDTInstallHome.hasValue()) { + result.wdtHome = this.project.k8sDomain.imageWDTInstallHome.value; + } + if (this.project.k8sDomain.imageModelHome.hasValue()) { + result.modelHome = this.project.k8sDomain.imageModelHome.value; + } + } else { + // Only set these if they are not the default + if (this.project.image.wdtHomePath.hasValue()) { + result.wdtHome = this.project.image.wdtHomePath.value; + } + if (this.project.image.modelHomePath.hasValue()) { + result.modelHome = this.project.image.modelHomePath.value; + } } } } @@ -236,10 +256,19 @@ function(project, K8sDomainConfigMapGenerator, jsYaml, i18n) { } } + function usingExistingPrimaryImage() { + return project.settings.targetDomainLocation.value === 'mii' && !project.image.createPrimaryImage.value + && !project.image.useAuxImage.value; + } + function usingAuxImage() { return project.settings.targetDomainLocation.value === 'mii' && project.image.useAuxImage.value; } + function creatingAuxImage() { + return usingAuxImage() && project.image.createAuxImage.value; + } + function getAuxImageCopyCommand(wdtRelatedPaths) { const auxImageInternalTarget = '$AUXILIARY_IMAGE_TARGET_PATH'; diff --git a/webui/src/js/utils/k8s-domain-v9-resource-generator.js b/webui/src/js/utils/k8s-domain-v9-resource-generator.js index 0a8e4d225..fff315819 100644 --- a/webui/src/js/utils/k8s-domain-v9-resource-generator.js +++ b/webui/src/js/utils/k8s-domain-v9-resource-generator.js @@ -7,6 +7,8 @@ define(['models/wkt-project', 'utils/k8s-domain-configmap-generator', 'js-yaml', 'utils/i18n', 'utils/wkt-logger'], function(project, K8sDomainConfigMapGenerator, jsYaml, i18n) { + const WDT_DIR_NAME = 'weblogic-deploy'; + class K8sDomainV9ResourceGenerator { constructor() { this.project = project; @@ -52,19 +54,8 @@ define(['models/wkt-project', 'utils/k8s-domain-configmap-generator', 'js-yaml', domainResource.spec.serverPod = serverPod; } - if (usingAuxImage()) { - const auxiliaryImage = { - image: this.project.image.auxImageTag.value, - }; - if (this.project.k8sDomain.auxImagePullPolicy.hasValue()) { - auxiliaryImage.imagePullPolicy = this.project.k8sDomain.auxImagePullPolicy.value; - } - if (this.project.k8sDomain.auxImageSourceWDTInstallHome.hasValue()) { - auxiliaryImage.sourceWDTInstallHome = this.project.k8sDomain.auxImageSourceWDTInstallHome.value; - } - if (this.project.k8sDomain.auxImageSourceModelHome.hasValue()) { - auxiliaryImage.sourceModelHome = this.project.k8sDomain.auxImageSourceModelHome.value; - } + if (this.project.settings.targetDomainLocation.value === 'mii') { + const wdtRelatedPaths = this._getWdtRelatedPaths(domainResource); if (!domainResource.spec.configuration) { domainResource.spec.configuration = { @@ -73,7 +64,26 @@ define(['models/wkt-project', 'utils/k8s-domain-configmap-generator', 'js-yaml', } else if (!domainResource.spec.configuration.model) { domainResource.spec.configuration.model = {}; } - domainResource.spec.configuration.model.auxiliaryImages = [ auxiliaryImage ]; + + if (usingAuxImage()) { + const auxiliaryImage = { + image: this.project.image.auxImageTag.value, + }; + if (this.project.k8sDomain.auxImagePullPolicy.hasValue()) { + auxiliaryImage.imagePullPolicy = this.project.k8sDomain.auxImagePullPolicy.value; + } + auxiliaryImage.sourceWDTInstallHome = wdtRelatedPaths.sourceWDTInstallHome; + auxiliaryImage.sourceModelHome = wdtRelatedPaths.sourceModelHome; + + domainResource.spec.configuration.model.auxiliaryImages = [ auxiliaryImage ]; + } else { + if (wdtRelatedPaths.wdtInstallHome) { + domainResource.spec.configuration.model.wdtInstallHome = wdtRelatedPaths.wdtInstallHome; + } + if (wdtRelatedPaths.modelHome) { + domainResource.spec.configuration.model.modelHome = wdtRelatedPaths.modelHome; + } + } } if (this.project.k8sDomain.clusters.value.length === 0) { @@ -113,17 +123,6 @@ define(['models/wkt-project', 'utils/k8s-domain-configmap-generator', 'js-yaml', domainResource.spec.configuration.model.domainType = this.project.k8sDomain.domainType.value; domainResource.spec.configuration.model.runtimeEncryptionSecret = this.project.k8sDomain.runtimeSecretName.value; - if (!usingAuxImage()) { - const wdtRelatedPaths = this._getWdtRelatedPaths(domainResource); - // Only set these if they are specified; otherwise, rely on the default values - if (wdtRelatedPaths.wdtHome) { - domainResource.spec.configuration.model.wdtHome = wdtRelatedPaths.wdtHome; - } - if (wdtRelatedPaths.modelHome) { - domainResource.spec.configuration.model.modelHome = wdtRelatedPaths.modelHome; - } - } - if (this.k8sConfigMapGenerator.shouldCreateConfigMap()) { domainResource.spec.configuration.model.configMap = this.project.k8sDomain.modelConfigMapName.value; } @@ -237,24 +236,51 @@ define(['models/wkt-project', 'utils/k8s-domain-configmap-generator', 'js-yaml', _getWdtRelatedPaths() { let result; - if (this.project.settings.targetDomainLocation.value === 'mii') { - result = { }; + + // WKO 4.0+ has different behavior and parameters than 3.x + // + let wdtInstallHome = this.project.image.wdtHomePath.value; + if (!wdtInstallHome.endsWith(WDT_DIR_NAME)) { + wdtInstallHome = window.api.path.join(wdtInstallHome, WDT_DIR_NAME); + } if (usingAuxImage()) { - const wdtHome = this.project.image.wdtHomePath.value; - const modelHome = this.project.image.modelHomePath.value; - result.targetWdtHomeDirName = 'weblogic-deploy'; - result.sourceWdtHome = window.api.path.join(wdtHome, result.targetWdtHomeDirName); - result.sourceModelHome = modelHome; - result.targetModelHomeDirName = window.api.path.basename(modelHome); - } else { - // Only set these if they are not the default - if (this.project.image.wdtHomePath.hasValue()) { - result.wdtHome = this.project.image.wdtHomePath.value; + if (usingExistingAuxImage()) { + // If the source fields are exposed in the UI, use the values from those fields. + // + if (this.project.k8sDomain.auxImageSourceWDTInstallHome.hasValue()) { + result.sourceWDTInstallHome = this.project.k8sDomain.auxImageSourceWDTInstallHome.value; + } + if (this.project.k8sDomain.auxImageSourceModelHome.hasValue()) { + result.sourceModelHome = this.project.k8sDomain.auxImageSourceModelHome.value; + } + } else { + // If creating a new image, then use the values from the image page. + // + result.sourceWDTInstallHome = wdtInstallHome; + result.sourceModelHome = this.project.image.modelHomePath.value; } - if (this.project.image.modelHomePath.hasValue()) { - result.modelHome = this.project.image.modelHomePath.value; + // We intentionally do not set the wdtInstallHome and modelHome parameters + // since the default values will always be correct in V9 when using aux images. + // + } else { + if (usingExistingPrimaryImage()) { + // If these fields are exposed in the UI, use them if they have non-default values. + // + if (this.project.k8sDomain.imageWDTInstallHome.hasValue()) { + result.wdtInstallHome = this.project.k8sDomain.imageWDTInstallHome.value; + } + if (this.project.k8sDomain.imageModelHome.hasValue()) { + result.modelHome = this.project.k8sDomain.imageModelHome.value; + } + } else { + if (this.project.image.modelHomePath.hasValue()) { + result.wdtInstallHome = wdtInstallHome; + } + if (this.project.image.modelHomePath.hasValue()) { + result.modelHome = this.project.image.modelHomePath.value; + } } } } @@ -266,6 +292,15 @@ define(['models/wkt-project', 'utils/k8s-domain-configmap-generator', 'js-yaml', return project.settings.targetDomainLocation.value === 'mii' && project.image.useAuxImage.value; } + function usingExistingPrimaryImage() { + return project.settings.targetDomainLocation.value === 'mii' && !project.image.createPrimaryImage.value + && !project.image.useAuxImage.value; + } + + function usingExistingAuxImage() { + return usingAuxImage() && !project.image.createAuxImage.value; + } + function getOperatorNameForTargetDomainLocation(targetDomainLocation) { switch (targetDomainLocation) { case 'mii': diff --git a/webui/src/js/viewModels/domain-design-view.js b/webui/src/js/viewModels/domain-design-view.js index 2d063c9f6..7e265ba50 100644 --- a/webui/src/js/viewModels/domain-design-view.js +++ b/webui/src/js/viewModels/domain-design-view.js @@ -129,6 +129,12 @@ function (project, accUtils, utils, ko, i18n, screenUtils, BufferingDataProvider return this.labelMapper(key); }, this); + this.showPrimaryImageHomeFields = ko.computed(() => { + return this.project.settings.targetDomainLocation.observable() === 'mii' && + !this.project.image.createPrimaryImage.observable() && + !this.project.image.useAuxImage.observable(); + }, this); + this.isPrimaryImageTagReadOnly = ko.computed(() => { return this.project.image.createPrimaryImage.observable(); }, this); @@ -137,6 +143,12 @@ function (project, accUtils, utils, ko, i18n, screenUtils, BufferingDataProvider return this.project.image.createAuxImage.observable(); }, this); + this.showAuxImageSourceFields = ko.computed(() => { + return this.project.settings.targetDomainLocation.observable() === 'mii' && + this.project.image.useAuxImage.observable() && + !this.project.image.createAuxImage.observable(); + }, this); + this.auxImageTagHelp = ko.computed(() => { let key = 'use-aux-image-tag-help'; if (this.project.image.createAuxImage.observable()) { diff --git a/webui/src/js/views/domain-design-view.html b/webui/src/js/views/domain-design-view.html index 3ae9ddce3..0ea7e7d97 100644 --- a/webui/src/js/views/domain-design-view.html +++ b/webui/src/js/views/domain-design-view.html @@ -141,6 +141,20 @@