Skip to content

Commit dbcd5bf

Browse files
authored
Merge pull request Azure#3639 from momusoru/dev
Added support for RServer cluster type with edgenode size and RStudio config
2 parents 9649b5f + ab6786d commit dbcd5bf

16 files changed

+253
-40
lines changed

src/ResourceManager/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
## Current Release
21+
* Added support for RServer cluster type
22+
- Edgenode VM size can be specified for RServer cluster in New-AzureRmHDInsightCluster or New-AzureRmHDInsightClusterConfig
23+
- RServer is now a configuration option in Add-AzureRmHDInsightConfigValues. It allows for RStudio flag to be set to indicate that R Studio installation should be done.
2124

2225
## Version 2.7.0
2326

src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5252
</Reference>
5353
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.2.0.1\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
54+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.2.0.3\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
5555
<Private>True</Private>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">

src/ResourceManager/HDInsight/Commands.HDInsight.Test/HDInsightTestBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ namespace Microsoft.Azure.Commands.HDInsight.Test
2525
{
2626
public class HDInsightTestBase : RMTestBase
2727
{
28-
protected const string ClusterType = "Hadoop";
2928
protected const string ClusterName = "hdicluster";
3029
protected const string ResourceGroupName = "hdi-rg1";
3130
protected const string Location = "west us";
3231

32+
protected string ClusterType = "Hadoop";
33+
protected string HdiVersion = "3.1";
34+
3335
protected Mock<AzureHdInsightManagementClient> hdinsightManagementMock;
3436
protected Mock<AzureHdInsightJobManagementClient> hdinsightJobManagementMock;
3537
protected Mock<ICommandRuntime> commandRuntimeMock;

src/ResourceManager/HDInsight/Commands.HDInsight.Test/UnitTests/ConfigurationTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ public ConfigurationTests(Xunit.Abstractions.ITestOutputHelper output)
3030
[Fact]
3131
[Trait(Category.AcceptanceType, Category.CheckIn)]
3232
public void CanCreateNewConfig()
33+
{
34+
CreateNewConfig();
35+
}
36+
37+
[Fact]
38+
[Trait(Category.AcceptanceType, Category.CheckIn)]
39+
public void CanCreateNewConfigForRServer()
40+
{
41+
CreateNewConfig(setEdgeNodeVmSize: true);
42+
}
43+
44+
public void CreateNewConfig(bool setEdgeNodeVmSize = false)
3345
{
3446
var newconfigcmdlet = new NewAzureHDInsightClusterConfigCommand
3547
{
@@ -38,6 +50,8 @@ public void CanCreateNewConfig()
3850
ClusterType = ClusterType
3951
};
4052

53+
if (setEdgeNodeVmSize) newconfigcmdlet.EdgeNodeSize = "edgeNodeVmSizeSetTest";
54+
4155
newconfigcmdlet.ExecuteCmdlet();
4256
commandRuntimeMock.Verify(
4357
f =>
@@ -52,6 +66,7 @@ public void CanCreateNewConfig()
5266
string.IsNullOrEmpty(c.DefaultStorageAccountName) &&
5367
string.IsNullOrEmpty(c.HeadNodeSize) &&
5468
string.IsNullOrEmpty(c.ZookeeperNodeSize) &&
69+
((!setEdgeNodeVmSize && string.IsNullOrEmpty(c.EdgeNodeSize)) || (setEdgeNodeVmSize && c.EdgeNodeSize == "edgeNodeVmSizeSetTest")) &&
5570
c.HiveMetastore == null &&
5671
c.OozieMetastore == null &&
5772
c.ScriptActions.Count == 0)),

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public void CanCreateNewHDInsightCluster_Linux()
145145
clusterout =>
146146
clusterout.ClusterState == "Running" &&
147147
clusterout.ClusterType == ClusterType &&
148-
clusterout.ClusterVersion == "3.1" &&
148+
clusterout.ClusterVersion == HdiVersion &&
149149
clusterout.CoresUsed == 24 &&
150150
clusterout.Location == Location &&
151151
clusterout.Name == ClusterName &&
@@ -154,6 +154,16 @@ public void CanCreateNewHDInsightCluster_Linux()
154154

155155
}
156156

157+
[Fact]
158+
[Trait(Category.AcceptanceType, Category.CheckIn)]
159+
public void CanCreateNewHDInsightCluster_RServer_Linux()
160+
{
161+
ClusterType = "RServer";
162+
HdiVersion = "3.5";
163+
164+
CreateNewHDInsightCluster(setEdgeNodeVmSize:true);
165+
}
166+
157167
[Fact]
158168
[Trait(Category.AcceptanceType, Category.CheckIn)]
159169
public void CanCreateNewHDInsightCluster_Secure_Linux()
@@ -179,7 +189,7 @@ public void CanCreateNewHDInsightCluster_Secure_Linux()
179189
clusterout =>
180190
clusterout.ClusterState == "Running" &&
181191
clusterout.ClusterType == ClusterType &&
182-
clusterout.ClusterVersion == "3.1" &&
192+
clusterout.ClusterVersion == HdiVersion &&
183193
clusterout.CoresUsed == 24 &&
184194
clusterout.Location == Location &&
185195
clusterout.Name == ClusterName &&
@@ -195,7 +205,7 @@ public void CanCreateNewHDInsightCluster_Secure_Linux()
195205
Times.Once);
196206
}
197207

