Skip to content

Commit 73b9519

Browse files
authored
Merge pull request #327 from galiacheng/tags-for-resources
Support tagging resources in single node, admin and cluster offer
2 parents 200bb5c + 1ee7bf5 commit 73b9519

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1120
-115
lines changed

.github/workflows/testWlsAksWithDependencyCreation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ jobs:
226226
with:
227227
path: weblogic-azure
228228
- name: Download artifact for deployment
229-
uses: actions/download-artifact@v1
229+
uses: actions/download-artifact@v4
230230
with:
231231
name: ${{needs.preflight.outputs.artifactName}}
232232
- uses: azure/login@v1

.github/workflows/testWlsAksWithoutDependencyCreation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ jobs:
189189
with:
190190
path: weblogic-azure
191191
- name: Download artifact for deployment
192-
uses: actions/download-artifact@v1
192+
uses: actions/download-artifact@v4
193193
with:
194194
name: ${{needs.preflight.outputs.artifactName}}
195195
- uses: azure/login@v1

.github/workflows/testWlsVmAdmin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ jobs:
223223
repository: ${{env.repoOwner}}/${{env.repoName}}
224224
path: ${{env.repoName}}
225225
- name: Download artifact for deployment
226-
uses: actions/download-artifact@v1
226+
uses: actions/download-artifact@v4
227227
with:
228228
name: ${{ needs.preflight.outputs.artifactName }}
229229

.github/workflows/testWlsVmCluster.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ jobs:
256256
repository: ${{env.repoOwner}}/${{env.repoName}}
257257
path: ${{env.repoName}}
258258
- name: Download artifact for deployment
259-
uses: actions/download-artifact@v1
259+
uses: actions/download-artifact@v4
260260
with:
261261
name: ${{ needs.preflight.outputs.artifactName }}
262262
- uses: azure/login@v1
@@ -713,7 +713,7 @@ jobs:
713713
--template-file ${artifactName}/nestedtemplates/coherenceTemplate.json
714714
715715
- name: Download artifact for deployment
716-
uses: actions/download-artifact@v1
716+
uses: actions/download-artifact@v4
717717
with:
718718
name: ${{ needs.preflight.outputs.addnodeArtifactName }}
719719

@@ -761,7 +761,7 @@ jobs:
761761
fi
762762
763763
- name: Download artifact for deployment
764-
uses: actions/download-artifact@v1
764+
uses: actions/download-artifact@v4
765765
with:
766766
name: ${{ needs.preflight.outputs.addCoherenceNodeArtifactName }}
767767

@@ -809,7 +809,7 @@ jobs:
809809
fi
810810
811811
- name: Download artifact for deployment
812-
uses: actions/download-artifact@v1
812+
uses: actions/download-artifact@v4
813813
with:
814814
name: ${{ needs.preflight.outputs.deletenodeArtifactName }}
815815
- name: Delete nodes from existing cluster

.github/workflows/testWlsVmDynamicCluster.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ jobs:
234234
repository: ${{env.repoOwner}}/${{env.repoName}}
235235
path: ${{env.repoName}}
236236
- name: Download artifact for deployment
237-
uses: actions/download-artifact@v1
237+
uses: actions/download-artifact@v4
238238
with:
239239
name: ${{ needs.preflight.outputs.artifactName }}
240240
- uses: azure/login@v1
@@ -537,7 +537,7 @@ jobs:
537537
--template-file ${artifactName}/nestedtemplates/coherenceTemplate.json
538538
539539
- name: Download artifact for deployment
540-
uses: actions/download-artifact@v1
540+
uses: actions/download-artifact@v4
541541
with:
542542
name: ${{ needs.preflight.outputs.addnodeArtifactName }}
543543

@@ -588,7 +588,7 @@ jobs:
588588
fi
589589
590590
- name: Download artifact for deployment
591-
uses: actions/download-artifact@v1
591+
uses: actions/download-artifact@v4
592592
with:
593593
name: ${{ needs.preflight.outputs.addCoherenceNodeArtifactName }}
594594

