MarcinJuraszek
MarcinJuraszek

Reputation: 125630

Programatically Add/Remove nodes from Service Fabric cluster

I know I can use PowerShell commands as described here

.\AddNode.ps1 -NodeName VM5 -NodeType NodeType0 -NodeIPAddressorFQDN 182.17.34.52 -ExistingClientConnectionEndpoint 182.17.34.50:19000 -UpgradeDomain UD1 -FaultDomain fd:/dc1/r0 -AcceptEULA
.\RemoveNode.ps1 -ExistingClientConnectionEndpoint 182.17.34.50:19000

However, I'd like to do the same from a .NET application. I looked at FabricClient.ClusterManagementClient documentation and there are methods to activate/deactivate nodes, but nothing about adding/removing them.

Upvotes: 0

Views: 795

Answers (1)

Max Burlik
Max Burlik

Reputation: 336

There are public managed APIs for said functionality available through Microsoft.ServiceFabric.DeploymentManager.dll DeploymentManager class, which the powershell scripts are wrapping. You can find this in the Standalone package DeploymentComponents folder.

If you choose to consume the APIs in this way, note you will need to have DeploymentComponents resources local to the imported assembly.

We are looking into improving the dev experience for this in the future, possibly through the use of a nuget package.

Upvotes: 3

Related Questions