Skip to content

Commit 3421e5d

Browse files
authored
Merge pull request #11 from SimCubeLtd/dev
Default release method
2 parents d07017f + 2e62aa5 commit 3421e5d

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/SimCube.PulumiDeployments/Resources/Helm/BaseHelmChartResource.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace SimCube.PulumiDeployments.Resources.Helm;
1+
using Pulumi.Kubernetes.Helm.V3;
2+
using Pulumi.Kubernetes.Types.Inputs.Helm.V3;
3+
4+
namespace SimCube.PulumiDeployments.Resources.Helm;
25

36
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "I Want them.")]
47
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "I Want them.")]
@@ -23,6 +26,7 @@ protected BaseHelmChartResource(
2326
};
2427

2528
protected abstract string HelmValuesFile { get; }
29+
protected abstract string ChartName { get; }
2630

2731
protected string RenderYamlValues(Dictionary<string, string?> environmentalVariables)
2832
{
@@ -41,5 +45,32 @@ protected string RenderYamlValues(Dictionary<string, string?> environmentalVaria
4145
return helmValuesFile;
4246
}
4347

48+
protected Release CreateRelease(
49+
NamespaceResource @namespace,
50+
string helmChartName,
51+
string helmRepository,
52+
string? helmChartVersion = null,
53+
bool waitForJobs = true,
54+
bool skipAwait = false,
55+
int timeout = 1200,
56+
List<FileAsset>? helmValuesFiles = null) =>
57+
new(
58+
ChartName,
59+
new()
60+
{
61+
Namespace = @namespace.NamespaceName,
62+
Chart = helmChartName,
63+
Version = helmChartVersion ?? string.Empty,
64+
WaitForJobs = waitForJobs,
65+
SkipAwait = skipAwait,
66+
Timeout = timeout,
67+
RepositoryOpts = new RepositoryOptsArgs
68+
{
69+
Repo = helmRepository,
70+
},
71+
ValueYamlFiles = new List<AssetOrArchive>(helmValuesFiles ?? new List<FileAsset>()),
72+
},
73+
CustomResourceOptions);
74+
4475
private string GetHelmValuesFilePath() => Path.Combine(AppContext.BaseDirectory, HelmValuesFolder, HelmValuesFile);
4576
}

0 commit comments

Comments
 (0)