198-
private void CreateNewHDInsightCluster(bool addSecurityProfileInresponse = false)
208+
private void CreateNewHDInsightCluster(bool addSecurityProfileInresponse = false, bool setEdgeNodeVmSize = false)
199209
{
200210
cmdlet.ClusterName = ClusterName;
201211
cmdlet.ResourceGroupName = ResourceGroupName;
@@ -207,15 +217,17 @@ private void CreateNewHDInsightCluster(bool addSecurityProfileInresponse = false
207217
cmdlet.ClusterType = ClusterType;
208218
cmdlet.SshCredential = _sshCred;
209219
cmdlet.OSType = OSType.Linux;
210-
220+
if (setEdgeNodeVmSize)
221+
cmdlet.EdgeNodeSize = "edgeNodeVmSizeSetTest";
222+
211223
var cluster = new Cluster
212224
{
213225
Id = "id",
214226
Name = ClusterName,
215227
Location = Location,
216228
Properties = new ClusterGetProperties
217229
{
218-
ClusterVersion = "3.1",
230+
ClusterVersion = HdiVersion,
219231
ClusterState = "Running",
220232
ClusterDefinition = new ClusterDefinition
221233
{
@@ -286,7 +298,8 @@ private void CreateNewHDInsightCluster(bool addSecurityProfileInresponse = false
286298
parameters.ClusterType == ClusterType &&
287299
parameters.OSType == OSType.Linux &&
288300
parameters.SshUserName == _sshCred.UserName &&
289-
parameters.SshPassword == _sshCred.Password.ConvertToString())))
301+
parameters.SshPassword == _sshCred.Password.ConvertToString() &&
302+
((!setEdgeNodeVmSize && parameters.EdgeNodeSize == null) || (setEdgeNodeVmSize && parameters.EdgeNodeSize == "edgeNodeVmSizeSetTest")))))
290303
.Returns(getresponse)
291304
.Verifiable();
292305

