Skip to content

Commit e1adb90

Browse files
galiachengedburns
andauthored
Support arm64 architecture (#321)
* suppprt arm64 arch for the multi-platforms images. * install docker for global used. * Merge oracle/main. * Give the reader a selectable link. * In error message, say which ISA are supported. --------- Co-authored-by: Ed Burns <[email protected]>
1 parent bb86c85 commit e1adb90

File tree

12 files changed

+190
-25
lines changed

12 files changed

+190
-25
lines changed

.github/workflows/testWlsAksWithDependencyCreation.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
description: 'Replaced into https://raw.githubusercontent.com/#gitUserName#/weblogic-azure/#testbranchName#/weblogic-azure-aks/src/main/arm/'
1616
required: true
1717
default: main
18+
vmSize:
19+
description: 'The VM size for the AKS pool'
20+
required: true
21+
default: Standard_D2s_v3
1822
# sample cURL
1923
# curl --verbose -X POST https://api.github.com/repos/<github_user>/weblogic-azure/dispatches -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token <personal_access_token>' --data '{"event_type": "aks-integration-test-with-dependency-creation", "client_payload": {"gitUserNameForArtifactsLocation": "<github_user>", "testBranchNameForArtifactsLocation": "<branch_name>", "isForDemo": "false"}}'
2024
repository_dispatch:
@@ -46,6 +50,7 @@ jobs:
4650
gitUserNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.gitUserNameForArtifactsLocation }}
4751
testBranchNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.testBranchNameForArtifactsLocation }}
4852
azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}}
53+
vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }}
4954
runs-on: ubuntu-latest
5055
steps:
5156
- uses: actions/[email protected]
@@ -71,19 +76,23 @@ jobs:
7176
isForDemo=${{ github.event.inputs.isForDemo }}
7277
gitUserNameForArtifactsLocation=${{ github.event.inputs.gitUserNameForArtifactsLocation }}
7378
testBranchNameForArtifactsLocation=${{ github.event.inputs.testBranchNameForArtifactsLocation }}
79+
vmSize=${{ github.event.inputs.vmSize }}
7480
else
7581
isForDemo=${{ github.event.client_payload.isForDemo }}
7682
gitUserNameForArtifactsLocation=${{ github.event.client_payload.gitUserNameForArtifactsLocation }}
7783
testBranchNameForArtifactsLocation=${{ github.event.client_payload.testBranchNameForArtifactsLocation }}
84+
vmSize=${{ github.event.client_payload.vmSize }}
7885
fi
7986
8087
echo "##[set-output name=isForDemo;]${isForDemo}"
8188
echo "##[set-output name=gitUserNameForArtifactsLocation;]${gitUserNameForArtifactsLocation}"
8289
echo "##[set-output name=testBranchNameForArtifactsLocation;]${testBranchNameForArtifactsLocation}"
90+
echo "##[set-output name=vmSize;]${vmSize}"
8391
8492
echo "isForDemo=${isForDemo}" >> $GITHUB_ENV
8593
echo "gitUserNameForArtifactsLocation=${gitUserNameForArtifactsLocation}" >> $GITHUB_ENV
8694
echo "testBranchNameForArtifactsLocation=${testBranchNameForArtifactsLocation}" >> $GITHUB_ENV
95+
echo "vmSize=${vmSize}" >> $GITHUB_ENV
8796
- uses: actions/[email protected]
8897
- name: Set up Maven with GitHub token
8998
uses: ./.github/actions/setupmaven
@@ -273,6 +282,7 @@ jobs:
273282
${wdtRuntimePassword} \
274283
${wlsPassword} \
275284
${wlsUserName} \
285+
${{ needs.preflight.outputs.vmSize }} \
276286
weblogic-azure/weblogic-azure-aks/src/test/setupWlsAksParameters.jsonc
277287
- name: Deploy WebLogic Server Cluster Domain offer
278288
id: deploy-wls-cluster