@@ -636,7 +636,7 @@ jobs:
636636
fi
637637
638638
- name: Download artifact for deployment
639-
uses: actions/download-artifact@v1
639+
uses: actions/download-artifact@v4
640640
with:
641641
name: ${{ needs.preflight.outputs.deletenodeArtifactName }}
642642
- name: Delete nodes from existing cluster

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
<!-- weblogic azure aks versions -->
4343
<version.wls-on-aks-azure-marketplace>1.0.81</version.wls-on-aks-azure-marketplace>
4444
<!-- weblogic azure vm versions -->
45-
<version.arm-oraclelinux-wls>1.0.28</version.arm-oraclelinux-wls>
46-
<version.arm-oraclelinux-wls-admin>1.0.53</version.arm-oraclelinux-wls-admin>
47-
<version.arm-oraclelinux-wls-cluster>1.0.690000</version.arm-oraclelinux-wls-cluster>
45+
<version.arm-oraclelinux-wls>1.0.29</version.arm-oraclelinux-wls>
46+
<version.arm-oraclelinux-wls-admin>1.0.54</version.arm-oraclelinux-wls-admin>
47+
<version.arm-oraclelinux-wls-cluster>1.0.700000</version.arm-oraclelinux-wls-cluster>
4848
<version.arm-oraclelinux-wls-dynamic-cluster>1.0.52</version.arm-oraclelinux-wls-dynamic-cluster>
4949
<!-- node versions -->
5050
<version.arm-oraclelinux-wls-dynamic-cluster-addnode>1.0.7</version.arm-oraclelinux-wls-dynamic-cluster-addnode>

resources/azure-common.properties

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,23 @@ azure.cli.version=2.53.0
5050
# AzurePowerShell version
5151
azure.powershell.version=11.5
5252

