Skip to content

Commit 06f9731

Browse files
author
Zhenyu Zhou
committed
1.Support customers specify min TLS version when creating cluster
2. Update New-AzHDInsightConfig.md
1 parent 9813b78 commit 06f9731

File tree

14 files changed

+1048
-1133
lines changed

14 files changed

+1048
-1133
lines changed

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

Lines changed: 5 additions & 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="5.1.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="5.3.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.HDInsight.Job" Version="2.0.7" />
1616
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.19.0-preview" />
1717
</ItemGroup>
@@ -20,4 +20,8 @@
2020
<ProjectReference Include="..\HDInsight\HDInsight.csproj" />
2121
</ItemGroup>
2222

23+
<ItemGroup>
24+
<Folder Include="SessionRecords\Commands.HDInsight.Test.ScenarioTests.HDInsightClusterTests\" />
25+
</ItemGroup>
26+
2327
</Project>

src/HDInsight/HDInsight.Test/ScenarioTests/Common.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function Create-Cluster{
3838
[string] $location="West US",
3939
[string] $resourceGroupName="group-ps-test",
4040
[string] $clusterType="Spark",
41-
[string] $storageAccountName="storagepstest"
41+
[string] $storageAccountName="storagepstest",
42+
[string] $minSupportedTlsVersion="1.2"
4243
)
4344

4445
$clusterName=Generate-Name($clusterName)
@@ -65,7 +66,7 @@ function Create-Cluster{
6566

6667
$cluster=New-AzHDInsightCluster -Location $location -ResourceGroupName $resourceGroup.ResourceGroupName -ClusterName $clusterName `
6768
-ClusterSizeInNodes $clusterSizeInNodes -ClusterType $clusterType -DefaultStorageAccountName $storageAccountName `
68-
-DefaultStorageAccountKey $storageAccountKey -HttpCredential $httpCredential -SshCredential $sshCredential
69+
-DefaultStorageAccountKey $storageAccountKey -HttpCredential $httpCredential -SshCredential $sshCredential -MinSupportedTlsVersion $minSupportedTlsVersion
6970

7071
return $cluster
7172
}

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

Lines changed: 911 additions & 1063 deletions
Large diffs are not rendered by default.

src/HDInsight/HDInsight.Test/UnitTests/NewClusterTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void CanCreateNewHDInsightCluster()
112112
parameters.Location == Location &&
113113
parameters.UserName == _httpCred.UserName &&
114114
parameters.Password == _httpCred.Password.ConvertToString() &&
115-
parameters.ClusterType == ClusterType)))
115+
parameters.ClusterType == ClusterType), It.IsAny<string>()))
116116
.Returns(cluster)
117117
.Verifiable();
118118

@@ -317,7 +317,7 @@ private void CreateNewHDInsightCluster(
317317
parameters.SshUserName == _sshCred.UserName &&
318318
parameters.SshPassword == _sshCred.Password.ConvertToString() &&
319319
((!setEdgeNodeVmSize && parameters.EdgeNodeSize == null) || (setEdgeNodeVmSize && parameters.EdgeNodeSize == "edgeNodeVmSizeSetTest")) &&
320-
(workerNodeDataDisks == 0) || (workerNodeDataDisks > 0 && parameters.WorkerNodeDataDisksGroups.First().DisksPerNode == workerNodeDataDisks))))
320+
(workerNodeDataDisks == 0) || (workerNodeDataDisks > 0 && parameters.WorkerNodeDataDisksGroups.First().DisksPerNode == workerNodeDataDisks)), It.IsAny<string>()))
321321
.Returns(cluster)
322322
.Verifiable();
323323

@@ -416,7 +416,7 @@ public void CanCreateNewHDInsightCluster_LinuxComponentVersion()
416416
parameters.ClusterType == sparkClusterType &&
417417
parameters.SshUserName == _sshCred.UserName &&
418418
parameters.SshPassword == _sshCred.Password.ConvertToString() &&
419-
parameters.ComponentVersion["Spark"] == componentVersion["Spark"])))
419+
parameters.ComponentVersion["Spark"] == componentVersion["Spark"]), It.IsAny<string>()))
420420
.Returns(cluster)
421421
.Verifiable();
422422
hdinsightManagementMock.Setup(
@@ -431,7 +431,7 @@ public void CanCreateNewHDInsightCluster_LinuxComponentVersion()
431431
parameters.Password == _httpCred.Password.ConvertToString() &&
432432
parameters.ClusterType == ClusterType &&
433433
parameters.SshUserName == _sshCred.UserName &&
434-
parameters.SshPassword == _sshCred.Password.ConvertToString())))
434+
parameters.SshPassword == _sshCred.Password.ConvertToString()), It.IsAny<string>()))
435435
.Returns(cluster)
436436
.Verifiable();
437437

