Skip to content

Commit

Permalink
Merge pull request WASdev#117 from majguo/auto-scaling
Browse files Browse the repository at this point in the history
Support auto-scaling for app deployment
  • Loading branch information
venunathb authored May 2, 2024
2 parents f80b1b1 + 312c845 commit f4ff741
Show file tree
Hide file tree
Showing 11 changed files with 501 additions and 9 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ on:
required: true
type: boolean
default: true
autoScaling:
description: 'Autoscaling for app deployment'
required: true
type: boolean
default: false
deleteAzureResources:
description: 'Delete Azure resources at the end'
required: true
Expand All @@ -23,14 +28,14 @@ on:
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN>
# REPO_NAME=WASdev/azure.liberty.aro
# Enable/disable WebSphere Liberty Operator and sample application. Keep/delete Azure resources at the end.
# curl --verbose -XPOST -u "WASdev:${PERSONAL_ACCESS_TOKEN}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${REPO_NAME}/actions/workflows/integration-test.yaml/dispatches --data '{"ref": "main", "inputs":{"deployWLO": "true|false", "deployApplication": "true|false", "deleteAzureResources": "true|false"}}'
# curl --verbose -XPOST -u "WASdev:${PERSONAL_ACCESS_TOKEN}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${REPO_NAME}/actions/workflows/integration-test.yaml/dispatches --data '{"ref": "main", "inputs":{"deployWLO": "true|false", "deployApplication": "true|false", "autoScaling": "true|false", "deleteAzureResources": "true|false"}}'
repository_dispatch:
types: [integration-test]
# Allows you to run this workflow using GitHub repository dispatch APIs
# PERSONAL_ACCESS_TOKEN=<GITHUB_PERSONAL_ACCESS_TOKEN>
# REPO_NAME=WASdev/azure.liberty.aro
# Enable/disable WebSphere Liberty Operator and sample application. Keep/delete Azure resources at the end.
# curl --verbose -X POST https://api.github.com/repos/${REPO_NAME}/dispatches -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" --data '{"event_type": "integration-test", "client_payload": {"deployWLO": true|false, "deployApplication": true|false, "deleteAzureResources": true|false}}'
# curl --verbose -X POST https://api.github.com/repos/${REPO_NAME}/dispatches -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" --data '{"event_type": "integration-test", "client_payload": {"deployWLO": true|false, "deployApplication": true|false, "autoScaling": "true|false", "deleteAzureResources": "true|false"}}'
env:
repoName: "azure.liberty.aro"
azureCredentials: ${{ secrets.AZURE_CREDENTIALS }}
Expand Down Expand Up @@ -87,10 +92,14 @@ jobs:
deployApplication=true
fi
echo "deployApplication=${deployApplication}" >> $GITHUB_ENV
autoScaling=false
if ${{ inputs.autoScaling == true || github.event.client_payload.autoScaling == true }}; then
autoScaling=true
fi
cd ${{ env.repoName }}
mvn -Dgit.repo=${{ env.userName }} -Dgit.tag=$GITHUB_REF_NAME -DcreateCluster=true \
-DdeployWLO=${deployWLO} -Dedition="IBM WebSphere Application Server" -DproductEntitlementSource="Standalone" \
-DdeployApplication=${deployApplication} -DappImagePath=icr.io/appcafe/open-liberty/samples/getting-started -DappReplicas=2 \
-DdeployApplication=${deployApplication} -DappImagePath=icr.io/appcafe/open-liberty/samples/getting-started -DautoScalingParam=${autoScaling} -DappReplicas=2 \
-Dtest.args="-Test All" -Passembly -Ptemplate-validation-tests clean install
- uses: azure/login@v1
id: azure-login
Expand Down
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

<groupId>com.ibm.websphere.azure</groupId>
<artifactId>azure.liberty.aro</artifactId>
<version>1.0.54</version>
<version>1.0.55</version>

<parent>
<groupId>com.microsoft.azure.iaas</groupId>
<artifactId>azure-javaee-iaas-parent</artifactId>
Expand All @@ -46,6 +47,7 @@
<customer.usage.attribution.id>pid-8942a2f7-32d6-4b69-b504-4c2fb23fe059-partnercenter</customer.usage.attribution.id>
<aro.start>acdd32ed-5fab-54b6-8d5a-097ed3dcfcf2</aro.start>
<aro.end>d9293179-8975-5587-b29f-8f09f2832c4f</aro.end>
<autoscaling.id>d0a92b8b-3759-515b-8b7c-68a68713f5ad</autoscaling.id>
</properties>

