From f1b6c8c65e3837f18a4e2f9cdb18e67e21943b59 Mon Sep 17 00:00:00 2001 From: galiacheng Date: Mon, 15 Jul 2024 13:33:28 +0800 Subject: [PATCH 1/5] suppprt arm64 arch for the multi-platforms images. --- .../testWlsAksWithDependencyCreation.yml | 10 +++ .../testWlsAksWithoutDependencyCreation.yml | 6 ++ pom.xml | 2 +- .../src/main/arm/createUiDefinition.json | 13 ++- .../main/arm/scripts/buildWLSDockerImage.sh | 65 +++++++++++--- .../src/main/arm/scripts/common.sh | 4 + .../main/arm/scripts/createVMAndBuildImage.sh | 24 +++++- .../inline-scripts/validateParameters.sh | 86 +++++++++++++++---- .../src/main/bicep/mainTemplate.bicep | 5 +- .../bicep/modules/_azure-resoruces/_aks.bicep | 8 +- .../_ds-create-wls-cluster.bicep | 5 ++ .../_ds-validate-parameters.bicep | 1 - .../bicep/modules/setupWebLogicCluster.bicep | 4 +- .../src/test/genWlsAksParameters.sh | 6 +- .../test/scripts/verify-services.sh | 78 ++++++++--------- .../test/scripts/verify-wls-path.sh | 12 +-- 16 files changed, 241 insertions(+), 88 deletions(-) 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..856a8dac2 100644 --- a/weblogic-azure-aks/src/main/arm/createUiDefinition.json +++ b/weblogic-azure-aks/src/main/arm/createUiDefinition.json @@ -329,6 +329,8 @@ "Standard_DS2_v2" ], "constraints": { + "numAvailabilityZonesRequired": 3, + "zone": "3", "excludedSizes": [ "Standard_A0", "Standard_A1", @@ -601,6 +603,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 https://learn.microsoft.com/azure/virtual-machines/vm-naming-conventions." + } } ], "visible": true @@ -2418,4 +2429,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..371104665 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 @@ -186,6 +186,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." + 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 +250,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 +264,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 +308,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 +331,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") @@ -596,24 +660,11 @@ function validate_appgateway_vnet() { fi } -function query_available_zones() { - if [[ "${createAKSCluster,,}" == "true" ]]; then - outputAvailableZones=$(az vm list-skus -l ${location} --size ${aksAgentPoolVMSize} --zone true | jq -c '.[] | .locationInfo[] | .zones') - fi - - if [ -z "${outputAvailableZones}" ]; then - outputAvailableZones="[]" - fi - - export outputAvailableZones="${outputAvailableZones}" -} - function output_result() { echo "AKS version: ${outputAksVersion}" result=$(jq -n -c \ --arg aksVersion "$outputAksVersion" \ - --arg agentAvailabilityZones "${outputAvailableZones}" \ - '{aksVersion: $aksVersion, agentAvailabilityZones: $agentAvailabilityZones}') + '{aksVersion: $aksVersion}') echo "result is: $result" echo $result >$AZ_SCRIPTS_OUTPUT_PATH } @@ -643,6 +694,8 @@ validate_base_image_path validate_acr_admin_enabled +validate_image_compatibility + if [[ "${enableCustomSSL,,}" == "true" ]]; then validate_wls_ssl_certificates fi @@ -663,7 +716,4 @@ fi 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/_azure-resoruces/_aks.bicep b/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep index 0f494cfc8..e9f7bae03 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep @@ -7,7 +7,6 @@ param aciResourcePermissions bool = true param aciRetentionInDays int = 120 @description('Pricing tier: PerGB2018 or legacy tiers (Free, Standalone, PerNode, Standard or Premium) which are not available to all customers.') param aciWorkspaceSku string = 'pergb2018' -param agentAvailabilityZones array = [] @maxLength(12) @minLength(1) @description('The name for this node pool. Node pool must contain only lowercase letters and numbers. For Linux node pools the name cannot be longer than 12 characters.') @@ -28,6 +27,11 @@ param location string param utcValue string = utcNow() var const_aksAgentPoolOSDiskSizeGB = 128 +var const_aksAvailabilityZones = [ + '1' + '2' + '3' +] var name_aciWorkspace = 'Workspace-${guid(utcValue)}-${location}' // Generate a unique AKS name scoped to subscription. var name_aksClusterNameForSV = '${aksClusterNamePrefix}${uniqueString(utcValue)}' @@ -75,7 +79,7 @@ resource aksCluster 'Microsoft.ContainerService/managedClusters@${azure.apiVersi osDiskType: 'Managed' kubeletDiskType: 'OS' type: 'VirtualMachineScaleSets' - availabilityZones: agentAvailabilityZones + availabilityZones: const_aksAvailabilityZones mode: 'System' osType: 'Linux' } 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/_deployment-scripts/_ds-validate-parameters.bicep b/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep index 209666eaf..6b0aa0011 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep @@ -247,4 +247,3 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@${azure.apiVers } output aksVersion string = deploymentScript.properties.outputs.aksVersion -output aksAgentAvailabilityZones array = json(deploymentScript.properties.outputs.agentAvailabilityZones) diff --git a/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep b/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep index 9090b3de3..e44e08af3 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep @@ -29,7 +29,6 @@ param aciRetentionInDays int = 120 param aciWorkspaceSku string = 'pergb2018' param acrName string = '' param acrResourceGroupName string = '' -param aksAgentAvailabilityZones array = [] @maxLength(12) @minLength(1) @description('The name for this node pool. Node pool must contain only lowercase letters and numbers. For Linux node pools the name cannot be longer than 12 characters.') @@ -57,6 +56,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 @@ -162,7 +162,6 @@ module aksClusterDeployment './_azure-resoruces/_aks.bicep' = if (createAKSClust aciResourcePermissions: aciResourcePermissions aciRetentionInDays: aciRetentionInDays aciWorkspaceSku: aciWorkspaceSku - agentAvailabilityZones: aksAgentAvailabilityZones aksAgentPoolName: aksAgentPoolName aksAgentPoolNodeCount: aksAgentPoolNodeCount aksAgentPoolNodeMaxCount: aksAgentPoolNodeMaxCount @@ -205,6 +204,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" diff --git a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh index 728f1f8a5..f9a7aa48f 100644 --- a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh +++ b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh @@ -1,39 +1,39 @@ -#!/bin/bash -# Copyright (c) 2021, Oracle and/or its affiliates. -# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - -# Verify the service using systemctl status -function verifyServiceStatus() -{ - serviceName=$1 - systemctl status $serviceName | grep "active (running)" - if [[ $? != 0 ]]; then - echo "$serviceName is not in active (running) state" - exit 1 - fi - echo "$serviceName is active (running)" -} - -#Verify the service using systemctl is-active -function verifyServiceActive() -{ - serviceName=$1 - state=$(systemctl is-active $serviceName) - if [[ $state == "active" ]]; then - echo "$serviceName is active" - else - echo "$serviceName is not active" - exit 1 - fi -} - -echo "Testing on admin server" -servicesList="rngd wls_admin" - -for service in $servicesList -do - verifyServiceStatus $service - verifyServiceActive $service -done - -exit 0 +#!/bin/bash +# Copyright (c) 2021, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +# Verify the service using systemctl status +function verifyServiceStatus() +{ + serviceName=$1 + systemctl status $serviceName | grep "active (running)" + if [[ $? != 0 ]]; then + echo "$serviceName is not in active (running) state" + exit 1 + fi + echo "$serviceName is active (running)" +} + +#Verify the service using systemctl is-active +function verifyServiceActive() +{ + serviceName=$1 + state=$(systemctl is-active $serviceName) + if [[ $state == "active" ]]; then + echo "$serviceName is active" + else + echo "$serviceName is not active" + exit 1 + fi +} + +echo "Testing on admin server" +servicesList="rngd wls_admin" + +for service in $servicesList +do + verifyServiceStatus $service + verifyServiceActive $service +done + +exit 0 diff --git a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh index d6ff190af..3f5c267fe 100644 --- a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh +++ b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh @@ -1,6 +1,6 @@ -#!/bin/bash -# Copyright (c) 2021, Oracle and/or its affiliates. -# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - -echo "#adminPasswordOrKey#" | sudo -S [ -d "/u01/app/wls/install/oracle/middleware/oracle_home/wlserver/modules" ] && exit 0 -exit 1 +#!/bin/bash +# Copyright (c) 2021, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +echo "#adminPasswordOrKey#" | sudo -S [ -d "/u01/app/wls/install/oracle/middleware/oracle_home/wlserver/modules" ] && exit 0 +exit 1 From d9017c7f13b8355d85f51e8cb48abc6d1e810e1b Mon Sep 17 00:00:00 2001 From: galiacheng Date: Mon, 15 Jul 2024 13:41:47 +0800 Subject: [PATCH 2/5] install docker for global used. --- .../main/arm/scripts/inline-scripts/validateParameters.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 371104665..5134600d2 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 @@ -686,6 +683,9 @@ checkDNSZone=${12} outputAksVersion=${constDefaultAKSVersion} sslCertificateKeyVaultOption="keyVaultStoredConfig" +# install docker cli +install_docker + validate_compute_resources validate_memory_resources From a9fedeac19656694da79dd4907ac9c2a098a0f6c Mon Sep 17 00:00:00 2001 From: galiacheng Date: Mon, 15 Jul 2024 13:59:28 +0800 Subject: [PATCH 3/5] Merge oracle/main. --- .../src/main/arm/createUiDefinition.json | 2 - .../inline-scripts/validateParameters.sh | 17 +++- .../bicep/modules/_azure-resoruces/_aks.bicep | 8 +- .../_ds-validate-parameters.bicep | 1 + .../bicep/modules/setupWebLogicCluster.bicep | 2 + .../test/scripts/verify-services.sh | 78 +++++++++---------- .../test/scripts/verify-wls-path.sh | 12 +-- 7 files changed, 66 insertions(+), 54 deletions(-) diff --git a/weblogic-azure-aks/src/main/arm/createUiDefinition.json b/weblogic-azure-aks/src/main/arm/createUiDefinition.json index 856a8dac2..9daa942d3 100644 --- a/weblogic-azure-aks/src/main/arm/createUiDefinition.json +++ b/weblogic-azure-aks/src/main/arm/createUiDefinition.json @@ -329,8 +329,6 @@ "Standard_DS2_v2" ], "constraints": { - "numAvailabilityZonesRequired": 3, - "zone": "3", "excludedSizes": [ "Standard_A0", "Standard_A1", 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 5134600d2..71a1a0fa5 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 @@ -657,11 +657,24 @@ function validate_appgateway_vnet() { fi } +function query_available_zones() { + if [[ "${createAKSCluster,,}" == "true" ]]; then + outputAvailableZones=$(az vm list-skus -l ${location} --size ${aksAgentPoolVMSize} --zone true | jq -c '.[] | .locationInfo[] | .zones') + fi + + if [ -z "${outputAvailableZones}" ]; then + outputAvailableZones="[]" + fi + + export outputAvailableZones="${outputAvailableZones}" +} + function output_result() { echo "AKS version: ${outputAksVersion}" result=$(jq -n -c \ --arg aksVersion "$outputAksVersion" \ - '{aksVersion: $aksVersion}') + --arg agentAvailabilityZones "${outputAvailableZones}" \ + '{aksVersion: $aksVersion, agentAvailabilityZones: $agentAvailabilityZones}') echo "result is: $result" echo $result >$AZ_SCRIPTS_OUTPUT_PATH } @@ -716,4 +729,6 @@ fi validate_appgateway_vnet +query_available_zones + output_result diff --git a/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep b/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep index e9f7bae03..0f494cfc8 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_aks.bicep @@ -7,6 +7,7 @@ param aciResourcePermissions bool = true param aciRetentionInDays int = 120 @description('Pricing tier: PerGB2018 or legacy tiers (Free, Standalone, PerNode, Standard or Premium) which are not available to all customers.') param aciWorkspaceSku string = 'pergb2018' +param agentAvailabilityZones array = [] @maxLength(12) @minLength(1) @description('The name for this node pool. Node pool must contain only lowercase letters and numbers. For Linux node pools the name cannot be longer than 12 characters.') @@ -27,11 +28,6 @@ param location string param utcValue string = utcNow() var const_aksAgentPoolOSDiskSizeGB = 128 -var const_aksAvailabilityZones = [ - '1' - '2' - '3' -] var name_aciWorkspace = 'Workspace-${guid(utcValue)}-${location}' // Generate a unique AKS name scoped to subscription. var name_aksClusterNameForSV = '${aksClusterNamePrefix}${uniqueString(utcValue)}' @@ -79,7 +75,7 @@ resource aksCluster 'Microsoft.ContainerService/managedClusters@${azure.apiVersi osDiskType: 'Managed' kubeletDiskType: 'OS' type: 'VirtualMachineScaleSets' - availabilityZones: const_aksAvailabilityZones + availabilityZones: agentAvailabilityZones mode: 'System' osType: 'Linux' } diff --git a/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep b/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep index 6b0aa0011..209666eaf 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-validate-parameters.bicep @@ -247,3 +247,4 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@${azure.apiVers } output aksVersion string = deploymentScript.properties.outputs.aksVersion +output aksAgentAvailabilityZones array = json(deploymentScript.properties.outputs.agentAvailabilityZones) diff --git a/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep b/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep index e44e08af3..1fbeab1cc 100644 --- a/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep +++ b/weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep @@ -29,6 +29,7 @@ param aciRetentionInDays int = 120 param aciWorkspaceSku string = 'pergb2018' param acrName string = '' param acrResourceGroupName string = '' +param aksAgentAvailabilityZones array = [] @maxLength(12) @minLength(1) @description('The name for this node pool. Node pool must contain only lowercase letters and numbers. For Linux node pools the name cannot be longer than 12 characters.') @@ -162,6 +163,7 @@ module aksClusterDeployment './_azure-resoruces/_aks.bicep' = if (createAKSClust aciResourcePermissions: aciResourcePermissions aciRetentionInDays: aciRetentionInDays aciWorkspaceSku: aciWorkspaceSku + agentAvailabilityZones: aksAgentAvailabilityZones aksAgentPoolName: aksAgentPoolName aksAgentPoolNodeCount: aksAgentPoolNodeCount aksAgentPoolNodeMaxCount: aksAgentPoolNodeMaxCount diff --git a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh index f9a7aa48f..728f1f8a5 100644 --- a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh +++ b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-services.sh @@ -1,39 +1,39 @@ -#!/bin/bash -# Copyright (c) 2021, Oracle and/or its affiliates. -# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - -# Verify the service using systemctl status -function verifyServiceStatus() -{ - serviceName=$1 - systemctl status $serviceName | grep "active (running)" - if [[ $? != 0 ]]; then - echo "$serviceName is not in active (running) state" - exit 1 - fi - echo "$serviceName is active (running)" -} - -#Verify the service using systemctl is-active -function verifyServiceActive() -{ - serviceName=$1 - state=$(systemctl is-active $serviceName) - if [[ $state == "active" ]]; then - echo "$serviceName is active" - else - echo "$serviceName is not active" - exit 1 - fi -} - -echo "Testing on admin server" -servicesList="rngd wls_admin" - -for service in $servicesList -do - verifyServiceStatus $service - verifyServiceActive $service -done - -exit 0 +#!/bin/bash +# Copyright (c) 2021, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +# Verify the service using systemctl status +function verifyServiceStatus() +{ + serviceName=$1 + systemctl status $serviceName | grep "active (running)" + if [[ $? != 0 ]]; then + echo "$serviceName is not in active (running) state" + exit 1 + fi + echo "$serviceName is active (running)" +} + +#Verify the service using systemctl is-active +function verifyServiceActive() +{ + serviceName=$1 + state=$(systemctl is-active $serviceName) + if [[ $state == "active" ]]; then + echo "$serviceName is active" + else + echo "$serviceName is not active" + exit 1 + fi +} + +echo "Testing on admin server" +servicesList="rngd wls_admin" + +for service in $servicesList +do + verifyServiceStatus $service + verifyServiceActive $service +done + +exit 0 diff --git a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh index 3f5c267fe..d6ff190af 100644 --- a/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh +++ b/weblogic-azure-vm/arm-oraclelinux-wls-admin/test/scripts/verify-wls-path.sh @@ -1,6 +1,6 @@ -#!/bin/bash -# Copyright (c) 2021, Oracle and/or its affiliates. -# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. - -echo "#adminPasswordOrKey#" | sudo -S [ -d "/u01/app/wls/install/oracle/middleware/oracle_home/wlserver/modules" ] && exit 0 -exit 1 +#!/bin/bash +# Copyright (c) 2021, Oracle and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +echo "#adminPasswordOrKey#" | sudo -S [ -d "/u01/app/wls/install/oracle/middleware/oracle_home/wlserver/modules" ] && exit 0 +exit 1 From af99f3fbbe09c9aafd5784bf35923ff6d1ffc466 Mon Sep 17 00:00:00 2001 From: Ed Burns Date: Mon, 15 Jul 2024 21:50:22 -0400 Subject: [PATCH 4/5] Give the reader a selectable link. --- weblogic-azure-aks/src/main/arm/createUiDefinition.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weblogic-azure-aks/src/main/arm/createUiDefinition.json b/weblogic-azure-aks/src/main/arm/createUiDefinition.json index 9daa942d3..21e269e66 100644 --- a/weblogic-azure-aks/src/main/arm/createUiDefinition.json +++ b/weblogic-azure-aks/src/main/arm/createUiDefinition.json @@ -608,7 +608,7 @@ "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 https://learn.microsoft.com/azure/virtual-machines/vm-naming-conventions." + "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." } } ], From dfcee09da6181fb67d27c281f544a77c504e767d Mon Sep 17 00:00:00 2001 From: Ed Burns Date: Mon, 15 Jul 2024 21:58:57 -0400 Subject: [PATCH 5/5] In error message, say which ISA are supported. --- .../src/main/arm/scripts/inline-scripts/validateParameters.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 71a1a0fa5..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 @@ -211,7 +211,7 @@ function obtain_image_architecture() { elif [[ $ret == *"${constARM64Platform}"* ]]; then imageArch="${constARM64Platform}" else - echo_stderr "The architecture of image is not supported." + echo_stderr "The architecture of image is not supported. Currently only ARM64 and AMD64 are supported." exit 1 fi fi