Skip to content

Commit 506c078

Browse files
aim-for-betterZhenyu Zhou
andauthored
[HDInsight] Support compute isolation feature and return private ip address feature (#14032)
* Support compute isolation feature and return private ip address feature * Fix bad code style Co-authored-by: Zhenyu Zhou <[email protected]>
1 parent e6782d3 commit 506c078

File tree

12 files changed

+3248
-13
lines changed

12 files changed

+3248
-13
lines changed

src/HDInsight/HDInsight.Test/HDInsight.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
15-
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.1.0" />
15+
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.2.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.HDInsight.Job" Version="2.0.7" />
1717
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.1.0-preview.2" />
1818
<PackageReference Include="Microsoft.Azure.Management.ManagedServiceIdentity" Version="0.11.0" />

src/HDInsight/HDInsight.Test/ScenarioTests/HDInsightClusterTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,12 @@ public void TestCreateClusterWithCustomAmbariDatabase()
9191
{
9292
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateClusterWithCustomAmbariDatabase");
9393
}
94+
95+
[Fact]
96+
[Trait(Category.AcceptanceType, Category.CheckIn)]
97+
public void TestCreateClusterWithComputeIsolation()
98+
{
99+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateClusterWithComputeIsolation");
100+
}
94101
}
95102
}