<repositories>
Expand Down
147 changes: 146 additions & 1 deletion src/main/arm/createUiDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,62 @@
"type": "Microsoft.Common.Section",
"label": "Provide information to create a new cluster",
"elements": [
{
"name": "aroVmSizeInfo",
"type": "Microsoft.Common.InfoBox",
"options": {
"icon": "Info",
"text": "Azure Red Hat OpenShift requires a minimum of 40 cores to create and run an OpenShift cluster. The default VM sizes satisfy the requirement. For more information on customizing the VM size, consult the <a href='https://azure.microsoft.com/pricing/details/openshift/' target='_blank'>Azure Red Hat OpenShift pricing</a>."
}
},
{
"name": "masterVmSizeSelect",
"type": "Microsoft.Compute.SizeSelector",
"label": "Master VM size",
"toolTip": "The size of the virtual machines for the master nodes in the cluster.",
"recommendedSizes": [
"Standard_D8s_v3"
],
"osPlatform": "Linux",
"count": 3
},
{
"name": "workerVmSizeSelect",
"type": "Microsoft.Compute.SizeSelector",
"label": "Worker VM size",
"toolTip": "The size of the virtual machines for the worker nodes in the cluster.",
"recommendedSizes": [
"Standard_D4s_v3"
],
"osPlatform": "Linux",
"count": "[int(steps('Cluster').createClusterInfo.minWorkerCount)]"
},
{
"name": "minWorkerCount",
"type": "Microsoft.Common.Slider",
"min": 3,
"max": "[int(steps('Cluster').createClusterInfo.maxWorkerCount)]",
"label": "Minimum worker node count",
"defaultValue": 3,
"showStepMarkers": false,
"toolTip": "Set the minimum worker node count for the cluster.",
"constraints": {
"required": true
}
},
{
"name": "maxWorkerCount",
"type": "Microsoft.Common.Slider",
"min": "[int(steps('Cluster').createClusterInfo.minWorkerCount)]",
"max": 100,
"label": "Maximum worker node count",
"defaultValue": 10,
"showStepMarkers": false,
"toolTip": "Set the maximum worker node count for the cluster.",
"constraints": {
"required": true
}
},
{
"name": "pullSecret",
"type": "Microsoft.Common.PasswordBox",
Expand Down Expand Up @@ -392,6 +448,86 @@
],
"visible": "[bool(steps('Application').deployApplication)]"
},
{
"name": "autoScaling",
"type": "Microsoft.Common.OptionsGroup",
"label": "Auto-scale replicas?",
"defaultValue": "No",
"toolTip": "Select 'Yes' to automatically create or delete instances based on resource consumption, or select 'No' to specify static instances.",
"constraints": {
"allowedValues": [
{
"label": "Yes",
"value": "true"
},
{
"label": "No",
"value": "false"
}
],
"required": true
},
"visible": "[bool(steps('Application').deployApplication)]"
},
{
"name": "cpuUtilizationPercentage",
"type": "Microsoft.Common.Slider",
"min": 1,
"max": 100,
"label": "Target average CPU utilization",
"subLabel": "percentage",
"defaultValue": 80,
"showStepMarkers": false,
"toolTip": "Set the target average CPU utilization (percentage) over all the replicas.",
"constraints": {
"required": true
},
"visible": "[and(bool(steps('Application').deployApplication), bool(steps('Application').autoScaling))]"
},
{
"name": "minReplicas",
"type": "Microsoft.Common.Slider",
"min": 1,
"max": "[int(steps('Application').maxReplicas)]",
"label": "Minimum application replicas",
"defaultValue": 1,
"showStepMarkers": false,
"toolTip": "Set the minimum number of application replicas.",
"constraints": {
"required": true
},
"visible": "[and(bool(steps('Application').deployApplication), bool(steps('Application').autoScaling))]"
},
{
"name": "maxReplicas",
"type": "Microsoft.Common.Slider",
"min": "[int(steps('Application').minReplicas)]",
"max": 100,
"label": "Maximum application replicas",
"showStepMarkers": false,
"toolTip": "Set the maximum number of application replicas.",
"constraints": {
"required": true
},
"visible": "[and(bool(steps('Application').deployApplication), bool(steps('Application').autoScaling))]"
},
{
"name": "requestCPUMillicore",
"type": "Microsoft.Common.TextBox",
"label": "Minimum required CPU core (millicore)",
"showStepMarkers": false,
"toolTip": "Set the minimum required CPU core (millicore) over all the replicas.",
"constraints": {
"required": true,
"validations": [
{
"regex": "^[1-9][0-9]*$",
"message": "Only positive numbers are allowed."
}
]
},
"visible": "[and(bool(steps('Application').deployApplication), bool(steps('Application').autoScaling))]"
},
{
"name": "appReplicas",
"type": "Microsoft.Common.Slider",
Expand All @@ -404,14 +540,18 @@
"constraints": {
"required": true
},
"visible": "[bool(steps('Application').deployApplication)]"
"visible": "[and(bool(steps('Application').deployApplication), not(bool(steps('Application').autoScaling)))]"
}
]
}
],
"outputs": {
"location": "[location()]",
"createCluster": "[bool(steps('Cluster').createCluster)]",
"vmSize": "[steps('Cluster').createClusterInfo.masterVmSizeSelect]",
"workerVmSize": "[steps('Cluster').createClusterInfo.workerVmSizeSelect]",
"minWorkerCount": "[int(steps('Cluster').createClusterInfo.minWorkerCount)]",
"maxWorkerCount": "[int(steps('Cluster').createClusterInfo.maxWorkerCount)]",
"pullSecret": "[steps('Cluster').createClusterInfo.pullSecret]",
"aadClientId": "[steps('Cluster').createClusterInfo.aadClientId]",
"aadClientSecret": "[steps('Cluster').createClusterInfo.aadClientSecret]",
Expand All @@ -424,6 +564,11 @@
"productEntitlementSource": "[steps('Application').productEntitlementSource]",
"deployApplication": "[bool(steps('Application').deployApplication)]",
"appImagePath": "[if(equals(steps('Application').appImageInfo.appImageOption, '2'), 'icr.io/appcafe/open-liberty/samples/getting-started', if(equals(steps('Application').appImageInfo.appImageOption, '3'), 'docker.io/ibmcom/websphere-liberty-sample:1.0.0', steps('Application').appImageInfo.appImagePath))]",
"autoScaling": "[bool(steps('Application').autoScaling)]",
"cpuUtilizationPercentage": "[int(steps('Application').cpuUtilizationPercentage)]",
"minReplicas": "[int(steps('Application').minReplicas)]",
"maxReplicas": "[int(steps('Application').maxReplicas)]",
"requestCPUMillicore": "[int(steps('Application').requestCPUMillicore)]",
"appReplicas": "[int(steps('Application').appReplicas)]"
}
}
Expand Down
Loading

0 comments on commit f4ff741

Please sign in to comment.