Skip to content

Commit 789f1e3

Browse files
author
Eddie
authored
fix: add backwards compatibilty for cert creation (#578)
1 parent a8fcafd commit 789f1e3

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/KubeOps/Operator/Commands/Management/Webhooks/Install.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public Install(
5252

5353
public async Task<int> OnExecuteAsync(CommandLineApplication app)
5454
{
55+
var settings = app.GetRequiredService<OperatorSettings>();
56+
settings.PreInitializeAction?.Invoke(settings);
57+
5558
var client = app.GetRequiredService<IKubernetesClient>();
5659

5760
var @namespace = await client.GetCurrentNamespace();

src/KubeOps/Operator/Commands/RunOperator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ internal class RunOperator
1919
public RunOperator(IHost host, OperatorSettings settings)
2020
{
2121
_host = host;
22+
settings.PreInitializeAction?.Invoke(settings);
2223
_settings = settings;
2324
}
2425

src/KubeOps/Operator/OperatorSettings.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using KellermanSoftware.CompareNetObjects;
44
using KubeOps.KubernetesClient;
55
using KubeOps.Operator.Errors;
6+
using static System.Net.WebRequestMethods;
67

78
namespace KubeOps.Operator;
89

@@ -180,4 +181,12 @@ public sealed class OperatorSettings
180181
AutoClearCache = false,
181182
MembersToIgnore = new List<string> { "ResourceVersion", "ManagedFields" },
182183
};
184+
185+
/// <summary>
186+
/// Use this to configure the operator to execute any custom code before any of the installers or execution begins.
187+
/// </summary>
188+
/// <example> The issue 567 removed the downloading of the cloudflare certificate tooling and moved it to the dockerfile. This is more secure, but may not be suitable for all users. Use this action to reproduce the logic from before and download the appropriate tooling.</example>
189+
/// <see href="https://github.com/buehler/dotnet-operator-sdk/issues/567"/>
190+
/// <seealso href="https://github.com/buehler/dotnet-operator-sdk/blob/v7.2.0/src/KubeOps/Operator/Commands/CommandHelpers/CertificateGenerator.cs#L153-L213"/>
191+
public Action<OperatorSettings>? PreInitializeAction { get; set; }
183192
}

0 commit comments

Comments
 (0)