Skip to content

Commit b2e8fc0

Browse files
authored
Apply recent customer learning to WKS on AKS offer (#317)
* create a different key vault for every deployment. * do not record the keyvault name as we will not reuse it. * increase pom. * add disambiguator suffix to file share name. * do not provision public IP for ubuntu machine.
1 parent e3f2823 commit b2e8fc0

File tree

8 files changed

+18
-41
lines changed

8 files changed

+18
-41
lines changed

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.77</version.wls-on-aks-azure-marketplace>
43+
<version.wls-on-aks-azure-marketplace>1.0.78</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/scripts/createVMAndBuildImage.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ function cleanup_vm() {
3232
| where nics == 1 or nic.properties.primary =~ 'true' or isempty(nic) \
3333
| project nicId = tostring(nic.id)" --query "data[0].nicId" -o tsv)
3434

35-
# query ip id
36-
ipId=$(az graph query -q "Resources \
37-
| where type =~ 'microsoft.network/networkinterfaces' \
38-
| where id=~ '${nicId}' \
39-
| extend ipConfigsCount=array_length(properties.ipConfigurations) \
40-
| mv-expand ipconfig=properties.ipConfigurations \
41-
| where ipConfigsCount == 1 or ipconfig.properties.primary =~ 'true' \
42-
| project publicIpId = tostring(ipconfig.properties.publicIPAddress.id)" --query "data[0].publicIpId" -o tsv)
43-
4435
# query os disk id
4536
osDiskId=$(az graph query -q "Resources \
4637
| where type =~ 'microsoft.compute/virtualmachines' \
@@ -67,8 +58,6 @@ function cleanup_vm() {
6758
az vm delete --ids $vmId --yes
6859
echo "deleting nic ${nicId}"
6960
az network nic delete --ids ${nicId}
70-
echo "deleting public-ip ${ipId}"
71-
az network public-ip delete --ids ${ipId}
7261
echo "deleting disk ${osDiskId}"
7362
az disk delete --yes --ids ${osDiskId}
7463
echo "deleting vnet ${vnetId}"
@@ -120,6 +109,7 @@ function build_docker_image() {
120109
--enable-agent true \
121110
--vnet-name ${vmName}VNET \
122111
--enable-auto-update false \
112+
--public-ip-address "" \
123113
--tags SkipASMAzSecPack=true SkipNRMSCorp=true SkipNRMSDatabricks=true SkipNRMSDB=true SkipNRMSHigh=true SkipNRMSMedium=true SkipNRMSRDPSSH=true SkipNRMSSAW=true SkipNRMSMgmt=true --verbose
124114

125115
if [[ "${USE_ORACLE_IMAGE,,}" == "${constTrue}" ]]; then

weblogic-azure-aks/src/main/arm/scripts/pv.yaml.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
namespace: @NAMESPACE@
2222
azureFile:
2323
secretName: azure-secret
24-
shareName: weblogic
24+
shareName: @FILE_SHARE_NAME@
2525
readOnly: false
2626
mountOptions:
2727
- dir_mode=0777

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ function create_pv() {
548548
sed -i -e "s:@PV_NAME@:${pvName}:g" ${customPVYaml}
549549
sed -i -e "s:@PVC_NAME@:${pvcName}:g" ${customPVYaml}
550550
sed -i -e "s:@STORAGE_ACCOUNT@:${STORAGE_ACCOUNT_NAME}:g" ${customPVYaml}
551+
sed -i -e "s:@FILE_SHARE_NAME@:${FILE_SHARE_NAME}:g" ${customPVYaml}
551552

552553
# generate pv configurations
553554
customPVCYaml=${scriptDir}/pvc.yaml

weblogic-azure-aks/src/main/bicep/mainTemplate.bicep

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -317,21 +317,15 @@ var const_appGatewaySSLCertOptionHaveCert = 'haveCert'
317317
var const_appGatewaySSLCertOptionHaveKeyVault = 'haveKeyVault'
318318
var const_azcliVersion = '2.53.0'
319319
var const_azureSubjectName = format('{0}.{1}.{2}', name_domainLabelforApplicationGateway, location, 'cloudapp.azure.com')
320-
var const_hasTags = contains(resourceGroup(), 'tags')
321-
// If there is not tag 'wlsKeyVault' and key vault is created for the following usage:
322-
// * upload custom TLS/SSL certificates for WLS trust and identity.
323-
// * upload custom certificate for gateway frontend TLS/SSL.
324-
// * generate selfsigned certificate for gateway frontend TLS/SSL.
325-
var const_bCreateNewKeyVault = (!const_hasTags || !contains(resourceGroup().tags, name_tagNameForKeyVault) || empty(resourceGroup().tags.wlsKeyVault)) && ((enableCustomSSL && sslConfigurationAccessOption != const_wlsSSLCertOptionKeyVault) || (enableAppGWIngress && (appGatewayCertificateOption != const_appGatewaySSLCertOptionHaveKeyVault)))
326320
var const_bCreateStorageAccount = (createAKSCluster || !const_hasStorageAccount) && const_enablePV
327321
var const_bValidateApplications= validateApplications && (length(appPackageUrls) > 0)
328322
var const_createNewAcr = useOracleImage && createACR
329323
var const_defaultKeystoreType = 'PKCS12'
330324
var const_enableNetworking = (length(lbSvcValues) > 0) || enableAppGWIngress
331325
var const_enablePV = enableCustomSSL || enableAzureFileShare
326+
var const_fileShareName = 'weblogic-${uniqueString(utcValue)}'
332327
var const_hasStorageAccount = !createAKSCluster && queryStorageAccount.outputs.storageAccount != 'null'
333328
var const_identityKeyStoreType = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultCustomIdentityKeyStoreType : sslUploadedCustomIdentityKeyStoreType
334-
var const_keyvaultNameFromTag = const_hasTags && contains(resourceGroup().tags, name_tagNameForKeyVault) ? resourceGroup().tags.wlsKeyVault : ''
335329
var const_showAdminConsoleExUrl = (length(lbSvcValues) > 0) || (enableAppGWIngress && appgwForAdminServer)
336330
var const_showRemoteAdminConsoleExUrl = ((length(lbSvcValues) > 0) || (enableAppGWIngress && appgwForRemoteConsole)) && !enableCustomSSL
337331
var const_showRemoteAdminConsoleSecuredExUrl = ((length(lbSvcValues) > 0) || (enableAppGWIngress && appgwForRemoteConsole)) && enableCustomSSL
@@ -346,14 +340,12 @@ var name_dnsNameforApplicationGateway = '${dnsNameforApplicationGateway}${take(u
346340
var name_domainLabelforApplicationGateway = take('${name_dnsNameforApplicationGateway}-${toLower(name_rgNameWithoutSpecialCharacter)}-${toLower(wlsDomainName)}', 63)
347341
var name_identityKeyStoreDataSecret = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultCustomIdentityKeyStoreDataSecretName : 'myIdentityKeyStoreData'
348342
var name_identityKeyStorePswSecret = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultCustomIdentityKeyStorePassPhraseSecretName : 'myIdentityKeyStorePsw'
349-
var name_keyVaultName = empty(const_keyvaultNameFromTag) ? '${take('wls-kv${uniqueString(utcValue)}', 24)}' : resourceGroup().tags.wlsKeyVault
343+
var name_keyVaultName = '${take('wls-kv${uniqueString(utcValue)}', 24)}'
350344
var name_privateKeyAliasSecret = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultPrivateKeyAliasSecretName : 'privateKeyAlias'
351345
var name_privateKeyPswSecret = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultPrivateKeyPassPhraseSecretName : 'privateKeyPsw'
352346
var name_rgNameWithoutSpecialCharacter = replace(replace(replace(replace(resourceGroup().name, '.', ''), '(', ''), ')', ''), '_', '') // remove . () _ from resource group name
353347
var name_rgKeyvaultForWLSSSL = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultResourceGroup : resourceGroup().name
354348
var name_storageAccountName = const_hasStorageAccount ? queryStorageAccount.outputs.storageAccount : 'wls${uniqueString(utcValue)}'
355-
var name_tagNameForKeyVault = 'wlsKeyVault'
356-
var name_tagNameForStorageAccount = 'wlsStorageAccount'
357349
var name_trustKeyStoreDataSecret = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultCustomTrustKeyStoreDataSecretName : 'myTrustKeyStoreData'
358350
var name_trustKeyStorePswSecret = (sslConfigurationAccessOption == const_wlsSSLCertOptionKeyVault) ? sslKeyVaultCustomTrustKeyStorePassPhraseSecretName : 'myTrustKeyStorePsw'
359351
var ref_wlsDomainDeployment = _enableCustomSSL ? wlsDomainWithCustomSSLDeployment : wlsDomainDeployment
@@ -589,6 +581,7 @@ module wlsDomainDeployment 'modules/setupWebLogicCluster.bicep' = if (!enableCus
589581
enableClusterT3Tunneling: enableClusterT3Tunneling
590582
enablePswlessConnection: enablePswlessConnection
591583
enablePV: const_enablePV
584+
fileShareName: const_fileShareName
592585
identity: obj_uamiForDeploymentScript
593586
isSSOSupportEntitled: isSSOSupportEntitled
594587
location: location
@@ -660,6 +653,7 @@ module wlsDomainWithCustomSSLDeployment 'modules/setupWebLogicCluster.bicep' = i
660653
enableClusterT3Tunneling: enableClusterT3Tunneling
661654
enablePswlessConnection: enablePswlessConnection
662655
enablePV: const_enablePV
656+
fileShareName: const_fileShareName
663657
identity: obj_uamiForDeploymentScript
664658
isSSOSupportEntitled: isSSOSupportEntitled
665659
location: location
@@ -698,22 +692,6 @@ module wlsDomainWithCustomSSLDeployment 'modules/setupWebLogicCluster.bicep' = i
698692
]
699693
}
700694

701-
/*
702-
* Update tags to save key vault name and storage account name that are used for current configuration
703-
*/
704-
resource applyTags 'Microsoft.Resources/tags@${azure.apiVersionForTags}' = {
705-
name: 'default'
706-
properties: {
707-
tags: {
708-
'${name_tagNameForKeyVault}': const_bCreateNewKeyVault ? name_keyVaultName : const_keyvaultNameFromTag
709-
'${name_tagNameForStorageAccount}': (const_bCreateStorageAccount || const_hasStorageAccount) ? name_storageAccountName : ''
710-
}
711-
}
712-
dependsOn: [
713-
appgwSecretDeployment
714-
]
715-
}
716-
717695
module networkingDeployment 'modules/networking.bicep' = if (const_enableNetworking) {
718696
name: 'networking-deployment'
719697
params: {

weblogic-azure-aks/src/main/bicep/modules/_azure-resoruces/_storage.bicep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) 2021, Oracle Corporation and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

4+
param fileShareName string
45
param location string
56
param storageAccountName string = 'stg-contoso'
67
param utcValue string = utcNow()
78

89
var const_shareQuota = 5120
910
var const_sku = 'Standard_LRS'
10-
var name_fileShare = 'weblogic'
1111

1212
resource storageAccount 'Microsoft.Storage/storageAccounts@${azure.apiVersionForStorage}' = {
1313
name: storageAccountName
@@ -40,7 +40,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@${azure.apiVersionFor
4040
}
4141

4242
resource fileService 'Microsoft.Storage/storageAccounts/fileServices/shares@${azure.apiVersionForStorageFileService}' = {
43-
name: '${storageAccount.name}/default/${name_fileShare}'
43+
name: '${storageAccount.name}/default/${fileShareName}'
4444
properties: {
4545
accessTier: 'TransactionOptimized'
4646
shareQuota: const_shareQuota

weblogic-azure-aks/src/main/bicep/modules/_deployment-scripts/_ds-create-wls-cluster.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ param enableAdminT3Tunneling bool = false
1919
param enableClusterT3Tunneling bool = false
2020
param enablePswlessConnection bool = false
2121
param enablePV bool = false
22+
param fileShareName string
2223
param identity object = {}
2324
param isSSOSupportEntitled bool
2425
param location string
@@ -129,6 +130,10 @@ resource deploymentScript 'Microsoft.Resources/deploymentScripts@${azure.apiVers
129130
name: 'ENABLE_PV'
130131
value: string(enablePV)
131132
}
133+
{
134+
name: 'FILE_SHARE_NAME'
135+
value: fileShareName
136+
}
132137
{
133138
name: 'ORACLE_ACCOUNT_NAME'
134139
value: ocrSSOUser

weblogic-azure-aks/src/main/bicep/modules/setupWebLogicCluster.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ param enableAdminT3Tunneling bool = false
6969
param enableClusterT3Tunneling bool = false
7070
param enablePswlessConnection bool = false
7171
param enablePV bool = false
72+
param fileShareName string = ''
7273
@description('An user assigned managed identity. Make sure the identity has permission to create/update/delete/list Azure resources.')
7374
param identity object = {}
7475
param isSSOSupportEntitled bool
@@ -178,6 +179,7 @@ module aksClusterDeployment './_azure-resoruces/_aks.bicep' = if (createAKSClust
178179
module storageDeployment './_azure-resoruces/_storage.bicep' = if (createStorageAccount) {
179180
name: 'storage-deployment'
180181
params: {
182+
fileShareName: fileShareName
181183
location: location
182184
storageAccountName: storageAccountName
183185
}
@@ -208,6 +210,7 @@ module wlsDomainDeployment './_deployment-scripts/_ds-create-wls-cluster.bicep'
208210
enableClusterT3Tunneling: enableClusterT3Tunneling
209211
enablePswlessConnection: enablePswlessConnection
210212
enablePV: enablePV
213+
fileShareName: fileShareName
211214
identity: identity
212215
isSSOSupportEntitled: isSSOSupportEntitled
213216
location: location

0 commit comments

Comments
 (0)