Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions weblogic-azure-aks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<modelVersion>4.0.0</modelVersion>

<!-- mvn -Pbicep -Passembly clean install -->
<!-- Build with development profile
If using azure-javaee-iaas-parent less than 1.0.13, use:
mvn -Pbicep -Passembly -Ddev clean install
Otherwise, use
mvn -Pbicep-dev -Passembly clean install
-->

<groupId>com.oracle.weblogic.azure</groupId>
<artifactId>wls-on-aks-azure-marketplace</artifactId>
Expand Down
19 changes: 18 additions & 1 deletion weblogic-azure-aks/src/main/arm/createUiDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,22 @@
},
"visible": "[bool(steps('section_aks').jeeAppInfo.uploadAppPackage)]"
},
{
"name": "validateApplicationsInfo",
"type": "Microsoft.Common.InfoBox",
"visible": "[bool(steps('section_aks').jeeAppInfo.uploadAppPackage)]",
"options": {
"icon": "Info",
"text": "If checked, verify the deployed app reaches the ACTIVE state and fail the deployment if it does not. See the documentation link for more information.",
"uri": "https://aka.ms/wls-aks-deployment-state"
}
},
{
"name": "validateApplications",
"type": "Microsoft.Common.CheckBox",
"label": "Fail deployment if application does not become ACTIVE.",
"visible": "[bool(steps('section_aks').jeeAppInfo.uploadAppPackage)]"
},
{
"name": "appReplicas",
"type": "Microsoft.Common.TextBox",
Expand Down Expand Up @@ -1813,6 +1829,7 @@
"useOracleImage": "[bool(steps('section_aks').imageInfo.useOracleImage)]",
"userProvidedAcr": "[last(split(steps('section_aks').imageInfo.userProvidedAcrSelector.id, '/'))]",
"userProvidedImagePath": "[steps('section_aks').imageInfo.userProvidedImagePath]",
"validateApplications": "[bool(steps('section_aks').jeeAppInfo.validateApplications)]",
"wdtRuntimePassword": "[basics('basicsRequired').wdtRuntimePassword]",
"wlsClusterSize": "[basics('basicsOptional').wlsClusterSize]",
"wlsDomainName": "[basics('basicsOptional').wlsDomainName]",
Expand All @@ -1823,4 +1840,4 @@
"wlsUserName": "[basics('basicsRequired').wlsUserName]"
}
}
}
}
11 changes: 0 additions & 11 deletions weblogic-azure-aks/src/main/arm/scripts/setupWLSDomain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -735,16 +735,6 @@ function setup_wls_domain() {
wait_for_image_update_completed

wait_for_pod_completed

# make sure all the application are active, if not, fail the deployment.
scriptCheckAppStatus=$scriptDir/checkApplicationStatus.py
chmod ugo+x $scriptDir/checkApplicationStatus.py
utility_validate_application_status \
${wlsDomainNS} \
${wlsAdminSvcName} \
${wlsUserName} \
${wlsPassword} \
${scriptCheckAppStatus}
}

# Main script
Expand Down Expand Up @@ -800,7 +790,6 @@ export sasTokenValidTime=3600
export storageFileShareName="weblogic"
export storageResourceGroup=${currentResourceGroup}
export sharedPath="/shared"
export wlsAdminSvcName="${wlsDomainUID}-admin-server"
export wlsDomainNS="${wlsDomainUID}-ns"
export wlsOptHelmChart="https://oracle.github.io/weblogic-kubernetes-operator/charts"
export wlsOptNameSpace="weblogic-operator-ns"
Expand Down
2 changes: 1 addition & 1 deletion weblogic-azure-aks/src/main/arm/scripts/utility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function utility_validate_application_status() {
grep "Summary: all applications are active"

if [ $? == 1 ];then
echo "Failed to deploy application to WLS cluster. Please make sure the configurations are correct."
echo_stderr "Failed to deploy application to WLS cluster. Please make sure the configurations are correct."
exit 1
fi
}
Expand Down
37 changes: 37 additions & 0 deletions weblogic-azure-aks/src/main/arm/scripts/validateApplications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2021, Oracle Corporation and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
# This script runs on Azure Container Instance with Alpine Linux that Azure Deployment script creates.

# Connect to AKS cluster
function connect_aks_cluster() {
az aks get-credentials \
--resource-group ${AKS_RESOURCE_GROUP_NAME} \
--name ${AKS_NAME} \
--overwrite-existing
}

function validate_app() {
# make sure all the application are active, if not, fail the deployment.
local wlsDomainNS="${WLS_DOMAIN_UID}-ns"
local wlsAdminSvcName="${WLS_DOMAIN_UID}-admin-server"
scriptCheckAppStatus=$scriptDir/checkApplicationStatus.py
chmod ugo+x $scriptDir/checkApplicationStatus.py
utility_validate_application_status \
${wlsDomainNS} \
${wlsAdminSvcName} \
${WLS_DOMAIN_USER} \
${WLS_DOMAIN_PASSWORD} \
${scriptCheckAppStatus}
}

# Main script
export script="${BASH_SOURCE[0]}"
export scriptDir="$(cd "$(dirname "${script}")" && pwd)"

source ${scriptDir}/utility.sh