@@ -297,7 +310,7 @@ private void CreateNewHDInsightCluster(bool addSecurityProfileInresponse = false
297310
clusterout =>
298311
clusterout.ClusterState == "Running" &&
299312
clusterout.ClusterType == ClusterType &&
300-
clusterout.ClusterVersion == "3.1" &&
313+
clusterout.ClusterVersion == HdiVersion &&
301314
clusterout.CoresUsed == 24 &&
302315
clusterout.Location == Location &&
303316
clusterout.Name == ClusterName &&

src/ResourceManager/HDInsight/Commands.HDInsight.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.HDInsight" version="2.0.1" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.HDInsight" version="2.0.3" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.3" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />

src/ResourceManager/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<HintPath>..\..\..\packages\Microsoft.Azure.Graph.RBAC.3.2.0-preview\lib\net45\Microsoft.Azure.Graph.RBAC.dll</HintPath>
130130
</Reference>
131131
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
132-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.2.0.1\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
132+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.2.0.3\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
133133
<Private>True</Private>
134134
</Reference>
135135
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">

src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/AddAzureHDInsightConfigValuesCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public class AddAzureHDInsightConfigValuesCommand : HDInsightCmdletBase
3030
{
3131
private Dictionary<string, Hashtable> _configurations;
3232

33+
private const string RServerConfigurationKey = "RServer";
34+
3335
#region Input Parameter Definitions
3436

3537
[Parameter(Position = 0,
@@ -77,6 +79,9 @@ public class AddAzureHDInsightConfigValuesCommand : HDInsightCmdletBase
7779
[Parameter(HelpMessage = "Gets the Hdfs Site configurations of this HDInsight cluster.")]
7880
public Hashtable Hdfs { get; set; }
7981

82+
[Parameter(HelpMessage = "Gets the RServer configurations.")]
83+
public Hashtable RServer { get; set; }
84+
8085
#endregion
8186

8287
public AddAzureHDInsightConfigValuesCommand()
@@ -94,6 +99,7 @@ public AddAzureHDInsightConfigValuesCommand()
9499
MapRed = new Hashtable();
95100
Tez = new Hashtable();
96101
Hdfs = new Hashtable();
102+
RServer = new Hashtable();
97103
}
98104

99105
public override void ExecuteCmdlet()
@@ -113,6 +119,7 @@ public override void ExecuteCmdlet()
113119
AddConfigToConfigurations(MapRed, ConfigurationKey.MapRedSite);
114120
AddConfigToConfigurations(Tez, ConfigurationKey.TezSite);
115121
AddConfigToConfigurations(Hdfs, ConfigurationKey.HdfsSite);
122+
AddConfigToConfigurations(RServer, RServerConfigurationKey);
116123

117124
WriteObject(Config);
118125
}

src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterCommand.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public AzureHDInsightConfig Config
127127
DefaultStorageAccountKey = _defaultStorageAccountKey,
128128
WorkerNodeSize = parameters.WorkerNodeSize,
129129
HeadNodeSize = parameters.HeadNodeSize,
130+
EdgeNodeSize = parameters.EdgeNodeSize,
130131
ZookeeperNodeSize = parameters.ZookeeperNodeSize,
131132
HiveMetastore = HiveMetastore,
132133
OozieMetastore = OozieMetastore,
@@ -176,6 +177,7 @@ var storageAccount in
176177
}
177178
parameters.WorkerNodeSize = value.WorkerNodeSize;
178179
parameters.HeadNodeSize = value.HeadNodeSize;
180+
parameters.EdgeNodeSize = value.EdgeNodeSize;
179181
parameters.ZookeeperNodeSize = value.ZookeeperNodeSize;
180182
HiveMetastore = value.HiveMetastore;
181183
OozieMetastore = value.OozieMetastore;
@@ -254,6 +256,13 @@ public string WorkerNodeSize
254256
set { parameters.WorkerNodeSize = value; }
255257
}
256258

259+
[Parameter(HelpMessage = "Gets or sets the size of the Edge Node if available for the cluster type.")]
260+
public string EdgeNodeSize
261+
{
262+
get { return parameters.EdgeNodeSize; }
263+
set { parameters.EdgeNodeSize = value; }
264+
}
265+
257266
[Parameter(HelpMessage = "Gets or sets the size of the Zookeeper Node.")]
258267
public string ZookeeperNodeSize
259268
{

src/ResourceManager/HDInsight/Commands.HDInsight/ManagementCommands/NewAzureHDInsightClusterConfigCommand.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ public string WorkerNodeSize
8181
set { _config.WorkerNodeSize = value; }
8282
}
8383

84+
[Parameter(HelpMessage = "Gets or sets the size of the Edge Node if available for the cluster type.")]
85+
public string EdgeNodeSize
86+
{
87+
get { return _config.EdgeNodeSize; }
88+
set { _config.EdgeNodeSize = value; }
89+
}
90+
8491
[Parameter(HelpMessage = "Gets or sets the size of the Zookeeper Node.")]
8592
public string ZookeeperNodeSize
8693
{

0 commit comments

Comments
 (0)