@@ -474,7 +474,7 @@ public void TestStorageAccountTypeDefaultsToAzureStorage()
474474
cmdlet.DefaultStorageAccountKey = StorageKey;
475475
cmdlet.ClusterType = ClusterType;
476476

477-
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, OSType.Linux, It.IsAny<ClusterCreateParameters>()));
477+
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, OSType.Linux, It.IsAny<ClusterCreateParameters>(), It.IsAny<string>()));
478478

479479
cmdlet.ExecuteCmdlet();
480480

@@ -487,7 +487,7 @@ public void TestStorageAccountTypeDefaultsToAzureStorage()
487487
parameters.Location == Location &&
488488
parameters.UserName == _httpCred.UserName &&
489489
parameters.Password == _httpCred.Password.ConvertToString() &&
490-
parameters.ClusterType == ClusterType)),
490+
parameters.ClusterType == ClusterType), It.IsAny<string>()),
491491
Times.Once);
492492
}
493493

@@ -505,7 +505,7 @@ public void TestStorageAccountTypeAzureStorage()
505505
cmdlet.ClusterType = ClusterType;
506506
cmdlet.DefaultStorageAccountType = StorageType.AzureStorage;
507507

508-
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, OSType.Linux, It.IsAny<ClusterCreateParameters>()));
508+
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, OSType.Linux, It.IsAny<ClusterCreateParameters>(), It.IsAny<string>()));
509509

510510
cmdlet.ExecuteCmdlet();
511511

@@ -518,7 +518,7 @@ public void TestStorageAccountTypeAzureStorage()
518518
parameters.Location == Location &&
519519
parameters.UserName == _httpCred.UserName &&
520520
parameters.Password == _httpCred.Password.ConvertToString() &&
521-
parameters.ClusterType == ClusterType)),
521+
parameters.ClusterType == ClusterType), It.IsAny<string>()),
522522
Times.Once);
523523
}
524524

@@ -537,7 +537,7 @@ public void TestStorageAccountTypeAzureDataLakeStore()
537537
cmdlet.ClusterType = ClusterType;
538538
cmdlet.DefaultStorageAccountType = StorageType.AzureDataLakeStore;
539539

540-
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, OSType.Linux, It.IsAny<ClusterCreateParameters>()));
540+
hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, OSType.Linux, It.IsAny<ClusterCreateParameters>(), It.IsAny<string>()));
541541

542542
cmdlet.ExecuteCmdlet();
543543

@@ -550,7 +550,7 @@ public void TestStorageAccountTypeAzureDataLakeStore()
550550
parameters.Location == Location &&
551551
parameters.UserName == _httpCred.UserName &&
552552
parameters.Password == _httpCred.Password.ConvertToString() &&
553-
parameters.ClusterType == ClusterType)),
553+
parameters.ClusterType == ClusterType), It.IsAny<string>()),
554554
Times.Once);
555555
}
556556
}

src/HDInsight/HDInsight.Test/UnitTests/PremiumClusterTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void CanCreateNewPremiumHDInsightCluster()
113113
parameters.SshUserName == _httpCred.UserName &&
114114
parameters.SshPassword == _httpCred.Password.ConvertToString() &&
115115
parameters.ClusterType == ClusterType &&
116-
parameters.ClusterTier == Tier.Premium)))
116+
parameters.ClusterTier == Tier.Premium), It.IsAny<string>()))
117117
.Returns(cluster)
118118
.Verifiable();
119119

src/HDInsight/HDInsight/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
Supported specifying minimal supported TLS version when creating cluster.
2122

