A library to support Helm Chart installation in Kubernetes cluster from .NET code
SmoothSailing
is distribute as a nuget package SmoothSailing
var chartInstaller = new ChartInstaller();
await using var release = await chartInstaller.Install
(
chart: new ChartFromLocalPath("./charts/mysamplechart"),
releaseName: "samplerelease",
overrides: new {
sample_property = "sample_value"
},
timeout: TimeSpan.FromMinutes(2)
);
- Add your Helm Charts into
charts/
directory in your project - Edit project file to include all chart's file as
Content
in your nuget package
<ItemGroup>
<Content Include="charts/**/*.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
</ItemGroup>
- Make sure that all
yaml
files are encoded asUTF-8
notUTF-8-BOOM
Setup MsSql for tests.
Built on top of helm chart provided by https://github.com/microsoft/mssql-docker/tree/master/linux/sample-helm-chart
[Test]
public async Task install_mssql()
{
var chartInstaller = new ChartInstaller();
await using var release = await chartInstaller.Install
(
chart: new ChartFromLocalPath("./charts/mssql"),
releaseName: "samplerelease",
overrides: new MsSqlConfiguration
{
ServicePort = 1433,
SaPassword = "StrongPass1!"
},
timeout: TimeSpan.FromMinutes(2)
);
var localPort= await release.StartPortForwardForService("samplerelease-mssql-latest", servicePort: 1433);
Console.WriteLine($"SqlServer available at {localPort}");
}