install_kubectl

connect_aks_cluster

validate_app
27 changes: 26 additions & 1 deletion weblogic-azure-aks/src/main/bicep/mainTemplate.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
*
* Build marketplace offer for test:
* Replace the partner center pid in mainTemplate.bicep, then run the following command to generate the ARM package, and upload it to partner center.
* $ mvn -Pbicep -Ddev -Passembly clean install
* If using azure-javaee-iaas-parent less than 1.0.13, use:
* $ mvn -Pbicep -Passembly -Ddev clean install
* otherwise, use
* $ mvn -Pbicep-dev -Passembly clean install
*/

param _artifactsLocation string = deployment().properties.templateLink.uri
Expand Down Expand Up @@ -224,6 +227,7 @@ param userProvidedAcr string = 'null'
param userProvidedImagePath string = 'null'
@description('Use Oracle images or user provided patched images')
param useOracleImage bool = true
param validateApplications bool = false
@secure()
@description('Password for model WebLogic Deploy Tooling runtime encrytion.')
param wdtRuntimePassword string
Expand Down Expand Up @@ -622,6 +626,27 @@ module datasourceDeployment 'modules/_setupDBConnection.bicep' = if (enableDB) {
]
}

/*
* To check if all the applciations in WLS cluster become ACTIVE state after all configurations are completed.
* This should be the last step.
*/
module validateApplciations 'modules/_deployment-scripts/_ds-validate-applications.bicep' = if (validateApplications) {
name: 'validate-wls-application-status'
params: {
_artifactsLocation: _artifactsLocation
_artifactsLocationSasToken: _artifactsLocationSasToken
aksClusterRGName: ref_wlsDomainDeployment.outputs.aksClusterRGName.value
aksClusterName: ref_wlsDomainDeployment.outputs.aksClusterName.value
identity: identity
wlsDomainUID: wlsDomainUID
wlsPassword: wlsPassword
wlsUserName: wlsUserName
}
dependsOn: [
datasourceDeployment
]
}

output aksClusterName string = ref_wlsDomainDeployment.outputs.aksClusterName.value
output adminConsoleInternalUrl string = ref_wlsDomainDeployment.outputs.adminServerUrl.value
output adminConsoleExternalUrl string = const_enableNetworking ? networkingDeployment.outputs.adminConsoleExternalUrl : ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ var const_arguments = '${ocrSSOUser} ${ocrSSOPSW} ${aksClusterRGName} ${aksClust
var const_buildDockerImageScript='createVMAndBuildImage.sh'
var const_commonScript = 'common.sh'
var const_invokeSetUpDomainScript = 'invokeSetupWLSDomain.sh'
var const_pyCheckAppStatusScript = 'py-scripts/checkApplicationStatus.py'
var const_pvTempalte = 'pv.yaml.template'
var const_pvcTempalte = 'pvc.yaml.template'
var const_scriptLocation = uri(_artifactsLocation, 'scripts/')
Expand All @@ -89,7 +88,6 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
uri(const_scriptLocation, '${const_commonScript}${_artifactsLocationSasToken}')
uri(const_scriptLocation, '${const_buildDockerImageScript}${_artifactsLocationSasToken}')
uri(const_scriptLocation, '${const_updateDomainConfigScript}${_artifactsLocationSasToken}')
uri(const_scriptLocation, '${const_pyCheckAppStatusScript}${_artifactsLocationSasToken}')
]
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright (c) 2021, Oracle Corporation and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

param _artifactsLocation string
@secure()
param _artifactsLocationSasToken string = ''

param aksClusterRGName string = ''
param aksClusterName string = ''
param identity object
param utcValue string = utcNow()
param wlsDomainUID string = 'sample-domain1'
@secure()
param wlsPassword string
@description('User name for WebLogic Administrator.')
param wlsUserName string = 'weblogic'

var const_azcliVersion='2.15.0'
var const_pyCheckAppStatusScript = 'py-scripts/checkApplicationStatus.py'
var const_scriptLocation = uri(_artifactsLocation, 'scripts/')
var const_validateAppScript= 'validateApplications.sh'
var const_utilityScript= 'utility.sh'


resource deploymentScript 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'ds-wls-validate-applications'
location: resourceGroup().location
kind: 'AzureCLI'
identity: identity
properties: {
azCliVersion: const_azcliVersion
environmentVariables: [
{
name: 'AKS_RESOURCE_GROUP_NAME'
value: aksClusterRGName
}
{
name: 'AKS_NAME'
value: aksClusterName
}
{
name: 'WLS_DOMAIN_UID'
value: wlsDomainUID
}
{
name: 'WLS_DOMAIN_USER'
value: wlsUserName
}
{
name: 'WLS_DOMAIN_PASSWORD'
secureValue: wlsPassword
}
]
primaryScriptUri: uri(const_scriptLocation, '${const_validateAppScript}${_artifactsLocationSasToken}')
supportingScriptUris: [
uri(const_scriptLocation, '${const_utilityScript}${_artifactsLocationSasToken}')
uri(const_scriptLocation, '${const_pyCheckAppStatusScript}${_artifactsLocationSasToken}')
]
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
forceUpdateTag: utcValue
}
}