2223
## Version 3.0.3
2324
* Fix document error of New-AzHDInsightCluster.

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="5.1.0" />
14+
<PackageReference Include="Microsoft.Azure.Management.HDInsight" Version="5.3.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: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ public AzureHDInsightConfig Config
136136
CertificateFilePath = CertificateFilePath,
137137
CertificatePassword = CertificatePassword,
138138
SecurityProfile = SecurityProfile,
139-
DisksPerWorkerNode = DisksPerWorkerNode
139+
DisksPerWorkerNode = DisksPerWorkerNode,
140+
MinSupportedTlsVersion = MinSupportedTlsVersion
140141
};
141142
foreach (
142143
var storageAccount in
@@ -190,6 +191,7 @@ var storageAccount in
190191
CertificatePassword = value.CertificatePassword;
191192
SecurityProfile = value.SecurityProfile;
192193
DisksPerWorkerNode = value.DisksPerWorkerNode;
194+
MinSupportedTlsVersion = value.MinSupportedTlsVersion;
193195

194196
foreach (
195197
var storageAccount in
@@ -353,6 +355,9 @@ public DateTime RdpAccessExpiry
353355
[Parameter(HelpMessage = "Gets or sets the number of disks for worker node role in the cluster.")]
354356
public int DisksPerWorkerNode { get; set; }
355357

358+
[Parameter(HelpMessage = "Gets or sets the minimal supported TLS version.")]
359+
public string MinSupportedTlsVersion { get; set; }
360+
356361
#endregion
357362

358363

@@ -473,7 +478,7 @@ var storageAccount in
473478
};
474479
}
475480

476-
var cluster = HDInsightManagementClient.CreateNewCluster(ResourceGroupName, ClusterName, OSType, parameters);
481+
var cluster = HDInsightManagementClient.CreateNewCluster(ResourceGroupName, ClusterName, OSType, parameters, MinSupportedTlsVersion);
477482

478483
if (cluster != null)
479484
{

src/HDInsight/HDInsight/ManagementCommands/NewAzureHDInsightClusterConfigCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ public Guid AadTenantId
148148
set { _config.AADTenantId = value; }
149149
}
150150

151+
[Parameter(HelpMessage = "Gets or sets the minimal supported TLS version.")]
152+
public string MinSupportedTlsVersion
153+
{
154+
get { return _config.MinSupportedTlsVersion; }
155+
set { _config.MinSupportedTlsVersion = value; }
156+
}
157+
151158
#endregion
152159

153160
public NewAzureHDInsightClusterConfigCommand()

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public AzureHDInsightCluster(Cluster cluster)
6666
LdapsUrls = clusterSecurityProfile.LdapsUrls != null ? clusterSecurityProfile.LdapsUrls.ToArray() : null,
6767
ClusterUsersGroupDNs = clusterSecurityProfile.ClusterUsersGroupDNs != null ? clusterSecurityProfile.ClusterUsersGroupDNs.ToArray() : null,
6868
} : null;
69+
70+
MinSupportedTlsVersion = cluster.Properties.MinSupportedTlsVersion;
6971
}
7072

7173
public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> clusterConfiguration, IDictionary<string, string> clusterIdentity)
@@ -201,5 +203,10 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
201203
/// The security profile.
202204
/// </value>
203205
public AzureHDInsightSecurityProfile SecurityProfile { get; set; }
206+
207+
/// <summary>
208+
/// Gets or sets the minimal supported TLS version.
209+
/// </summary>
210+
public string MinSupportedTlsVersion { get; set; }
204211
}
205212
}

src/HDInsight/HDInsight/Models/Management/AzureHDInsightConfig.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ public class AzureHDInsightConfig
140140
/// </summary>
141141
public int DisksPerWorkerNode { get; set; }
142142

143+
/// <summary>
144+
/// Gets or sets the minimal supported TLS version.
145+
/// </summary>
146+
public string MinSupportedTlsVersion { get; set; }
147+
143148
public AzureHDInsightConfig()
144149
{
145150
ClusterType = Constants.Hadoop;

src/HDInsight/HDInsight/Models/Management/AzureHdInsightManagementClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ public AzureHdInsightManagementClient() { }
3434

3535
private IHDInsightManagementClient HdInsightManagementClient { get; set; }
3636

37-
public virtual Cluster CreateNewCluster(string resourceGroupName, string clusterName, OSType osType, ClusterCreateParameters parameters)
37+
public virtual Cluster CreateNewCluster(string resourceGroupName, string clusterName, OSType osType, ClusterCreateParameters parameters, string minSupportedTlsVersion=default(string))
3838
{
3939
var createParams = CreateParametersConverter.GetExtendedClusterCreateParameters(clusterName, parameters);
4040
createParams.Properties.OsType = osType;
41+
createParams.Properties.MinSupportedTlsVersion = minSupportedTlsVersion;
4142
return HdInsightManagementClient.Clusters.Create(resourceGroupName, clusterName, createParams);
4243
}
4344

0 commit comments

Comments
 (0)