.github/workflows/testWlsAksWithoutDependencyCreation.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
gitUserNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.gitUserNameForArtifactsLocation }}
6060
testBranchNameForArtifactsLocation: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.testBranchNameForArtifactsLocation }}
6161
azCliVersion: ${{steps.set-az-cli-version.outputs.azCliVersion}}
62+
vmSize: ${{ steps.setup-env-variables-based-on-dispatch-event.outputs.vmSize }}
6263
steps:
6364
- uses: actions/[email protected]
6465
- name: Set AZ CLI Version
@@ -87,6 +88,7 @@ jobs:
8788
isForDemo=${{ github.event.inputs.isForDemo }}
8889
gitUserNameForArtifactsLocation=${{ github.event.inputs.gitUserNameForArtifactsLocation }}
8990
testBranchNameForArtifactsLocation=${{ github.event.inputs.testBranchNameForArtifactsLocation }}
91+
vmSize=${{ github.event.inputs.vmSize }}
9092
else
9193
resourceGroupForWlsAks=wlsd-aks-${{ github.event.client_payload.disambiguationSuffix }}-${{ github.run_number }}
9294
dbName=${{ github.event.client_payload.dbName }}
@@ -95,6 +97,7 @@ jobs:
9597
isForDemo=${{ github.event.client_payload.isForDemo }}
9698
gitUserNameForArtifactsLocation=${{ github.event.client_payload.gitUserNameForArtifactsLocation }}
9799
testBranchNameForArtifactsLocation=${{ github.event.client_payload.testBranchNameForArtifactsLocation }}
100+
vmSize=${{ github.event.client_payload.vmSize }}
98101
fi
99102
100103
echo "##[set-output name=resourceGroupForWlsAks;]${resourceGroupForWlsAks}"
@@ -104,6 +107,7 @@ jobs:
104107
echo "##[set-output name=isForDemo;]${isForDemo}"
105108
echo "##[set-output name=gitUserNameForArtifactsLocation;]${gitUserNameForArtifactsLocation}"
106109
echo "##[set-output name=testBranchNameForArtifactsLocation;]${testBranchNameForArtifactsLocation}"
110+
echo "##[set-output name=vmSize;]${vmSize}"
107111
108112
echo "resourceGroupForWlsAks=${resourceGroupForWlsAks}" >> $GITHUB_ENV
109113
echo "dbName=${dbName}" >> $GITHUB_ENV
@@ -112,6 +116,7 @@ jobs:
112116
echo "isForDemo=${isForDemo}" >> $GITHUB_ENV
113117
echo "gitUserNameForArtifactsLocation=${gitUserNameForArtifactsLocation}" >> $GITHUB_ENV
114118
echo "testBranchNameForArtifactsLocation=${testBranchNameForArtifactsLocation}" >> $GITHUB_ENV
119+
echo "vmSize=${vmSize}" >> $GITHUB_ENV
115120
- uses: actions/[email protected]
116121
- name: Set up Maven with GitHub token
117122
uses: ./.github/actions/setupmaven
@@ -240,6 +245,7 @@ jobs:
240245
${wdtRuntimePassword} \
241246
${wlsPassword} \
242247
${wlsUserName} \
248+
${{ needs.preflight.outputs.vmSize }} \
243249
weblogic-azure/weblogic-azure-aks/src/test/setupWlsAksParameters.jsonc
244250
- name: Deploy WebLogic Server Cluster Domain offer
245251
id: deploy-wls-cluster

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<properties>
4141
<!-- versions start -->
4242
<!-- weblogic azure aks versions -->
43-
<version.wls-on-aks-azure-marketplace>1.0.79</version.wls-on-aks-azure-marketplace>
43+
<version.wls-on-aks-azure-marketplace>1.0.80</version.wls-on-aks-azure-marketplace>
4444
<!-- weblogic azure vm versions -->
4545
<version.arm-oraclelinux-wls>1.0.27</version.arm-oraclelinux-wls>
4646
<version.arm-oraclelinux-wls-admin>1.0.51</version.arm-oraclelinux-wls-admin>

weblogic-azure-aks/src/main/arm/createUiDefinition.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,15 @@
601601
}
602602
]
603603
}
604+
},
605+
{
606+
"name": "unsupportedPlatformInfo1",
607+
"type": "Microsoft.Common.InfoBox",
608+
"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))))]",
609+
"options": {
610+
"icon": "Error",
611+
"text": "The selected image is not compatible with the ARM64 platform. Please choose a different image or select a different size from <b>AKS</b> -> <b>Azure Kubernetes Service</b> -> <b>Node size</b>. For more information, see <a href=https://learn.microsoft.com/azure/virtual-machines/vm-naming-conventions>the Azure documentation</a>."
612+
}
604613
}
605614
],
606615
"visible": true
@@ -2418,4 +2427,4 @@
24182427
"wlsUserName": "[basics('basicsRequired').wlsUserName]"
24192428
}
24202429
}
2421-
}
2430+
}

weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,39 +187,78 @@ function download_mysql_driver() {
187187
fi
188188
}
189189

190-
# Install docker, zip, unzip and java
191-
# Download WebLogic Tools
192-
function install_utilities() {
193-
# Install docker
190+
function install_docker_multi_arch(){
191+
# Install docker https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
192+
# Add Docker's official GPG key:
194193
sudo apt-get -q update
195-
sudo apt-get -y -q install apt-transport-https
196-
curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
194+
sudo apt-get -y -q install ca-certificates curl
195+
sudo install -m 0755 -d /etc/apt/keyrings
196+
sudo curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
197+
sudo chmod a+r /etc/apt/keyrings/docker.asc
198+
199+
# Add the repository to Apt sources:
197200
echo \
198-
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
199-
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
201+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
202+
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
203+
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
200204
sudo apt-get -q update
201205
sudo apt-get -y -q install docker-ce docker-ce-cli containerd.io
202206

203207
echo "docker version"
204208
sudo docker --version
205209
validate_status "Check status of docker."
206210
sudo systemctl start docker
211+
}
207212

213+
function install_openjdk11_x64(){
208214
# Install Microsoft OpenJDK
209-
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
215+
# Valid values are only '18.04', '20.04', and '22.04'
216+
ubuntu_release=`lsb_release -rs`
217+
wget https://packages.microsoft.com/config/ubuntu/${ubuntu_release}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
210218
sudo dpkg -i packages-microsoft-prod.deb
211-
sudo apt -q update
212-
sudo apt -y -q install msopenjdk-11
219+
220+
sudo apt-get -y -q install apt-transport-https
221+
sudo apt-get -q update
222+
sudo apt-get -y -q install msopenjdk-11
213223

214224
echo "java version"
215225
java -version
216-
validate_status "Check status of Zulu JDK 8."
226+
validate_status "Check status of OpenJDK 11."
227+
228+
229+
export JAVA_HOME=/usr/lib/jvm/msopenjdk-11-$(dpkg --print-architecture)
230+
if [ ! -d "${JAVA_HOME}" ]; then
231+
echo "Java home ${JAVA_HOME} does not exist."
232+
exit 1
233+
fi
234+
}
235+
236+
function install_openjdk11_arm64(){
237+
local zipFileName="microsoft-jdk-11.tar.gz"
238+
sudo curl -m ${curlMaxTime} --retry ${retryMaxAttempt} -fsSL ${jdkArm64Url} -o ${zipFileName}
239+
sudo mkdir -p /usr/lib/jvm
240+
local dirName=$(sudo tar -xzvf ${zipFileName} | head -1 | cut -f1 -d"/")
241+
sudo tar -xzvf ${zipFileName}
242+
sudo mv ${dirName} msopenjdk-11-amd64
243+
sudo mv -f msopenjdk-11-amd64 /usr/lib/jvm/
217244

218245
export JAVA_HOME=/usr/lib/jvm/msopenjdk-11-amd64
219246
if [ ! -d "${JAVA_HOME}" ]; then
220247
echo "Java home ${JAVA_HOME} does not exist"
221248
exit 1
222249
fi
250+
}
251+
252+
# Install docker, zip, unzip and java
253+
# Download WebLogic Tools
254+
function install_utilities() {
255+
install_docker_multi_arch
256+
257+
if [[ "$(dpkg --print-architecture)" == "arm64" ]]; then
258+
install_openjdk11_arm64
259+
else
260+
install_openjdk11_x64
261+
fi
223262

224263
sudo apt -y -q install zip
225264
zip --help
@@ -378,6 +417,7 @@ function build_wls_image() {
378417
--wdtArchive ${scriptDir}/model-images/archive.zip \
379418
--wdtModelOnly \
380419
--wdtDomainType WLS \
420+
--platform ${cpuPlatform} \
381421
--chown ${user}:${group}
382422

383423
validate_status "Check status of building WLS domain image."
@@ -413,6 +453,7 @@ export useOracleImage=${11}
413453
export dbDriversUrls=${12}
414454
export enablePswlessConnection=${13}
415455
export dbType=${14}
456+
export cpuPlatform=${15}
416457

417458
export acrImagePath="$azureACRServer/aks-wls-images:${imageTag}"
418459

weblogic-azure-aks/src/main/arm/scripts/common.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export constAdminT3AddressEnvName="T3_TUNNELING_ADMIN_ADDRESS"
2222
export constAdminServerName='admin-server'
2323
export constClusterName='cluster-1'
2424
export constClusterT3AddressEnvName="T3_TUNNELING_CLUSTER_ADDRESS"
25+
export constARM64Platform="arm64"
26+
export constX86Platform="amd64"
27+
export constMultiArchPlatform="Multi-architecture"
2528
export constDBTypeMySQL="mysql"
2629
export constDBTypeSqlServer="sqlserver"
2730
export constDefaultJavaOptions="-Dlog4j2.formatMsgNoLookups=true -Dweblogic.StdoutDebugEnabled=false" # the java options will be applied to the cluster
@@ -63,3 +66,4 @@ export retryInterval=10
6366
export wlsContainerName="weblogic-server"
6467
export wlsPostgresqlDriverUrl="https://jdbc.postgresql.org/download/postgresql-42.5.1.jar"
6568
export wlsMSSQLDriverUrl="https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/mssql-jdbc/10.2.1.jre8/mssql-jdbc-10.2.1.jre8.jar"
69+
export jdkArm64Url="https://aka.ms/download-jdk/microsoft-jdk-11.0.23-linux-aarch64.tar.gz"

weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,40 @@ function build_docker_image() {
9696
# Create vm to build docker image
9797
vmName="VM-UBUNTU-WLS-AKS-$(date +%s)"
9898

99+
# az vm image list --publisher Canonical --offer UbuntuServer --all -o table
100+
ubuntuImage="Canonical:UbuntuServer:18.04-LTS:latest"
101+
102+
if [[ "${CPU_PLATFORM}" == "${constARM64Platform}" ]]; then
103+
ubuntuImage="Canonical:UbuntuServer:18_04-lts-arm64:latest"
104+
fi
105+
106+
# query AKS vm size
107+
# use the same VM size to create the Ubuntu machine, make sure the architecture is matched.
108+
local vmSize=$(az aks show --name ${AKS_CLUSTER_NAME} --resource-group ${AKS_CLUSTER_RESOURCEGROUP_NAME} \
109+
| jq '.agentPoolProfiles[] | select(.name=="agentpool") | .vmSize' \
110+
| tr -d "\"")
111+
112+
# if vmSize is empty or null, exit
113+
if [[ "${vmSize}" == "" || "${vmSize}" == "null" ]]; then
114+
echo_stderr "Failed to obtain VM size of AKS ${AKS_CLUSTER_NAME} in ${AKS_CLUSTER_RESOURCEGROUP_NAME}."
115+
exit 1
116+
fi
117+
99118
# MICROSOFT_INTERNAL
100119
# Specify tag 'SkipASMAzSecPack' to skip policy 'linuxazuresecuritypackautodeployiaas_1.6'
101120
# Specify tag 'SkipNRMS*' to skip Microsoft internal NRMS policy, which causes vm-redeployed issue
102121
az vm create \
103122
--resource-group ${CURRENT_RESOURCEGROUP_NAME} \
104123
--name ${vmName} \
105-
--image "Canonical:UbuntuServer:18.04-LTS:latest" \
124+
--image "${ubuntuImage}" \
106125
--admin-username azureuser \
107126
--generate-ssh-keys \
108127
--nsg-rule NONE \
109128
--enable-agent true \
110129
--vnet-name ${vmName}VNET \
111130
--enable-auto-update false \
112131
--public-ip-address "" \
132+
--size ${vmSize} \
113133
--tags SkipASMAzSecPack=true SkipNRMSCorp=true SkipNRMSDatabricks=true SkipNRMSDB=true SkipNRMSHigh=true SkipNRMSMedium=true SkipNRMSRDPSSH=true SkipNRMSSAW=true SkipNRMSMgmt=true --verbose
114134

115135
if [[ "${USE_ORACLE_IMAGE,,}" == "${constTrue}" ]]; then
@@ -128,7 +148,7 @@ function build_docker_image() {
128148
--publisher Microsoft.Azure.Extensions \
129149
--version 2.0 \
130150
--settings "{ \"fileUris\": [\"${SCRIPT_LOCATION}model.properties\",\"${SCRIPT_LOCATION}genImageModel.sh\",\"${SCRIPT_LOCATION}buildWLSDockerImage.sh\",\"${SCRIPT_LOCATION}common.sh\"]}" \
131-
--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} \"}"
151+
--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} \"}"
132152

133153
cleanup_vm
134154
}

0 commit comments

Comments
 (0)