53+
# These filters are used to implement tags for resources. Other occurrences of these resource type identifiers
54+
# are intentionally not filtered because doing so would unnecessarily complicate the code.
55+
identifier.applicationGateways=Microsoft.Network/applicationGateways
56+
identifier.availabilitySets=Microsoft.Compute/availabilitySets
57+
identifier.dnszones=Microsoft.Network/dnszones
58+
identifier.networkInterfaces=Microsoft.Network/networkInterfaces
59+
identifier.networkSecurityGroups=Microsoft.Network/networkSecurityGroups
60+
identifier.publicIPAddresses=Microsoft.Network/publicIPAddresses
61+
identifier.privateEndpoints=Microsoft.Network/privateEndpoints
62+
identifier.storageAccounts=Microsoft.Storage/storageAccounts
63+
identifier.vaults=Microsoft.KeyVault/vaults
64+
identifier.virtualNetworks=Microsoft.Network/virtualNetworks
65+
identifier.virtualMachines=Microsoft.Compute/virtualMachines
66+
identifier.virtualMachinesExtensions=Virtual machine extension
67+
identifier.deploymentScripts=Microsoft.Resources/deploymentScripts
68+
identifier.userAssignedIdentities=Microsoft.ManagedIdentity/userAssignedIdentities
69+
identifier.resourcesDeployment=Microsoft resources deployment
70+
label.tagsLabel=Tags for the resources.
71+
5372
azure.armBased.vmSize.list="Standard_D2plds_v5","Standard_D4plds_v5","Standard_D8plds_v5","Standard_D16plds_v5","Standard_D32plds_v5","Standard_D48plds_v5","Standard_D64plds_v5","Standard_D2pls_v5","Standard_D4pls_v5","Standard_D8pls_v5","Standard_D16pls_v5","Standard_D32pls_v5","Standard_D48pls_v5","Standard_D64pls_v5","Standard_D2pds_v5","Standard_D4pds_v5","Standard_D8pds_v5","Standard_D16pds_v5","Standard_D32pds_v5","Standard_D48pds_v5","Standard_D64pds_v5","Standard_D2ps_v5","Standard_D4ps_v5","Standard_D8ps_v5","Standard_D16ps_v5","Standard_D32ps_v5","Standard_D48ps_v5","Standard_D64ps_v5","Standard_E2pds_v5","Standard_E4pds_v5","Standard_E8pds_v5","Standard_E16pds_v5","Standard_E20pds_v5","Standard_E32pds_v5","Standard_E2ps_v5","Standard_E4ps_v5","Standard_E8ps_v5","Standard_E16ps_v5","Standard_E20ps_v5","Standard_E32ps_v5","Standard_B2pls_v2","Standard_B2ps_v2","Standard_B2pts_v2","Standard_B4pls_v2","Standard_B4ps_v2","Standard_B8pls_v2","Standard_B8ps_v2","Standard_B16pls_v2","Standard_B16ps_v2"
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
2+
# Guidance on Applying Tags in Solution Templates
3+
4+
## What are Tags in this context and why are they useful?
5+
6+
Tags are arbitrary name=value pairs that can be associated with most Azure resources. Azure features such as Azure Policy can use Tags to enforce cloud governance policies. For more about tags, see [Use tags to organize your Azure resources and management hierarchy](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources).
7+
8+
## Step 1: Audit Resources Created in the Offer
9+
10+
To determine the resources that will be created in your offer, use the following commands based on the template type:
11+
12+
### For ARM Templates:
13+
Use the command below to list resource types:
14+
15+
```bash
16+
# Navigate to the offer folder
17+
cd offer-folder
18+
grep -rh "\"type\": \"Microsoft" --exclude="createUiDefinition.json" | sort | uniq | sed 's/^[ \t]*//'
19+
```
20+
21+
### For Bicep Templates:
22+
Use the command below to list resource types and remove duplicates:
23+
24+
```bash
25+
# Navigate to the offer folder
26+
cd offer-folder
27+
grep -rh "^resource" | grep "Microsoft." | sort | uniq | sed 's/^[ \t]*//'
28+
```
29+
30+
Identify which resources support tags and which do not. For resources not listed below, consult the ARM definition at [Azure Resource Manager templates](https://learn.microsoft.com/en-us/azure/templates/) to determine if tagging is supported. If the definition does not include a tags property, the resource does not support tags and tagging is not required for deployments.
31+
32+
### Resources that Support Tags:
33+
34+
The top-level resources will be listed in the Tag UI control. Sub-resources will inherit the same tags as their parent resources.
35+
36+
For example, in the UI definition, customers can specify tags for `Microsoft.KeyVault/vaults`, but not for `Microsoft.KeyVault/vaults/secrets`. For the deployment of `Microsoft.KeyVault/vaults/secrets`, the same tags applied to `Microsoft.KeyVault/vaults` will be used. This approach ensures a consistent tagging experience with Key Vault deployments in the Azure portal.
37+
38+
- Microsoft.Network/dnszones
39+
- Microsoft.Network/networkInterfaces
40+
- Microsoft.Network/networkSecurityGroups
41+
- Microsoft.Network/publicIPAddresses
42+
- Microsoft.Network/privateEndpoints
43+
- Microsoft.Storage/storageAccounts
44+
- Microsoft.KeyVault/vaults
45+
- Microsoft.KeyVault/vaults/secrets
46+
- Microsoft.Network/virtualNetworks
47+
- Microsoft.Compute/virtualMachines
48+
- Microsoft.Compute/virtualMachines/extensions
49+
- Microsoft.Resources/deploymentScripts
50+
- Microsoft.ManagedIdentity/userAssignedIdentities
51+
- Microsoft.Resources/deployments
52+
- Microsoft.Network/applicationGateways
53+
54+
### Resources that Do Not Support Tags:
55+
56+
- Microsoft.Storage/storageAccounts/fileServices
57+
- Microsoft.Storage/storageAccounts/fileServices/shares
58+
- Microsoft.Network/networkSecurityGroups/securityRules
59+
- Microsoft.Network/dnsZones/A
60+
- Microsoft.Network/dnszones/CNAME
61+
- Microsoft.Network/virtualNetworks/subnets
62+
- Microsoft.Authorization/roleAssignments
63+
- Microsoft.Network/loadBalancers/backendAddressPools
64+
- Microsoft.Network/applicationGateways/backendHttpSettingsCollection
65+
- Microsoft.Network/applicationGateways/frontendIPConfigurations
66+
- Microsoft.Network/applicationGateways/frontendPorts
67+
- Microsoft.Network/applicationGateways/gatewayIPConfigurations
68+
- Microsoft.Network/applicationGateways/httpListeners
69+
- Microsoft.Network/applicationGateways/probes
70+
- Microsoft.Network/applicationGateways/requestRoutingRules
71+
72+
## Step 2: Tag UI Control
73+
74+
Incorporate the [Microsoft.Common.TagsByResource UI element](https://learn.microsoft.com/en-us/azure/azure-resource-manager/managed-applications/microsoft-common-tagsbyresource?WT.mc_id=Portal-Microsoft_Azure_CreateUIDef0) to include resources that support tags.
75+
76+
## Step 3: Update the Template
77+
78+
Refer to this [pull request](https://github.com/oracle/weblogic-azure/pull/327/) as a guide for how to apply tags to the resource deployments.
79+
80+
## Step 4: Testing
81+
82+
1. **Create a Test Offer:** Set up a test offer to validate the tagging process.
83+
84+
2. **Tag Settings:**
85+
- Apply a uniform tag to all resources.
86+
- Create specific tags for each resource, setting the tag value to the resource type (e.g., "tag1=storage account").
87+
88+
3. **Deploy the Offer:**
89+
90+
4. **Verify Tags:** Use the following command to verify that the resources have the correct tags applied:
91+
92+
```bash
93+
az resource list --resource-group <resource-group-name> --query "[].{Name:name, Type:type, Tags:tags}" -o json
94+
```
95+
96+
For example:
97+
98+
```shell
99+
az resource list --resource-group haiche-sn-tag-test --query "[].{Name:name, Type:type, Tags:tags}" -o json
100+
[
101+
{
102+
"Name": "0733ecolvm",
103+
"Tags": {
104+
"Tag0": "All",
105+
"Tag6": "storage account"
106+
},
107+
"Type": "Microsoft.Storage/storageAccounts"
108+
},
109+
{
110+
"Name": "olvm_PublicIP",
111+
"Tags": {
112+
"Tag0": "All",
113+
"Tag4": "public ip address"
114+
},
115+
"Type": "Microsoft.Network/publicIPAddresses"
116+
},
117+
{
118+
"Name": "wls-nsg",
119+
"Tags": {
120+
"Tag0": "All",
121+
"Tag3": "network security group"
122+
},
123+
"Type": "Microsoft.Network/networkSecurityGroups"
124+
},
125+
{
126+
"Name": "olvm_VNET",
127+
"Tags": {
128+
"Tag0": "All",
129+
"Tag8": "virtual network"
130+
},
131+
"Type": "Microsoft.Network/virtualNetworks"
132+
},
133+
{
134+
"Name": "olvm_NIC",
135+
"Tags": {
136+
"Tag0": "All",
137+
"Tag2": "network interface"
138+
},
139+
"Type": "Microsoft.Network/networkInterfaces"
140+
},
141+
{
142+
"Name": "WeblogicServerVM",
143+
"Tags": {
144+
"Tag0": "All",
145+
"Tag7": "virtual machine"
146+
},
147+
"Type": "Microsoft.Compute/virtualMachines"
148+
},
149+
{
150+
"Name": "WeblogicServerVM_OsDisk_1_d1fed748ccaa4cac81df9179e6dff325",
151+
"Tags": {
152+
"Tag0": "All",
153+
"Tag7": "virtual machine"
154+
},
155+
"Type": "Microsoft.Compute/disks"
156+
}
157+
]
158+
```

weblogic-azure-vm/arm-oraclelinux-wls-admin/src/main/arm/createUiDefinition.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,32 @@
12151215
"visible": "[bool(steps('section_database').enableDB)]"
12161216
}
12171217
]
1218+
},
1219+
{
1220+
"name": "section_tags",
1221+
"label": "Tags",
1222+
"elements": [
1223+
{
1224+
"name": "tagsByResource",
1225+
"type": "Microsoft.Common.TagsByResource",
1226+
"resources": [
1227+
"${identifier.dnszones}",
1228+
"${identifier.networkInterfaces}",
1229+
"${identifier.networkSecurityGroups}",
1230+
"${identifier.publicIPAddresses}",
1231+
"${identifier.privateEndpoints}",
1232+
"${identifier.storageAccounts}",
1233+
"${identifier.vaults}",
1234+
"${identifier.virtualNetworks}",
1235+
"${identifier.virtualMachines}",
1236+
"${identifier.virtualMachinesExtensions}",
1237+
"${identifier.deploymentScripts}",
1238+
"${identifier.userAssignedIdentities}",
1239+
"${identifier.resourcesDeployment}"
1240+
],
1241+
"toolTip": "Tags help you organize your resources and categorize them for billing or management purposes. You can apply tags to resources deployed by the offer."
1242+
}
1243+
]
12181244
}
12191245
],
12201246
"outputs": {
@@ -1261,6 +1287,7 @@
12611287
"keyVaultCustomTrustKeyStoreType": "[steps('section_sslConfiguration').keyVaultStoredCustomSSLSettings.keyVaultCustomTrustKeyStoreType]",
12621288
"keyVaultPrivateKeyAliasSecretName": "[steps('section_sslConfiguration').keyVaultStoredCustomSSLSettings.keyVaultPrivateKeyAliasSecretName]",
12631289
"keyVaultPrivateKeyPassPhraseSecretName": "[steps('section_sslConfiguration').keyVaultStoredCustomSSLSettings.keyVaultPrivateKeyPassPhraseSecretName]",
1290+
"tagsByResource": "[steps('section_tags').tagsByResource]",
12641291
"uploadedCustomIdentityKeyStoreData": "[steps('section_sslConfiguration').uploadedCustomSSLSettings.uploadedCustomIdentityKeyStoreData]",
12651292
"uploadedCustomIdentityKeyStorePassphrase": "[steps('section_sslConfiguration').uploadedCustomSSLSettings.uploadedCustomIdentityKeyStorePassphrase]",
12661293
"uploadedCustomIdentityKeyStoreType": "[steps('section_sslConfiguration').uploadedCustomSSLSettings.uploadedCustomIdentityKeyStoreType]",

0 commit comments

Comments
 (0)