Skip to content

Commit

Permalink
[HDInsight] Support compute isolation feature and return private ip a…
Browse files Browse the repository at this point in the history
…ddress feature (#14032)

* Support compute isolation feature and return private ip address feature

* Fix bad code style

Co-authored-by: Zhenyu Zhou <zhezhou@microsoft.com>
  • Loading branch information
aim-for-better and Zhenyu Zhou authored Jan 28, 2021
1 parent e6782d3 commit 506c078
Show file tree
Hide file tree
Showing 12 changed files with 3,248 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/HDInsight/HDInsight.Test/HDInsight.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.1.0" />
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.2.0" />
<PackageReference Include="Microsoft.Azure.Management.HDInsight.Job" Version="2.0.7" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.1.0-preview.2" />
<PackageReference Include="Microsoft.Azure.Management.ManagedServiceIdentity" Version="0.11.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,12 @@ public void TestCreateClusterWithCustomAmbariDatabase()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateClusterWithCustomAmbariDatabase");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateClusterWithComputeIsolation()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateClusterWithComputeIsolation");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,38 @@ function Test-CreateClusterWithCustomAmbariDatabase{
Remove-AzResourceGroup -ResourceGroupName $cluster.ResourceGroup
}
}

<#
.SYNOPSIS
Test Create Azure HDInsight Cluster with compute isolation
#>
function Test-CreateClusterWithComputeIsolation{

# Create some resources that will be used throughout test
try
{
# prepare parameter for creating parameter
$params= Prepare-ClusterCreateParameter -location "South Central US"
$encryptionAtHost=$true
$workerNodeSize="Standard_E8S_v3"
$headNodeSize="Standard_E16S_v3"
$zookeeperNodeSize="Standard_E2S_v3"

# create cluster
$cluster=New-AzHDInsightCluster -Location $params.location -ResourceGroupName $params.resourceGroupName `
-ClusterName $params.clusterName -ClusterSizeInNodes $params.clusterSizeInNodes -ClusterType $params.clusterType `
-WorkerNodeSize $workerNodeSize -HeadNodeSize $headNodeSize -ZookeeperNodeSize $zookeeperNodeSize `
-StorageAccountResourceId $params.storageAccountResourceId -StorageAccountKey $params.storageAccountKey `
-HttpCredential $params.httpCredential -SshCredential $params.sshCredential `
-MinSupportedTlsVersion $params.minSupportedTlsVersion -EnableComputeIsolation

Assert-AreEqual $cluster.ComputeIsolationProperties.EnableComputeIsolation $true

}
finally
{
# Delete cluster and resource group
Remove-AzHDInsightCluster -ClusterName $cluster.Name
Remove-AzResourceGroup -ResourceGroupName $cluster.ResourceGroup
}
}

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/HDInsight/HDInsight/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
- Additional information about change #1
-->
## Upcoming Release
* Added new parameter `-EnableComputeIsolation` and `-ComputeIsolationHostSku` to the cmdlet `New-AzHDInsightCluster` to support compute isolation feature
* Added property `ComputeIsolationProperties` and `ConnectivityEndpoints` in the class AzureHDInsightCluster.


## Version 4.1.1
* Added properties: Fqdn and EffectiveDiskEncryptionKeyUrl in the class AzureHDInsightHostInfo.
Expand Down
2 changes: 1 addition & 1 deletion src/HDInsight/HDInsight/HDInsight.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.1.0" />
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="6.2.0" />
<PackageReference Include="Microsoft.Azure.Management.HDInsight.Job" Version="2.0.7" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@ public OSType OSType
[ValidateSet(Management.HDInsight.Models.PrivateLink.Enabled, Management.HDInsight.Models.PrivateLink.Disabled)]
public string PrivateLink { get; set; }

[Parameter(HelpMessage = "Enables HDInsight compute isolation feature.")]
public SwitchParameter EnableComputeIsolation { get; set; }

[Parameter(HelpMessage = "Gets or sets the dedicated host sku for compute isolation.")]
public string ComputeIsolationHostSku { get; set; }


#endregion

Expand Down Expand Up @@ -564,6 +570,13 @@ var storageAccount in
networkProperties = new NetworkProperties(ResourceProviderConnection, PrivateLink);
}

// Handle compute isolation properties
ComputeIsolationProperties computeIsolationProperties = null;
if (EnableComputeIsolation.IsPresent)
{
computeIsolationProperties = new ComputeIsolationProperties(EnableComputeIsolation.IsPresent, ComputeIsolationHostSku);
}

// Construct cluster create parameter
ClusterCreateParametersExtended createParams = new ClusterCreateParametersExtended
{
Expand Down Expand Up @@ -591,7 +604,8 @@ var storageAccount in
IsEncryptionInTransitEnabled = EncryptionInTransit
} : null,
MinSupportedTlsVersion = MinSupportedTlsVersion,
NetworkProperties = networkProperties
NetworkProperties = networkProperties,
ComputeIsolationProperties= computeIsolationProperties

},
Identity = clusterIdentity
Expand Down
12 changes: 12 additions & 0 deletions src/HDInsight/HDInsight/Models/Management/AzureHDInsightCluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public AzureHDInsightCluster(Cluster cluster)
var httpEndpoint =
cluster.Properties.ConnectivityEndpoints?.FirstOrDefault(c => c.Name.Equals("HTTPS", StringComparison.OrdinalIgnoreCase));
HttpEndpoint = httpEndpoint != null ? httpEndpoint.Location : null;
ConnectivityEndpoints = cluster?.Properties?.ConnectivityEndpoints?.Select(endpoint => new AzureHDInsightConnectivityEndpoint(endpoint)).ToList();
Error = cluster.Properties.Errors?.Select(s => s.Message).FirstOrDefault();
ResourceGroup = ClusterConfigurationUtils.GetResourceGroupFromClusterId(cluster.Id);
ComponentVersion = new List<string>();
Expand Down Expand Up @@ -79,6 +80,7 @@ public AzureHDInsightCluster(Cluster cluster)
ComputeProfile = cluster.Properties?.ComputeProfile != null ? new AzureHDInsightComputeProfile(cluster.Properties.ComputeProfile) : null;
KafkaRestProperties = cluster?.Properties?.KafkaRestProperties != null ? new AzureHDInsightKafkaRestProperties(cluster.Properties.KafkaRestProperties) : null;
NetworkProperties = cluster?.Properties?.NetworkProperties != null ? new AzureHDInsightNetworkProperties(cluster.Properties.NetworkProperties) : null;
ComputeIsolationProperties = cluster?.Properties?.ComputeIsolationProperties != null ? new AzureHDInsightComputeIsolationProperties(cluster.Properties.ComputeIsolationProperties) : null;
}

public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> clusterConfiguration, IDictionary<string, string> clusterIdentity)
Expand Down Expand Up @@ -274,5 +276,15 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
/// Gets or sets the network properties.
/// </summary>
public AzureHDInsightNetworkProperties NetworkProperties;

/// <summary>
/// Gets or sets the compute isolation properties.
/// </summary>
public AzureHDInsightComputeIsolationProperties ComputeIsolationProperties;

/// <summary>
/// Gets or sets the connectivity endpoints.
/// </summary>
public IList<AzureHDInsightConnectivityEndpoint> ConnectivityEndpoints;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.HDInsight.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Azure.Commands.HDInsight.Models
{
public class AzureHDInsightComputeIsolationProperties
{
public AzureHDInsightComputeIsolationProperties() { }

public AzureHDInsightComputeIsolationProperties(bool? enableComputeIsolation = null, string hostSku = null)
{
EnableComputeIsolation = enableComputeIsolation;
HostSku = hostSku;
}

public AzureHDInsightComputeIsolationProperties(ComputeIsolationProperties computeIsolationProperties = null)
{
EnableComputeIsolation = computeIsolationProperties?.EnableComputeIsolation;
HostSku = computeIsolationProperties?.HostSku;
}

/// <summary>
/// Gets or sets the direction for the resource provider connection. Possible values include: 'Inbound', 'Outbound'
/// </summary>
public bool? EnableComputeIsolation { get; set; }

/// <summary>
/// Gets or sets indicates whether or not private link is enabled. Possible values include: 'Disabled', 'Enabled'
/// </summary>
public string HostSku { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.HDInsight.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Azure.Commands.HDInsight.Models
{
public class AzureHDInsightConnectivityEndpoint
{
public AzureHDInsightConnectivityEndpoint() { }

public AzureHDInsightConnectivityEndpoint(string name = null, string protocol = null, string location = null, int? port = null, string privateIPAddress = null)
{
Name = name;
Protocol = protocol;
Location = location;
Port = port;
PrivateIPAddress = privateIPAddress;
}

public AzureHDInsightConnectivityEndpoint(ConnectivityEndpoint connectivityEndpoint = null)
{
Name = connectivityEndpoint?.Name;
Protocol = connectivityEndpoint?.Protocol;
Location = connectivityEndpoint?.Location;
Port = connectivityEndpoint?.Port;
PrivateIPAddress = connectivityEndpoint?.PrivateIPAddress;
}

/// <summary>
/// Gets or sets the name of connectivity endpoint.
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets or sets the protocol of connectivity endpoint.
/// </summary>
public string Protocol { get; set; }

/// <summary>
/// Gets or sets the location of connectivity endpoint.
/// </summary>
public string Location { get; set; }

/// <summary>
/// Gets or sets the port of connectivity endpoint.
/// </summary>
public int? Port { get; set; }

/// <summary>
/// Gets or sets the private ip address of connectivity endpoint.
/// </summary>
public string PrivateIPAddress { get; set; }
}
}
Loading

0 comments on commit 506c078

Please sign in to comment.