Products | Versions |
---|---|
TIBCO ModelOps | 1.2 |
set AZ_APP_DISPLAY_NAME=ModelOpsAzApp set MODELOPS_ROOT_PASSWORD=tibco123 set AKS_ES_PASSWORD=ElAsticPW123 set AKS_GIT_PASSWORD=G1tPW123 set AKS_NEXUS_PASSWORD=NxtPW123 set AKS_SCORING_PASSWORD=Sc0rePW123 set MODELOPS_NAMESPACE=modelops12
set MODELOPS_HOME=C:\TIBCO\modelops\1.2 set AZ_GROUP_NAME=azgroup set DNS_ZONE=az.companycloud.com
set AZ_ACR_NAME=azacr set AKS_CLUSTER_NAME=aksapps set AKS_NODEPOOL_NAME=npmo12 set AKS_WIN_USERNAME=azwinuser set AKS_WIN_PASSWORD=P@ssw0rd1234567!
You must follow Azure naming conventions for the node pool name and the Azure Windows password. Ref:
REM First check for any existing service principal names that REM match the value you've set for AZ_APP_DISPLAY_NAME. FOR /F "tokens=* USEBACKQ" %F ^ IN ( `az ad sp list --all --filter "displayname eq '%AZ_APP_DISPLAY_NAME%'" ^| jq .[].displayName` ) ^ DO ( set FOUND_AZ_APP_NAME=%F ) IF DEFINED FOUND_AZ_APP_NAME ECHO ^ A service principal with display name %FOUND_AZ_APP_NAME% ^ already exists. Please start over from a new command prompt ^ and choose a different value for AZ_APP_DISPLAY_NAME. REM Get the tenant ID del /f az-login-info.json call az login > az-login-info.json FOR /F "tokens=* USEBACKQ" %F ^ IN ( `jq .[].tenantId az-login-info.json` ) ^ DO (set AZ_TENANT_ID=%F) set AZ_TENANT_ID=%AZ_TENANT_ID:"=% echo AZ_TENANT_ID is: %AZ_TENANT_ID% REM Get the first subscription ID from your Azure subscriptions list del /f az-subscriptions-list.json call az account subscription list > az-subscriptions-list.json FOR /F "tokens=* USEBACKQ" %F ^ IN ( `jq .[0].subscriptionId az-subscriptions-list.json` ) ^ DO (set AZ_SUBSCRIPTION_ID=%F) set AZ_SUBSCRIPTION_ID=%AZ_SUBSCRIPTION_ID:"=% echo AZ_SUBSCRIPTION_ID is %AZ_SUBSCRIPTION_ID% REM Create the app, adding the ModelOps server 'Admin' App Role and the redirect URI del /f app-role-manifest.json echo ^ [{ ^ "allowedMemberTypes": [ ^ "User" ^ ], ^ "description": "Admin App Role for ModelOps applications.", ^ "displayName": "ModelOpsAdmin", ^ "isEnabled": "true", ^ "value": "Admin" ^ }] | jq . > app-role-manifest.json del /f az-app-manifest.json call az ad app create ^ --display-name %AZ_APP_DISPLAY_NAME% ^ --app-roles "@app-role-manifest.json" ^ --web-redirect-uris "https://modelops-server.%AKS_CLUSTER_NAME%.%DNS_ZONE%/oauth2/callback" ^ --enable-access-token-issuance true ^ --enable-id-token-issuance true > az-app-manifest.json REM Create the application's service principal and secret. REM Assign the Azure 'Contributor' role to start del /f az-sp-info.json call az ad sp create-for-rbac ^ --name %AZ_APP_DISPLAY_NAME% ^ --role "Contributor" ^ --scopes /subscriptions/%AZ_SUBSCRIPTION_ID%/resourceGroups/%AZ_GROUP_NAME% > az-sp-info.json FOR /F "tokens=* USEBACKQ" %F ^ IN ( `jq .password az-sp-info.json` ) ^ DO (set AZ_APP_SECRET=%F) set AZ_APP_SECRET=%AZ_APP_SECRET:"=% echo AZ_APP_SECRET is %AZ_APP_SECRET% FOR /F "tokens=* USEBACKQ" %F ^ IN ( `jq .appId az-sp-info.json` ) ^ DO (set AZ_SERVICE_PRINCIPAL_ID=%F) set AZ_SERVICE_PRINCIPAL_ID=%AZ_SERVICE_PRINCIPAL_ID:"=% echo AZ_SERVICE_PRINCIPAL_ID is %AZ_SERVICE_PRINCIPAL_ID% REM Add Microsoft Graph API User.Read permission to the app call az ad app permission add ^ --id %AZ_SERVICE_PRINCIPAL_ID% ^ --api 00000003-0000-0000-c000-000000000000 ^ --api-permissions e1fe6dd8-ba31-4d61-89e7-88639da4683d=Scope
Invoking `az ad app permission grant --id %AZ_SERVICE_PRINCIPAL_ID% --api 00000003-0000-0000-c000-000000000000` is needed to make the change effective
REM Add ACR Push/Pull & User Access Administrator role assignments call az role assignment create ^ --role "AcrPush" ^ --scope /subscriptions/%AZ_SUBSCRIPTION_ID%/resourceGroups/%AZ_GROUP_NAME% ^ --assignee %AZ_SERVICE_PRINCIPAL_ID% call az role assignment create ^ --role "AcrPull" ^ --scope /subscriptions/%AZ_SUBSCRIPTION_ID%/resourceGroups/%AZ_GROUP_NAME% ^ --assignee %AZ_SERVICE_PRINCIPAL_ID% call az role assignment create ^ --role "User Access Administrator" ^ --scope /subscriptions/%AZ_SUBSCRIPTION_ID%/resourceGroups/%AZ_GROUP_NAME% ^ --assignee %AZ_SERVICE_PRINCIPAL_ID% REM Wait 60 seconds for role assignments to propagate timeout 60 >nul
call az login ^ --service-principal ^ --username=%AZ_SERVICE_PRINCIPAL_ID% ^ --password=%AZ_APP_SECRET% ^ --tenant=%AZ_TENANT_ID% call az acr create ^ --name=%AZ_ACR_NAME% ^ --resource-group=%AZ_GROUP_NAME% ^ --sku=basic --output=json
call az aks create ^ --resource-group=%AZ_GROUP_NAME% ^ --service-principal=%AZ_SERVICE_PRINCIPAL_ID% ^ --client-secret=%AZ_APP_SECRET% ^ --name=%AKS_CLUSTER_NAME% ^ --max-pods=200 ^ --node-count 1 ^ --enable-cluster-autoscaler ^ --min-count=1 ^ --max-count=5 ^ --no-ssh-key ^ --windows-admin-password=%AKS_WIN_PASSWORD% ^ --windows-admin-username=%AKS_WIN_USERNAME% ^ --vm-set-type=VirtualMachineScaleSets ^ --node-vm-size=Standard_B8ms ^ --network-plugin=azure ^ --attach-acr=%AZ_ACR_NAME% ^ --output=json
call az aks nodepool add ^ --resource-group=%AZ_GROUP_NAME% ^ --cluster-name=%AKS_CLUSTER_NAME% ^ --os-type=Windows ^ --name=%AKS_NODEPOOL_NAME% ^ --node-count=1 ^ --enable-cluster-autoscaler ^ --min-count=1 ^ --max-count=2 ^ --node-vm-size=Standard_B8ms ^ --node-taints=os=windows:NoSchedule ^ --output=json
call az aks get-credentials ^ --overwrite-existing ^ --resource-group=%AZ_GROUP_NAME% ^ --name=%AKS_CLUSTER_NAME% kubectl get node
kubectl create namespace %MODELOPS_NAMESPACE% kubectl config set-context --current --namespace=%MODELOPS_NAMESPACE% del /f secret.yaml kubectl create secret generic elasticsearch-es-elastic-user ^ --from-literal=elastic=%AKS_ES_PASSWORD% ^ --dry-run=client --output=yaml > secret.yaml 2>&1 kubectl apply -f secret.yaml del /f secret.yaml kubectl create secret generic git-server --from-literal=modelops=%AKS_GIT_PASSWORD% kubectl create secret generic nexus-server --from-literal=admin=%AKS_NEXUS_PASSWORD% kubectl create secret generic scoring-admin --from-literal=admin=%AKS_SCORING_PASSWORD% kubectl create secret generic modelops-server --from-literal=admin=%MODELOPS_ROOT_PASSWORD% kubectl create secret generic oauth2 --from-literal=TENANT_ID=%AZ_TENANT_ID% ^ --from-literal=CLIENT_ID=%AZ_SERVICE_PRINCIPAL_ID% ^ --from-literal=CLIENT_SECRET=%AZ_APP_SECRET% kubectl create secret generic externaldns-config --from-literal=azure.json=^ "{ \"tenantId\": \"%AZ_TENANT_ID%\", ^ \"subscriptionId\": \"%AZ_SUBSCRIPTION_ID%\", ^ \"resourceGroup\": \"%AZ_GROUP_NAME%\", ^ \"aadClientId\": \"%AZ_SERVICE_PRINCIPAL_ID%\", ^ \"aadClientSecret\": \"%AZ_APP_SECRET%\" }"
helm upgrade ^ --install %MODELOPS_NAMESPACE%-release "%MODELOPS_HOME%\helm-charts\kubernetes-installer-1.0.2.tgz" ^ --atomic ^ --set cloud="aks" ^ --set aks.containerRegistry="%AZ_ACR_NAME%.azurecr.io" ^ --set aks.containerUsername="%AZ_SERVICE_PRINCIPAL_ID%" ^ --set aks.containerPassword="%AZ_APP_SECRET%" ^ --set aks.azureTenantId="%AZ_TENANT_ID%" ^ --namespace %MODELOPS_NAMESPACE% ^ --set aks.networkExposure="ingress" ^ --set aks.ingressDomain="%AKS_CLUSTER_NAME%.%DNS_ZONE%" ^ --set aks.oauth2="azure" ^ --set medium.nexus.memory="3Gi" ^ --set aks.externalDNS="azure" ^ --timeout 10m0s
cd %MODELOPS_HOME%\maven-repository-artifacts\ kubectl cp modelops-repo-1.2.0-mavenrepo.zip mavenrepo-0:/tmp/
tkn pipelinerun logs bootstrap --follow --namespace %MODELOPS_NAMESPACE%
tkn pipelinerun logs modelops-server --follow --namespace %MODELOPS_NAMESPACE%