src/HDInsight/HDInsight.Test/ScenarioTests/HDInsightClusterTests.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,38 @@ function Test-CreateClusterWithCustomAmbariDatabase{
354354
Remove-AzResourceGroup -ResourceGroupName $cluster.ResourceGroup
355355
}
356356
}
357+
358+
<#
359+
.SYNOPSIS
360+
Test Create Azure HDInsight Cluster with compute isolation
361+
#>
362+
function Test-CreateClusterWithComputeIsolation{
363+
364+
# Create some resources that will be used throughout test
365+
try
366+
{
367+
# prepare parameter for creating parameter
368+
$params= Prepare-ClusterCreateParameter -location "South Central US"
369+
$encryptionAtHost=$true
370+
$workerNodeSize="Standard_E8S_v3"
371+
$headNodeSize="Standard_E16S_v3"
372+
$zookeeperNodeSize="Standard_E2S_v3"
373+
374+
# create cluster
375+
$cluster=New-AzHDInsightCluster -Location $params.location -ResourceGroupName $params.resourceGroupName `
376+
-ClusterName $params.clusterName -ClusterSizeInNodes $params.clusterSizeInNodes -ClusterType $params.clusterType `
377+
-WorkerNodeSize $workerNodeSize -HeadNodeSize $headNodeSize -ZookeeperNodeSize $zookeeperNodeSize `
378+
-StorageAccountResourceId $params.storageAccountResourceId -StorageAccountKey $params.storageAccountKey `
379+
-HttpCredential $params.httpCredential -SshCredential $params.sshCredential `
380+
-MinSupportedTlsVersion $params.minSupportedTlsVersion -EnableComputeIsolation
381+
382+
Assert-AreEqual $cluster.ComputeIsolationProperties.EnableComputeIsolation $true
383+
384+
}
385+
finally
386+
{
387+
# Delete cluster and resource group
388+
Remove-AzHDInsightCluster -ClusterName $cluster.Name
389+
Remove-AzResourceGroup -ResourceGroupName $cluster.ResourceGroup
390+
}
391+
}

src/HDInsight/HDInsight.Test/SessionRecords/Commands.HDInsight.Test.ScenarioTests.HDInsightClusterTests/TestCreateClusterWithComputeIsolation.json

Lines changed: 2969 additions & 0 deletions
Large diffs are not rendered by default.

src/HDInsight/HDInsight/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added new parameter `-EnableComputeIsolation` and `-ComputeIsolationHostSku` to the cmdlet `New-AzHDInsightCluster` to support compute isolation feature
22+
* Added property `ComputeIsolationProperties` and `ConnectivityEndpoints` in the class AzureHDInsightCluster.
23+
2124

2225
## Version 4.1.1
2326
* Added properties: Fqdn and EffectiveDiskEncryptionKeyUrl in the class AzureHDInsightHostInfo.

src/HDInsight/HDInsight/HDInsight.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.1.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.2.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.HDInsight.Job" Version="2.0.7" />
1616
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
1717
</ItemGroup>

src/HDInsight/HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,12 @@ public OSType OSType
371371
[ValidateSet(Management.HDInsight.Models.PrivateLink.Enabled, Management.HDInsight.Models.PrivateLink.Disabled)]
372372
public string PrivateLink { get; set; }
373373

374+
[Parameter(HelpMessage = "Enables HDInsight compute isolation feature.")]
375+
public SwitchParameter EnableComputeIsolation { get; set; }
376+
377+
[Parameter(HelpMessage = "Gets or sets the dedicated host sku for compute isolation.")]
378+
public string ComputeIsolationHostSku { get; set; }
379+
374380

375381
#endregion
376382

@@ -564,6 +570,13 @@ var storageAccount in
564570
networkProperties = new NetworkProperties(ResourceProviderConnection, PrivateLink);
565571
}
566572

573+
// Handle compute isolation properties
574+
ComputeIsolationProperties computeIsolationProperties = null;
575+
if (EnableComputeIsolation.IsPresent)
576+
{
577+
computeIsolationProperties = new ComputeIsolationProperties(EnableComputeIsolation.IsPresent, ComputeIsolationHostSku);
578+
}
579+
567580
// Construct cluster create parameter
568581
ClusterCreateParametersExtended createParams = new ClusterCreateParametersExtended
569582
{
@@ -591,7 +604,8 @@ var storageAccount in
591604
IsEncryptionInTransitEnabled = EncryptionInTransit
592605
} : null,
593606
MinSupportedTlsVersion = MinSupportedTlsVersion,
594-
NetworkProperties = networkProperties
607+
NetworkProperties = networkProperties,
608+
ComputeIsolationProperties= computeIsolationProperties
595609

596610
},
597611
Identity = clusterIdentity

src/HDInsight/HDInsight/Models/Management/AzureHDInsightCluster.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public AzureHDInsightCluster(Cluster cluster)
3838
var httpEndpoint =
3939
cluster.Properties.ConnectivityEndpoints?.FirstOrDefault(c => c.Name.Equals("HTTPS", StringComparison.OrdinalIgnoreCase));
4040
HttpEndpoint = httpEndpoint != null ? httpEndpoint.Location : null;
41+
ConnectivityEndpoints = cluster?.Properties?.ConnectivityEndpoints?.Select(endpoint => new AzureHDInsightConnectivityEndpoint(endpoint)).ToList();
4142
Error = cluster.Properties.Errors?.Select(s => s.Message).FirstOrDefault();
4243
ResourceGroup = ClusterConfigurationUtils.GetResourceGroupFromClusterId(cluster.Id);
4344
ComponentVersion = new List<string>();
@@ -79,6 +80,7 @@ public AzureHDInsightCluster(Cluster cluster)
7980
ComputeProfile = cluster.Properties?.ComputeProfile != null ? new AzureHDInsightComputeProfile(cluster.Properties.ComputeProfile) : null;
8081
KafkaRestProperties = cluster?.Properties?.KafkaRestProperties != null ? new AzureHDInsightKafkaRestProperties(cluster.Properties.KafkaRestProperties) : null;
8182
NetworkProperties = cluster?.Properties?.NetworkProperties != null ? new AzureHDInsightNetworkProperties(cluster.Properties.NetworkProperties) : null;
83+
ComputeIsolationProperties = cluster?.Properties?.ComputeIsolationProperties != null ? new AzureHDInsightComputeIsolationProperties(cluster.Properties.ComputeIsolationProperties) : null;
8284
}
8385

8486
public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> clusterConfiguration, IDictionary<string, string> clusterIdentity)
@@ -274,5 +276,15 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
274276
/// Gets or sets the network properties.
275277
/// </summary>
276278
public AzureHDInsightNetworkProperties NetworkProperties;
279+
280+
/// <summary>
281+
/// Gets or sets the compute isolation properties.
282+
/// </summary>
283+
public AzureHDInsightComputeIsolationProperties ComputeIsolationProperties;
284+
285+
/// <summary>
286+
/// Gets or sets the connectivity endpoints.
287+
/// </summary>
288+
public IList<AzureHDInsightConnectivityEndpoint> ConnectivityEndpoints;
277289
}
278290
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
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+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Management.HDInsight.Models;
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Text;
19+
20+
namespace Microsoft.Azure.Commands.HDInsight.Models
21+
{
22+
public class AzureHDInsightComputeIsolationProperties
23+
{
24+
public AzureHDInsightComputeIsolationProperties() { }
25+
26+
public AzureHDInsightComputeIsolationProperties(bool? enableComputeIsolation = null, string hostSku = null)
27+
{
28+
EnableComputeIsolation = enableComputeIsolation;
29+
HostSku = hostSku;
30+
}
31+
32+
public AzureHDInsightComputeIsolationProperties(ComputeIsolationProperties computeIsolationProperties = null)
33+
{
34+
EnableComputeIsolation = computeIsolationProperties?.EnableComputeIsolation;
35+
HostSku = computeIsolationProperties?.HostSku;
36+
}
37+
38+
/// <summary>
39+
/// Gets or sets the direction for the resource provider connection. Possible values include: 'Inbound', 'Outbound'
40+
/// </summary>
41+
public bool? EnableComputeIsolation { get; set; }
42+
43+
/// <summary>
44+
/// Gets or sets indicates whether or not private link is enabled. Possible values include: 'Disabled', 'Enabled'
45+
/// </summary>
46+
public string HostSku { get; set; }
47+
}
48+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
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+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Management.HDInsight.Models;
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Text;
19+
20+
namespace Microsoft.Azure.Commands.HDInsight.Models
21+
{
22+
public class AzureHDInsightConnectivityEndpoint
23+
{
24+
public AzureHDInsightConnectivityEndpoint() { }
25+
26+
public AzureHDInsightConnectivityEndpoint(string name = null, string protocol = null, string location = null, int? port = null, string privateIPAddress = null)
27+
{
28+
Name = name;
29+
Protocol = protocol;
30+
Location = location;
31+
Port = port;
32+
PrivateIPAddress = privateIPAddress;
33+
}
34+
35+
public AzureHDInsightConnectivityEndpoint(ConnectivityEndpoint connectivityEndpoint = null)
36+
{
37+
Name = connectivityEndpoint?.Name;
38+
Protocol = connectivityEndpoint?.Protocol;
39+
Location = connectivityEndpoint?.Location;
40+
Port = connectivityEndpoint?.Port;
41+
PrivateIPAddress = connectivityEndpoint?.PrivateIPAddress;
42+
}
43+
44+
/// <summary>
45+
/// Gets or sets the name of connectivity endpoint.
46+
/// </summary>
47+
public string Name { get; set; }
48+
49+
/// <summary>
50+
/// Gets or sets the protocol of connectivity endpoint.
51+
/// </summary>
52+
public string Protocol { get; set; }
53+
54+
/// <summary>
55+
/// Gets or sets the location of connectivity endpoint.
56+
/// </summary>
57+
public string Location { get; set; }
58+
59+
/// <summary>
60+
/// Gets or sets the port of connectivity endpoint.
61+
/// </summary>
62+
public int? Port { get; set; }
63+
64+
/// <summary>
65+
/// Gets or sets the private ip address of connectivity endpoint.
66+
/// </summary>
67+
public string PrivateIPAddress { get; set; }
68+
}
69+
}

0 commit comments

Comments
 (0)