diff --git a/.github/workflows/testWlsAksWithDependencyCreation.yml b/.github/workflows/testWlsAksWithDependencyCreation.yml index 8e5126fc2..612897252 100644 --- a/.github/workflows/testWlsAksWithDependencyCreation.yml +++ b/.github/workflows/testWlsAksWithDependencyCreation.yml @@ -15,6 +15,10 @@ on: description: 'Replaced into https://raw.githubusercontent.com/#gitUserName#/weblogic-azure/#testbranchName#/weblogic-azure-aks/src/main/arm/' required: true default: main + vmSize: + description: 'The VM size for the AKS pool' + required: true + default: Standard_D2s_v3 # sample cURL # curl --verbose -X POST https://api.github.com/repos//weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token ' --data '{"event_type": "aks-integration-test-with-dependency-creation", "client_payload": {"gitUserNameForArtifactsLocation": "", "testBranchNameForArtifactsLocation": "", "isForDemo": "false"}}' repository_dispatch: @@ -46,6 +50,7 @@ jobs: gitUserNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.gitUserNameForArtifactsLocation }} testBranchNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.testBranchNameForArtifactsLocation }} azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}} + vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.3.4 @@ -71,19 +76,23 @@ jobs: isForDemo=${{ github.event.inputs.isForDemo }} gitUserNameForArtifactsLocation=${{ github.event.inputs.gitUserNameForArtifactsLocation }} testBranchNameForArtifactsLocation=${{ github.event.inputs.testBranchNameForArtifactsLocation }} + vmSize=${{ github.event.inputs.vmSize }} else isForDemo=${{ github.event.client_payload.isForDemo }} gitUserNameForArtifactsLocation=${{ github.event.client_payload.gitUserNameForArtifactsLocation }} testBranchNameForArtifactsLocation=${{ github.event.client_payload.testBranchNameForArtifactsLocation }} + vmSize=${{ github.event.client_payload.vmSize }} fi echo "##[set-output name=isForDemo;]${isForDemo}" echo "##[set-output name=gitUserNameForArtifactsLocation;]${gitUserNameForArtifactsLocation}" echo "##[set-output name=testBranchNameForArtifactsLocation;]${testBranchNameForArtifactsLocation}" + echo "##[set-output name=vmSize;]${vmSize}" echo "isForDemo=${isForDemo}" >> $GITHUB_ENV echo "gitUserNameForArtifactsLocation=${gitUserNameForArtifactsLocation}" >> $GITHUB_ENV echo "testBranchNameForArtifactsLocation=${testBranchNameForArtifactsLocation}" >> $GITHUB_ENV + echo "vmSize=${vmSize}" >> $GITHUB_ENV - uses: actions/checkout@v2.3.4 - name: Set up Maven with GitHub token uses: ./.github/actions/setupmaven @@ -273,6 +282,7 @@ jobs: ${wdtRuntimePassword} \ ${wlsPassword} \ ${wlsUserName} \ + ${{ needs.preflight.outputs.vmSize }} \ weblogic-azure/weblogic-azure-aks/src/test/setupWlsAksParameters.jsonc - name: Deploy WebLogic Server Cluster Domain offer id: deploy-wls-cluster diff --git a/.github/workflows/testWlsAksWithoutDependencyCreation.yml b/.github/workflows/testWlsAksWithoutDependencyCreation.yml index 2a3a1e193..010d01927 100644 --- a/.github/workflows/testWlsAksWithoutDependencyCreation.yml +++ b/.github/workflows/testWlsAksWithoutDependencyCreation.yml @@ -59,6 +59,7 @@ jobs: gitUserNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.gitUserNameForArtifactsLocation }} testBranchNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.testBranchNameForArtifactsLocation }} azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}} + vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }} steps: - uses: actions/checkout@v2.3.4 - name: Set AZ CLI Version @@ -87,6 +88,7 @@ jobs: isForDemo=${{ github.event.inputs.isForDemo }} gitUserNameForArtifactsLocation=${{ github.event.inputs.gitUserNameForArtifactsLocation }} testBranchNameForArtifactsLocation=${{ github.event.inputs.testBranchNameForArtifactsLocation }} + vmSize=${{ github.event.inputs.vmSize }} else resourceGroupForWlsAks=wlsd-aks-${{ github.event.client_payload.disambiguationSuffix }}-${{ github.run_number }} dbName=${{ github.event.client_payload.dbName }} @@ -95,6 +97,7 @@ jobs: isForDemo=${{ github.event.client_payload.isForDemo }} gitUserNameForArtifactsLocation=${{ github.event.client_payload.gitUserNameForArtifactsLocation }} testBranchNameForArtifactsLocation=${{ github.event.client_payload.testBranchNameForArtifactsLocation }} + vmSize=${{ github.event.client_payload.vmSize }} fi echo "##[set-output name=resourceGroupForWlsAks;]${resourceGroupForWlsAks}" @@ -104,6 +107,7 @@ jobs: echo "##[set-output name=isForDemo;]${isForDemo}" echo "##[set-output name=gitUserNameForArtifactsLocation;]${gitUserNameForArtifactsLocation}" echo "##[set-output name=testBranchNameForArtifactsLocation;]${testBranchNameForArtifactsLocation}" + echo "##[set-output name=vmSize;]${vmSize}" echo "resourceGroupForWlsAks=${resourceGroupForWlsAks}" >> $GITHUB_ENV echo "dbName=${dbName}" >> $GITHUB_ENV @@ -112,6 +116,7 @@ jobs: echo "isForDemo=${isForDemo}" >> $GITHUB_ENV echo "gitUserNameForArtifactsLocation=${gitUserNameForArtifactsLocation}" >> $GITHUB_ENV echo "testBranchNameForArtifactsLocation=${testBranchNameForArtifactsLocation}" >> $GITHUB_ENV + echo "vmSize=${vmSize}" >> $GITHUB_ENV - uses: actions/checkout@v2.3.4 - name: Set up Maven with GitHub token uses: ./.github/actions/setupmaven @@ -240,6 +245,7 @@ jobs: ${wdtRuntimePassword} \ ${wlsPassword} \ ${wlsUserName} \ + ${{ needs.preflight.outputs.vmSize }} \ weblogic-azure/weblogic-azure-aks/src/test/setupWlsAksParameters.jsonc - name: Deploy WebLogic Server Cluster Domain offer id: deploy-wls-cluster diff --git a/pom.xml b/pom.xml index 93fc3a227..6986309e9 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ - 1.0.79 + 1.0.80 1.0.27 1.0.51 diff --git a/weblogic-azure-aks/src/main/arm/createUiDefinition.json b/weblogic-azure-aks/src/main/arm/createUiDefinition.json index 5cefb87fb..21e269e66 100644 --- a/weblogic-azure-aks/src/main/arm/createUiDefinition.json +++ b/weblogic-azure-aks/src/main/arm/createUiDefinition.json @@ -601,6 +601,15 @@ } ] } + }, + { + "name": "unsupportedPlatformInfo1", + "type": "Microsoft.Common.InfoBox", + "visible": "[and(contains(steps('section_aks').clusterInfo.nodeVMSizeSelector,'p'), not(contains(parse('[\"14.1.1.0-11\", \"14.1.1.0-8\", \"14.1.1.0-slim-11\", \"14.1.1.0-slim-8\", \"12.2.1.4\", \"12.2.1.4-slim\"]'),if(equals(steps('section_aks').imageInfo.oracleImageSelector, 'others'), steps('section_aks').imageInfo.fromOracleImage, steps('section_aks').imageInfo.oracleImageSelector))))]", + "options": { + "icon": "Error", + "text": "The selected image is not compatible with the ARM64 platform. Please choose a different image or select a different size from AKS -> Azure Kubernetes Service -> Node size. For more information, see the Azure documentation." + } } ], "visible": true @@ -2418,4 +2427,4 @@ "wlsUserName": "[basics('basicsRequired').wlsUserName]" } } -} \ No newline at end of file +} diff --git a/weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh b/weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh index 56b74c24c..03dc722df 100644 --- a/weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh +++ b/weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh @@ -187,16 +187,20 @@ function download_mysql_driver() { fi } -# Install docker, zip, unzip and java -# Download WebLogic Tools -function install_utilities() { - # Install docker +function install_docker_multi_arch(){ + # Install docker https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository + # Add Docker's official GPG key: sudo apt-get -q update - sudo apt-get -y -q install apt-transport-https - curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + sudo apt-get -y -q install ca-certificates curl + sudo install -m 0755 -d /etc/apt/keyrings + sudo curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc + sudo chmod a+r /etc/apt/keyrings/docker.asc + + # Add the repository to Apt sources: echo \ - "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get -q update sudo apt-get -y -q install docker-ce docker-ce-cli containerd.io @@ -204,22 +208,57 @@ function install_utilities() { sudo docker --version validate_status "Check status of docker." sudo systemctl start docker +} +function install_openjdk11_x64(){ # Install Microsoft OpenJDK - wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb + # Valid values are only '18.04', '20.04', and '22.04' + ubuntu_release=`lsb_release -rs` + wget https://packages.microsoft.com/config/ubuntu/${ubuntu_release}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb - sudo apt -q update - sudo apt -y -q install msopenjdk-11 + + sudo apt-get -y -q install apt-transport-https + sudo apt-get -q update + sudo apt-get -y -q install msopenjdk-11 echo "java version" java -version - validate_status "Check status of Zulu JDK 8." + validate_status "Check status of OpenJDK 11." + + + export JAVA_HOME=/usr/lib/jvm/msopenjdk-11-$(dpkg --print-architecture) + if [ ! -d "${JAVA_HOME}" ]; then + echo "Java home ${JAVA_HOME} does not exist." + exit 1 + fi +} + +function install_openjdk11_arm64(){ + local zipFileName="microsoft-jdk-11.tar.gz" + sudo curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL ${jdkArm64Url} -o ${zipFileName} + sudo mkdir -p /usr/lib/jvm + local dirName=$(sudo tar -xzvf ${zipFileName} | head -1 | cut -f1 -d"/") + sudo tar -xzvf ${zipFileName} + sudo mv ${dirName} msopenjdk-11-amd64 + sudo mv -f msopenjdk-11-amd64 /usr/lib/jvm/ export JAVA_HOME=/usr/lib/jvm/msopenjdk-11-amd64 if [ ! -d "${JAVA_HOME}" ]; then echo "Java home ${JAVA_HOME} does not exist" exit 1 fi +} + +# Install docker, zip, unzip and java +# Download WebLogic Tools +function install_utilities() { + install_docker_multi_arch + + if [[ "$(dpkg --print-architecture)" == "arm64" ]]; then + install_openjdk11_arm64 + else + install_openjdk11_x64 + fi sudo apt -y -q install zip zip --help @@ -378,6 +417,7 @@ function build_wls_image() { --wdtArchive ${scriptDir}/model-images/archive.zip \ --wdtModelOnly \ --wdtDomainType WLS \ + --platform ${cpuPlatform} \ --chown ${user}:${group} validate_status "Check status of building WLS domain image." @@ -413,6 +453,7 @@ export useOracleImage=${11} export dbDriversUrls=${12} export enablePswlessConnection=${13} export dbType=${14} +export cpuPlatform=${15} export acrImagePath="$azureACRServer/aks-wls-images:${imageTag}" diff --git a/weblogic-azure-aks/src/main/arm/scripts/common.sh b/weblogic-azure-aks/src/main/arm/scripts/common.sh index 0846ad8f3..49b17c2df 100644 --- a/weblogic-azure-aks/src/main/arm/scripts/common.sh +++ b/weblogic-azure-aks/src/main/arm/scripts/common.sh @@ -22,6 +22,9 @@ export constAdminT3AddressEnvName="T3_TUNNELING_ADMIN_ADDRESS" export constAdminServerName='admin-server' export constClusterName='cluster-1' export constClusterT3AddressEnvName="T3_TUNNELING_CLUSTER_ADDRESS" +export constARM64Platform="arm64" +export constX86Platform="amd64" +export constMultiArchPlatform="Multi-architecture" export constDBTypeMySQL="mysql" export constDBTypeSqlServer="sqlserver" export constDefaultJavaOptions="-Dlog4j2.formatMsgNoLookups=true -Dweblogic.StdoutDebugEnabled=false" # the java options will be applied to the cluster @@ -63,3 +66,4 @@ export retryInterval=10 export wlsContainerName="weblogic-server" export wlsPostgresqlDriverUrl="https://jdbc.postgresql.org/download/postgresql-42.5.1.jar" export wlsMSSQLDriverUrl="https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/mssql-jdbc/10.2.1.jre8/mssql-jdbc-10.2.1.jre8.jar" +export jdkArm64Url="https://aka.ms/download-jdk/microsoft-jdk-11.0.23-linux-aarch64.tar.gz" \ No newline at end of file diff --git a/weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh b/weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh index 1b74619f1..c0efe811a 100644 --- a/weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh +++ b/weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh @@ -96,13 +96,32 @@ function build_docker_image() { # Create vm to build docker image vmName="VM-UBUNTU-WLS-AKS-$(date +%s)" + # az vm image list --publisher Canonical --offer UbuntuServer --all -o table + ubuntuImage="Canonical:UbuntuServer:18.04-LTS:latest" + + if [[ "${CPU_PLATFORM}" == "${constARM64Platform}" ]]; then + ubuntuImage="Canonical:UbuntuServer:18_04-lts-arm64:latest" + fi + + # query AKS vm size + # use the same VM size to create the Ubuntu machine, make sure the architecture is matched. + local vmSize=$(az aks show --name ${AKS_CLUSTER_NAME} --resource-group ${AKS_CLUSTER_RESOURCEGROUP_NAME} \ + | jq '.agentPoolProfiles[] | select(.name=="agentpool") | .vmSize' \ + | tr -d "\"") + + # if vmSize is empty or null, exit + if [[ "${vmSize}" == "" || "${vmSize}" == "null" ]]; then + echo_stderr "Failed to obtain VM size of AKS ${AKS_CLUSTER_NAME} in ${AKS_CLUSTER_RESOURCEGROUP_NAME}." + exit 1 + fi + # MICROSOFT_INTERNAL # Specify tag 'SkipASMAzSecPack' to skip policy 'linuxazuresecuritypackautodeployiaas_1.6' # Specify tag 'SkipNRMS*' to skip Microsoft internal NRMS policy, which causes vm-redeployed issue az vm create \ --resource-group ${CURRENT_RESOURCEGROUP_NAME} \ --name ${vmName} \ - --image "Canonical:UbuntuServer:18.04-LTS:latest" \ + --image "${ubuntuImage}" \ --admin-username azureuser \ --generate-ssh-keys \ --nsg-rule NONE \ @@ -110,6 +129,7 @@ function build_docker_image() { --vnet-name ${vmName}VNET \ --enable-auto-update false \ --public-ip-address "" \ + --size ${vmSize} \ --tags SkipASMAzSecPack=true SkipNRMSCorp=true SkipNRMSDatabricks=true SkipNRMSDB=true SkipNRMSHigh=true SkipNRMSMedium=true SkipNRMSRDPSSH=true SkipNRMSSAW=true SkipNRMSMgmt=true --verbose if [[ "${USE_ORACLE_IMAGE,,}" == "${constTrue}" ]]; then @@ -128,7 +148,7 @@ function build_docker_image() { --publisher Microsoft.Azure.Extensions \ --version 2.0 \ --settings "{ \"fileUris\": [\"${SCRIPT_LOCATION}model.properties\",\"${SCRIPT_LOCATION}genImageModel.sh\",\"${SCRIPT_LOCATION}buildWLSDockerImage.sh\",\"${SCRIPT_LOCATION}common.sh\"]}" \ - --protected-settings "{\"commandToExecute\":\"echo ${acrPassword} ${ORACLE_ACCOUNT_PASSWORD} | bash buildWLSDockerImage.sh ${wlsImagePath} ${acrLoginServer} ${acrUser} ${newImageTag} ${WLS_APP_PACKAGE_URLS} ${ORACLE_ACCOUNT_NAME} ${WLS_CLUSTER_SIZE} ${ENABLE_CUSTOM_SSL} ${ENABLE_ADMIN_CUSTOM_T3} ${ENABLE_CLUSTER_CUSTOM_T3} ${USE_ORACLE_IMAGE} ${URL_3RD_DATASOURCE} ${ENABLE_PASSWORDLESS_DB_CONNECTION} ${DB_TYPE} \"}" + --protected-settings "{\"commandToExecute\":\"echo ${acrPassword} ${ORACLE_ACCOUNT_PASSWORD} | bash buildWLSDockerImage.sh ${wlsImagePath} ${acrLoginServer} ${acrUser} ${newImageTag} ${WLS_APP_PACKAGE_URLS} ${ORACLE_ACCOUNT_NAME} ${WLS_CLUSTER_SIZE} ${ENABLE_CUSTOM_SSL} ${ENABLE_ADMIN_CUSTOM_T3} ${ENABLE_CLUSTER_CUSTOM_T3} ${USE_ORACLE_IMAGE} ${URL_3RD_DATASOURCE} ${ENABLE_PASSWORDLESS_DB_CONNECTION} ${DB_TYPE} ${CPU_PLATFORM} \"}" cleanup_vm } diff --git a/weblogic-azure-aks/src/main/arm/scripts/inline-scripts/validateParameters.sh b/weblogic-azure-aks/src/main/arm/scripts/inline-scripts/validateParameters.sh index 9705816a0..6fbc3872e 100644 --- a/weblogic-azure-aks/src/main/arm/scripts/inline-scripts/validateParameters.sh +++ b/weblogic-azure-aks/src/main/arm/scripts/inline-scripts/validateParameters.sh @@ -150,9 +150,6 @@ function validate_memory_resources() { } function validate_ocr_account() { - # install docker cli - install_docker - # ORACLE_ACCOUNT_NAME # ORACLE_ACCOUNT_PASSWORD docker logout @@ -186,6 +183,43 @@ function check_acr() { echo_stdout "Check if ACR ${ACR_NAME} is ready to import image." } +function obtain_image_architecture() { + local acrName=$1 + local repoName=$2 + local tag=$3 + local imageUri="${acrName}.azurecr.io/${repoName}:${tag}" + + local imageArch=$(az acr manifest list-metadata -r ${acrName} -n ${repoName} \ + | jq '.[] | select(.tags != null) | select(.tags[] | length >0 ) | select(.tags[0]=="'${tag}'") | .architecture' \ + | tr -d "\"") + + if [[ "${imageArch}" == "null" ]]; then + # if the image is multi-architecture, the value is empty. + # Use the docker manifest inspect command to get the architecture. + # https://learn.microsoft.com/en-us/azure/container-registry/push-multi-architecture-images + local acrUserName=$(az acr credential show -n ${acrName} --query "username" | tr -d "\"") + local acrPassword=$(az acr credential show -n ${acrName} --query "passwords[0].value" | tr -d "\"") + local acrServer="${acrName}.azurecr.io" + + docker login ${acrServer} -u ${acrUserName} -p ${acrPassword} + local ret=$(docker manifest inspect ${imageUri} | jq '.manifests[] | .platform.architecture') + + if [[ $ret == *"${constX86Platform}"* && $ret == *"${constARM64Platform}"* ]]; then + imageArch="${constMultiArchPlatform}" + elif [[ $ret == *"${constX86Platform}"* ]]; then + imageArch="${constX86Platform}" + elif [[ $ret == *"${constARM64Platform}"* ]]; then + imageArch="${constARM64Platform}" + else + echo_stderr "The architecture of image is not supported. Currently only ARM64 and AMD64 are supported." + exit 1 + fi + fi + echo_stdout "Architecture of image is ${imageArch}." + + export IMAGE_ARCHITECTURE=${imageArch} +} + function validate_ocr_image() { local ocrImageFullPath="${ocrLoginServer}/${ocrGaImagePath}:${wlsImageTag}" @@ -213,7 +247,8 @@ function validate_ocr_image() { # validate the image by importing it to ACR. # if failure happens, the image should be unavailable - local tmpImagePath="tmp$(date +%s):${wlsImageTag}" + local tmpRepo="tmp$(date +%s)" + local tmpImagePath="${tmpRepo}:${wlsImageTag}" az acr import --name ${ACR_NAME} \ --resource-group ${ACR_RESOURCE_GROUP} \ --source ${ocrImageFullPath} \ @@ -226,6 +261,7 @@ function validate_ocr_image() { # check if the image is imported successfully. local ret=$(az acr repository show --name $ACR_NAME --image ${tmpImagePath}) if [ -n "${ret}" ]; then + obtain_image_architecture ${ACR_NAME} ${tmpRepo} ${wlsImageTag} # delete the image from ACR. az acr repository delete --name ${ACR_NAME} --image ${tmpImagePath} --yes else @@ -269,6 +305,8 @@ function validate_acr_image() { exit 1 fi + obtain_image_architecture ${ACR_NAME_FOR_USER_PROVIDED_IMAGE} ${repository} ${tag} + echo_stdout "Check ACR image: passed!" } @@ -290,6 +328,29 @@ function validate_acr_admin_enabled() fi } +# Validate whether image architecture is matched with the architecture of the VM. +# Azure supports both AMD based processor and ARM based CPU, see https://learn.microsoft.com/en-us/azure/virtual-machines/vm-naming-conventions. + # For ARM cpu, the VM size name includes letter 'p'. + # For AMD cpu, the VM size name does not include letter 'p'. +# Validate cases: + # 1. If the VM size is AMD based, the image should be amd64 or multi-platform. + # 2. If the VM size is ARM based, the image should be arm64 or multi-platform. +# IMAGE_ARCHITECTURE value may be "amd64", "arm64" or "Multi-architecture (amd64 and arm64)". +function validate_image_compatibility +{ + if [[ $aksAgentPoolVMSize == *"p"* ]]; then + if [[ "${IMAGE_ARCHITECTURE}" != "${constARM64Platform}" && "${IMAGE_ARCHITECTURE}" != "${constMultiArchPlatform}" ]]; then + echo_stderr "The image architecture ${IMAGE_ARCHITECTURE} is not compatible with the ARM based VM size ${aksAgentPoolVMSize}." + exit 1 + fi + else + if [[ "${IMAGE_ARCHITECTURE}" != "${constX86Platform}" && "${IMAGE_ARCHITECTURE}" != "${constMultiArchPlatform}" ]]; then + echo_stderr "The image architecture ${IMAGE_ARCHITECTURE} is not compatible with the AMD based VM size ${aksAgentPoolVMSize}." + exit 1 + fi + fi +} + function download_wls_ssl_certificates_from_keyvault() { # check key vault accessibility for template deployment local enabledForTemplateDeployment=$(az keyvault show --name ${WLS_SSL_KEYVAULT_NAME} --query "properties.enabledForTemplateDeployment") @@ -635,6 +696,9 @@ checkDNSZone=${12} outputAksVersion=${constDefaultAKSVersion} sslCertificateKeyVaultOption="keyVaultStoredConfig" +# install docker cli +install_docker + validate_compute_resources validate_memory_resources @@ -643,6 +707,8 @@ validate_base_image_path validate_acr_admin_enabled +validate_image_compatibility + if [[ "${enableCustomSSL,,}" == "true" ]]; then validate_wls_ssl_certificates fi @@ -666,4 +732,3 @@ validate_appgateway_vnet query_available_zones output_result - diff --git a/weblogic-azure-aks/src/main/bicep/mainTemplate.bicep b/weblogic-azure-aks/src/main/bicep/mainTemplate.bicep index 7daabb4b7..28dad9643 100644 --- a/weblogic-azure-aks/src/main/bicep/mainTemplate.bicep +++ b/weblogic-azure-aks/src/main/bicep/mainTemplate.bicep @@ -319,6 +319,7 @@ var const_azcliVersion = '2.53.0' var const_azureSubjectName = format('{0}.{1}.{2}', name_domainLabelforApplicationGateway, location, 'cloudapp.azure.com') var const_bCreateStorageAccount = (createAKSCluster || !const_hasStorageAccount) && const_enablePV var const_bValidateApplications= validateApplications && (length(appPackageUrls) > 0) +var const_cpuPlatform = (contains(vmSize, 'p') ? 'arm64' : 'amd64') var const_createNewAcr = useOracleImage && createACR var const_defaultKeystoreType = 'PKCS12' var const_enableNetworking = (length(lbSvcValues) > 0) || enableAppGWIngress @@ -567,11 +568,11 @@ module wlsDomainDeployment 'modules/setupWebLogicCluster.bicep' = if (!enableCus aksClusterNamePrefix: aksClusterNamePrefix aksClusterRGName: aksClusterRGName aksClusterName: aksClusterName - aksAgentAvailabilityZones:validateInputs.outputs.aksAgentAvailabilityZones aksVersion: validateInputs.outputs.aksVersion appPackageUrls: appPackageUrls appReplicas: appReplicas azCliVersion: const_azcliVersion + cpuPlatform: const_cpuPlatform createAKSCluster: createAKSCluster createStorageAccount: const_bCreateStorageAccount databaseType: databaseType @@ -640,11 +641,11 @@ module wlsDomainWithCustomSSLDeployment 'modules/setupWebLogicCluster.bicep' = i aksClusterNamePrefix: aksClusterNamePrefix aksClusterRGName: aksClusterRGName aksClusterName: aksClusterName - aksAgentAvailabilityZones:validateInputs.outputs.aksAgentAvailabilityZones aksVersion: validateInputs.outputs.aksVersion appPackageUrls: appPackageUrls appReplicas: appReplicas azCliVersion: const_azcliVersion + cpuPlatform: const_cpuPlatform createAKSCluster: createAKSCluster createStorageAccount: const_bCreateStorageAccount databaseType: databaseType diff --git a/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-create-wls-cluster.bicep b/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-create-wls-cluster.bicep index 4577addfc..810b4b10e 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-create-wls-cluster.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-create-wls-cluster.bicep @@ -12,6 +12,7 @@ param acrResourceGroupName string = '' param appPackageUrls array = [] param appReplicas int = 2 param azCliVersion string = '' +param cpuPlatform string = '' param databaseType string = 'oracle' param dbDriverLibrariesUrls array = [] param enableCustomSSL bool = false @@ -102,6 +103,10 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@${azure.apiVers name: 'AKS_CLUSTER_RESOURCEGROUP_NAME' value: aksClusterRGName } + { + name: 'CPU_PLATFORM' + value: cpuPlatform + } { name: 'CURRENT_RESOURCEGROUP_NAME' value: resourceGroup().name diff --git a/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep b/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep index 9090b3de3..1fbeab1cc 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep @@ -57,6 +57,7 @@ param appPackageUrls array = [] @description('The number of managed server to start.') param appReplicas int = 2 param azCliVersion string = '' +param cpuPlatform string = 'linux/amd64' @description('true to create a new AKS cluster.') param createAKSCluster bool = true param createStorageAccount bool = false @@ -205,6 +206,7 @@ module wlsDomainDeployment './_deployment-scripts/_ds-create-wls-cluster.bicep' appPackageUrls: appPackageUrls appReplicas: appReplicas azCliVersion: azCliVersion + cpuPlatform: cpuPlatform databaseType: databaseType dbDriverLibrariesUrls: dbDriverLibrariesUrls enableCustomSSL: enableCustomSSL diff --git a/weblogic-azure-aks/src/test/genWlsAksParameters.sh b/weblogic-azure-aks/src/test/genWlsAksParameters.sh index 52bee4328..da5bac7e2 100644 --- a/weblogic-azure-aks/src/test/genWlsAksParameters.sh +++ b/weblogic-azure-aks/src/test/genWlsAksParameters.sh @@ -14,7 +14,9 @@ ocrSSOUser=$9 wdtRuntimePassword=${10} wlsPassword=${11} wlsUserName=${12} -parametersPath=${13} +vmSize=${13} +parametersPath=${14} + cat < ${parametersPath} { @@ -29,7 +31,7 @@ cat < ${parametersPath} "value": 3 }, "vmSize": { - "value": "Standard_DS2_v2" + "value": "${vmSize}" }, "appGatewayCertificateOption": { "value": "generateCert"