Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions examples/ConversionWebhookOperator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

#if DEBUG
using System.Net;
#endif

using KubeOps.Operator;

#if DEBUG
using KubeOps.Operator.Web.Builder;
using KubeOps.Operator.Web.Certificates;
#endif

var builder = WebApplication.CreateBuilder(args);

#if !DEBUG
builder.Services
.AddKubernetesOperator()
.RegisterComponents();
#else
var opBuilder = builder.Services
.AddKubernetesOperator()
.RegisterComponents();
#endif

#if DEBUG
const string ip = "192.168.1.100";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class TestConversionWebhook : ConversionWebhook<V3TestEntity>
new V1ToV3(), new V2ToV3(),
};

private class V1ToV3 : IEntityConverter<V1TestEntity, V3TestEntity>
private sealed class V1ToV3 : IEntityConverter<V1TestEntity, V3TestEntity>
{
public V3TestEntity Convert(V1TestEntity from)
{
Expand All @@ -38,7 +38,7 @@ public V1TestEntity Revert(V3TestEntity to)
}
}

private class V2ToV3 : IEntityConverter<V2TestEntity, V3TestEntity>
private sealed class V2ToV3 : IEntityConverter<V2TestEntity, V3TestEntity>
{
public V3TestEntity Convert(V2TestEntity from)
{
Expand Down
1 change: 1 addition & 0 deletions examples/Operator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#if DEBUG
using KubeOps.Abstractions.Crds;
#endif

using KubeOps.Operator;

using Microsoft.Extensions.Hosting;
Expand Down
12 changes: 12 additions & 0 deletions examples/WebhookOperator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

#if DEBUG
using System.Net;
#endif

using KubeOps.Operator;

#if DEBUG
using KubeOps.Operator.Web.Builder;
using KubeOps.Operator.Web.Certificates;
#endif

var builder = WebApplication.CreateBuilder(args);

#if !DEBUG
builder.Services
.AddKubernetesOperator()
.RegisterComponents();
#else
var opBuilder = builder.Services
.AddKubernetesOperator()
.RegisterComponents();
#endif

#if DEBUG
const string ip = "192.168.1.100";
Expand Down
4 changes: 2 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"enabled": false
},
{
"matchManagers": ["dotnet"],
"matchManagers": ["nuget"],
"matchDepNames": ["Microsoft.CodeAnalysis.CSharp"],
"matchFileNames": ["KubeOps.Generator.csproj"],
"matchFileNames": ["**/KubeOps.Generator.csproj"],
"enabled": false
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace KubeOps.Abstractions.Entities;

// This is the same pattern used by Microsoft on ILogger<T>.
// An alternative would be to use a KeyedSingleton when registering this however that's only valid from .NET 8 and above.
// An alternative would be to use a KeyedSingleton when registering this; however, that's only valid from .NET 8 and above.
// Other methods are far less elegant
#pragma warning disable S2326
public interface IEntityFieldSelector<TEntity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace KubeOps.Abstractions.Entities;

// This is the same pattern used by Microsoft on ILogger<T>.
// An alternative would be to use a KeyedSingleton when registering this however that's only valid from .NET 8 and above.
// An alternative would be to use a KeyedSingleton when registering this; however, that's only valid from .NET 8 and above.
// Other methods are far less elegant
#pragma warning disable S2326
public interface IEntityLabelSelector<TEntity>
Expand Down
4 changes: 2 additions & 2 deletions src/KubeOps.Aspire.Hosting/KubeOpsHostingExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private static void ConfigureOperatorPod(
string name,
KubeOpsKubernetesManifestOptions options)
{
var podSpec = kubernetes.Workload?.PodTemplate?.Spec;
var podSpec = kubernetes.Workload?.PodTemplate.Spec;
if (podSpec is null)
{
return;
Expand Down Expand Up @@ -626,7 +626,7 @@ private static void MergeKubeOpsDeployment(KubernetesResource kubernetes, JsonOb
}

var generatedPodSpec = generatedSpec["template"]?["spec"] as JsonObject;
var podSpec = kubernetes.Workload?.PodTemplate?.Spec;
var podSpec = kubernetes.Workload?.PodTemplate.Spec;
if (generatedPodSpec is null || podSpec is null)
{
return;
Expand Down
1 change: 0 additions & 1 deletion src/KubeOps.Aspire/KubeOpsServiceDefaultsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using KubeOps.Abstractions.Builder;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
Expand Down
1 change: 0 additions & 1 deletion src/KubeOps.Cli/Commands/Generator/Generate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.

using System.CommandLine;
using System.CommandLine.Help;

namespace KubeOps.Cli.Commands.Generator;

Expand Down
1 change: 0 additions & 1 deletion src/KubeOps.Cli/Commands/Management/Install.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.

using System.CommandLine;
using System.CommandLine.Invocation;

using k8s;
using k8s.Autorest;
Expand Down
1 change: 0 additions & 1 deletion src/KubeOps.Cli/Commands/Management/Uninstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.

using System.CommandLine;
using System.CommandLine.Invocation;

using k8s;
using k8s.Autorest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

namespace KubeOps.Generator.SyntaxReceiver;
namespace KubeOps.Generator.Discovery;

internal record struct AttributedEntity(
ClassDeclarationMetaData ClassDeclaration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;

namespace KubeOps.Generator.SyntaxReceiver;
namespace KubeOps.Generator.Discovery;

internal record struct ClassDeclarationMetaData(
string ClassName,
string FullyQualifiedName,
string? Namespace,
SyntaxTokenList? Modifiers,
EquatableArray<SyntaxKind> ModifierKinds,
bool IsPartial,
bool HasParameterlessConstructor,
bool IsFromReferencedAssembly);
9 changes: 9 additions & 0 deletions src/KubeOps.Generator/Discovery/ControllerRegistration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

namespace KubeOps.Generator.Discovery;

internal record struct ControllerRegistration(
string FullyQualifiedController,
string FullyQualifiedEntityName);
Loading
Loading