Skip to content

Commit 13caab0

Browse files
Migrate AksArc from generation to main (#25390)
* Move AksArc to main * Update ChangeLog.md --------- Co-authored-by: NoriZC <[email protected]>
1 parent 4408bc0 commit 13caab0

File tree

99 files changed

+18579
-2094
lines changed

Some content is hidden

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

99 files changed

+18579
-2094
lines changed

src/AksArc/AksArc.Autorest/Az.AksArc.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
DotNetFrameworkVersion = '4.7.2'
1212
RequiredAssemblies = './bin/Az.AksArc.private.dll'
1313
FormatsToProcess = './Az.AksArc.format.ps1xml'
14-
FunctionsToExport = 'Get-AzAksArcCluster', 'Get-AzAksArcClusterAdminKubeconfig', 'Get-AzAksArcClusterUpgrade', 'Get-AzAksArcClusterUserKubeconfig', 'Get-AzAksArcKubernetesVersion', 'Get-AzAksArcLog', 'Get-AzAksArcNodepool', 'Get-AzAksArcVMSku', 'New-AzAksArcCluster', 'New-AzAksArcNodepool', 'Remove-AzAksArcCluster', 'Remove-AzAksArcNodepool', 'Update-AzAksArcCluster', 'Update-AzAksArcNodepool'
14+
FunctionsToExport = 'Get-AzAksArcCluster', 'Get-AzAksArcClusterAdminKubeconfig', 'Get-AzAksArcClusterUpgrade', 'Get-AzAksArcClusterUserKubeconfig', 'Get-AzAksArcKubernetesVersion', 'Get-AzAksArcLog', 'Get-AzAksArcNodepool', 'Get-AzAksArcVirtualNetwork', 'Get-AzAksArcVMSku', 'Invoke-AzAksArcClusterUpgrade', 'New-AzAksArcCluster', 'New-AzAksArcNodepool', 'New-AzAksArcVirtualNetwork', 'Remove-AzAksArcCluster', 'Remove-AzAksArcNodepool', 'Remove-AzAksArcVirtualNetwork', 'Update-AzAksArcCluster', 'Update-AzAksArcNodepool'
1515
PrivateData = @{
1616
PSData = @{
1717
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'AksArc'

src/AksArc/AksArc.Autorest/README.md

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ directive:
5858
- where:
5959
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
6060
remove: true
61-
# - where:
62-
# variant: ^CreateViaIdentity.*$
63-
# remove: true
61+
- where:
62+
variant: ^CreateViaIdentity.*$
63+
remove: true
6464
# Follow directive is v3 specific. If you are using v3, uncomment following directive and comments out two directives above
6565
#- where:
6666
# variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
@@ -102,6 +102,11 @@ directive:
102102
subject: Cluster
103103
hide: true
104104

105+
- where:
106+
verb: New
107+
subject: VirtualNetwork
108+
hide: true
109+
105110
- where:
106111
subject: ProvisionedClusterInstanceUpgradeProfile
107112
set:
@@ -120,6 +125,14 @@ directive:
120125
subject: ClusterUserKubeconfig
121126
hide: true
122127

128+
- where:
129+
subject: KubernetesVersion
130+
hide: true
131+
132+
- where:
133+
subject: VMSku
134+
hide: true
135+
123136
# Remove unnecessary cmdlets
124137
- where:
125138
subject: KuberneteVersion
@@ -131,23 +144,14 @@ directive:
131144
remove: true
132145

133146
- where:
147+
verb: Update
134148
subject: VirtualNetwork
135149
remove: true
136150

137151
- where:
138152
subject: HybridIdentityMetadata
139153
remove: true
140154

141-
- where:
142-
verb: New
143-
subject: VMSku
144-
remove: true
145-
146-
- where:
147-
verb: New
148-
subject: KubernetesVersion
149-
remove: true
150-
151155
- where:
152156
verb: Update
153157
subject: VMSku
@@ -170,3 +174,51 @@ directive:
170174
parameter-name: ExtendedLocationName
171175
set:
172176
parameter-name: CustomLocationID
177+
178+
# Clusters
179+
- where:
180+
parameter-name: ControlPlaneEndpointHostIP
181+
set:
182+
parameter-name: ControlPlaneIP
183+
184+
- where:
185+
parameter-name: NetworkProfilePodCidr
186+
set:
187+
parameter-name: PodCidr
188+
189+
- where:
190+
parameter-name: LoadBalancerProfileCount
191+
set:
192+
parameter-name: LoadBalancerCount
193+
194+
- where:
195+
parameter-name: ClusterVMAccessProfileAuthorizedIprange
196+
set:
197+
parameter-name: SshAuthIp
198+
199+
# Networks
200+
- where:
201+
parameter-name: HciMocGroup
202+
set:
203+
parameter-name: MocGroup
204+
205+
- where:
206+
parameter-name: HciMocLocation
207+
set:
208+
parameter-name: MocLocation
209+
210+
- where:
211+
parameter-name: HciMocVnetName
212+
set:
213+
parameter-name: MocVnetName
214+
215+
# VM SKU / Kubernetes Version
216+
- where:
217+
verb: New
218+
subject: VMSku
219+
hide: true
220+
221+
- where:
222+
verb: New
223+
subject: KubernetesVersion
224+
hide: true
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"resourceType": "virtualNetworks",
3+
"apiVersion": "2024-01-01",
4+
"learnMore": {
5+
"url": "https://learn.microsoft.com/powershell/module/az.aksarc"
6+
},
7+
"commands": [
8+
{
9+
"name": "Get-AzAksArcVirtualNetwork",
10+
"description": "Lists the virtual networks in the specified resource group",
11+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}",
12+
"help": {
13+
"learnMore": {
14+
"url": "https://learn.microsoft.com/powershell/module/az.aksarc/get-azaksarcvirtualnetwork"
15+
},
16+
"parameterSets": [
17+
{
18+
"parameters": [
19+
"-Name <String>",
20+
"-ResourceGroupName <String>",
21+
"[-SubscriptionId <String[]>]"
22+
]
23+
}
24+
]
25+
},
26+
"examples": [
27+
{
28+
"description": "Gets the specified virtual network resource",
29+
"parameters": [
30+
{
31+
"name": "-Name",
32+
"value": "[Path.virtualNetworkName]"
33+
},
34+
{
35+
"name": "-ResourceGroupName",
36+
"value": "[Path.resourceGroupName]"
37+
},
38+
{
39+
"name": "-SubscriptionId",
40+
"value": "[Path.subscriptionId]"
41+
}
42+
]
43+
}
44+
]
45+
},
46+
{
47+
"name": "Remove-AzAksArcVirtualNetwork",
48+
"description": "Deletes the specified virtual network resource",
49+
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridContainerService/virtualNetworks/{virtualNetworkName}",
50+
"help": {
51+
"learnMore": {
52+
"url": "https://learn.microsoft.com/powershell/module/az.aksarc/remove-azaksarcvirtualnetwork"
53+
},
54+
"parameterSets": [
55+
{
56+
"parameters": [
57+
"-Name <String>",
58+
"-ResourceGroupName <String>",
59+
"[-SubscriptionId <String>]"
60+
]
61+
}
62+
]
63+
},
64+
"examples": [
65+
{
66+
"description": "Deletes the specified virtual network resource",
67+
"parameters": [
68+
{
69+
"name": "-Name",
70+
"value": "[Path.virtualNetworkName]"
71+
},
72+
{
73+
"name": "-ResourceGroupName",
74+
"value": "[Path.resourceGroupName]"
75+
},
76+
{
77+
"name": "-SubscriptionId",
78+
"value": "[Path.subscriptionId]"
79+
}
80+
]
81+
}
82+
]
83+
}
84+
]
85+
}

src/AksArc/AksArc.Autorest/custom/Get-AzAksArcCluster.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gets the provisioned cluster instance
2020
.Description
2121
Gets the provisioned cluster instance
2222
.Example
23-
Get-AzAksArcCluster -ClusterName azps_test_cluster -ResourceGroup azps_test_group
23+
Get-AzAksArcCluster -ClusterName azps_test_cluster -ResourceGroupName azps_test_group
2424
2525
.Outputs
2626
Microsoft.Azure.PowerShell.Cmdlets.AksArc.Models.IProvisionedCluster

src/AksArc/AksArc.Autorest/custom/Get-AzAksArcClusterAdminKubeconfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Lists the admin credentials of the provisioned cluster (can only be used within
2020
.Description
2121
Lists the admin credentials of the provisioned cluster (can only be used within private network)
2222
.Example
23-
Get-AzAksArcClusterAdminKubeconfig -ClusterName azps_test_cluster -ResourceGroup azps_test_group
23+
Get-AzAksArcClusterAdminKubeconfig -ClusterName azps_test_cluster -ResourceGroupName azps_test_group
2424
2525
.Outputs
2626
Microsoft.Azure.PowerShell.Cmdlets.AksArc.Models.IListCredentialResponse

src/AksArc/AksArc.Autorest/custom/Get-AzAksArcClusterUserKubeconfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Lists the user credentials of the provisioned cluster (can only be used within p
2020
.Description
2121
Lists the user credentials of the provisioned cluster (can only be used within private network)
2222
.Example
23-
Get-AzAksArcClusterUserKubeconfig -ClusterName azps_test_cluster -ResourceGroup azps_test_group
23+
Get-AzAksArcClusterUserKubeconfig -ClusterName azps_test_cluster -ResourceGroupName azps_test_group
2424
2525
.Outputs
2626
Microsoft.Azure.PowerShell.Cmdlets.AksArc.Models.IListCredentialResponse
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
2+
# ----------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
14+
# is regenerated.
15+
# ----------------------------------------------------------------------------------
16+
17+
<#
18+
.Synopsis
19+
Lists the supported kubernetes versions for the specified custom location
20+
.Description
21+
Lists the supported kubernetes versions for the specified custom location
22+
.Example
23+
Get-AzAksArcKubernetesVersion -CustomLocationName sample_cl
24+
25+
.Outputs
26+
Microsoft.Azure.PowerShell.Cmdlets.AksArc.Models.IKubernetesVersionProfile
27+
.Link
28+
https://learn.microsoft.com/powershell/module/az.aksarc/get-azaksarckubernetesversion
29+
#>
30+
function Get-AzAksArcKubernetesVersion {
31+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.AksArc.Models.IKubernetesVersionProfile])]
32+
[CmdletBinding(DefaultParameterSetName='Get', PositionalBinding=$false)]
33+
param(
34+
[Parameter(Mandatory)]
35+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Path')]
36+
[System.String]
37+
# The name or id of the custom location.
38+
${CustomLocationName},
39+
40+
[Parameter()]
41+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Path')]
42+
[System.String]
43+
# The name of the resource group.
44+
# The name is case insensitive.
45+
${ResourceGroupName},
46+
47+
[Parameter()]
48+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Path')]
49+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
50+
[System.String]
51+
# The ID of the target subscription.
52+
${SubscriptionId},
53+
54+
[Parameter()]
55+
[Alias('AzureRMContext', 'AzureCredential')]
56+
[ValidateNotNull()]
57+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Azure')]
58+
[System.Management.Automation.PSObject]
59+
# The DefaultProfile parameter is not functional.
60+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
61+
${DefaultProfile},
62+
63+
[Parameter(DontShow)]
64+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Runtime')]
65+
[System.Management.Automation.SwitchParameter]
66+
# Wait for .NET debugger to attach
67+
${Break},
68+
69+
[Parameter(DontShow)]
70+
[ValidateNotNull()]
71+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Runtime')]
72+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Runtime.SendAsyncStep[]]
73+
# SendAsync Pipeline Steps to be appended to the front of the pipeline
74+
${HttpPipelineAppend},
75+
76+
[Parameter(DontShow)]
77+
[ValidateNotNull()]
78+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Runtime')]
79+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Runtime.SendAsyncStep[]]
80+
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
81+
${HttpPipelinePrepend},
82+
83+
[Parameter(DontShow)]
84+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Runtime')]
85+
[System.Uri]
86+
# The URI for the proxy server to use
87+
${Proxy},
88+
89+
[Parameter(DontShow)]
90+
[ValidateNotNull()]
91+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Runtime')]
92+
[System.Management.Automation.PSCredential]
93+
# Credentials for a proxy server to use for the remote call
94+
${ProxyCredential},
95+
96+
[Parameter(DontShow)]
97+
[Microsoft.Azure.PowerShell.Cmdlets.AksArc.Category('Runtime')]
98+
[System.Management.Automation.SwitchParameter]
99+
# Use the default credentials for the proxy
100+
${ProxyUseDefaultCredentials}
101+
)
102+
103+
process {
104+
# Format custom location
105+
$CustomLocationID = ConvertCustomLocationNameToID -CustomLocationName $CustomLocationName -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName
106+
if ($CustomLocationName -ne $CustomLocationID) {
107+
if (!$ResourceGroupName) {
108+
throw "ResourceGroupName parameter is required."
109+
}
110+
}
111+
112+
$null = $PSBoundParameters.Add("CustomLocationResourceUri", $CustomLocationID)
113+
$null = $PSBoundParameters.Remove("CustomLocationName")
114+
$null = $PSBoundParameters.Remove("ResourceGroupName")
115+
$null = $PSBoundParameters.Remove("SubscriptionId")
116+
117+
# Perform Get/Put if does not exist
118+
try {
119+
$config = Az.AksArc.internal\Get-AzAksArcKubernetesVersion @PSBoundParameters
120+
if ($config.ProvisioningState -ne "Succeeded") {
121+
$DoCreateDefaultObject = $true
122+
}
123+
}
124+
catch {
125+
$DoCreateDefaultObject = $true
126+
}
127+
128+
if ($DoCreateDefaultObject) {
129+
$null = Az.AksArc.internal\New-AzAksArcKubernetesVersion -CustomLocationResourceUri $CustomLocationID -ExtendedLocationName $CustomLocationID -ExtendedLocationType "CustomLocation"
130+
}
131+
132+
# Call get command
133+
Az.AksArc.internal\Get-AzAksArcKubernetesVersion @PSBoundParameters
134+
}
135+
}

0 commit comments

Comments
 (0)