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
66 changes: 59 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ To install the package, use the following command in your .NET Core project:

```bash
dotnet add package K8sOperator.NET
dotnet add package K8sOperator.NET.Generators
```

Alternatively, you can add it manually to your `.csproj` file:

```xml
<PackageReference Include="K8sOperator.NET" Version="0.1.0" />
<PackageReference Include="K8sOperator.NET.Generators" Version="0.1.0" />
```

## Usage
Expand All @@ -48,22 +50,72 @@ Here are some basic examples of how to use the library:
```csharp
using K8sOperator.NET;

var builder = WebApplication.CreateBuilder(args);
var builder = OperatorHost.CreateOperatorApplicationBuilder(args);

builder.AddController<ProjectController>()
.WithFinalizer("project.local.finalizer");

```
var app = builder.Build();

### Use
app.AddInstall();

```csharp
await app.RunAsync();

```

var test = new string();
### add custom launchSettings.json

```json

{
"profiles": {
"Operator": {
"commandName": "Project",
"commandLineArgs": "operator",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Install": {
"commandName": "Project",
"commandLineArgs": "install > ./install.yaml",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Help": {
"commandName": "Project",
"commandLineArgs": "",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
},
"Version": {
"commandName": "Project",
"commandLineArgs": "version",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json"
}

```

## Configuration

[TODO]
By running the `Install` profile will create the install.yaml file in the root of the project. This file can be used to install the operator in a Kubernetes cluster.

Run the following command to install the operator:
```bash
kubectl apply -f install.yaml
```


## Contributing

Expand All @@ -77,4 +129,4 @@ Contributions are welcome! Please feel free to submit a pull request or open an

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.
8 changes: 4 additions & 4 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="KubernetesClient" Version="15.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="KubernetesClient" Version="16.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.7.0.110445" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="AwesomeAssertions" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
Expand Down
16 changes: 8 additions & 8 deletions test/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="AwesomeAssertions" Version="8.0.2" />
<PackageVersion Include="Microsoft.AspNetCore" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.8" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Update="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion test/K8sOperator.NET.Tests/ControllerTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace K8sOperator.NET.Tests;
using FluentAssertions;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Consider standardizing assertion libraries across test projects

You've added FluentAssertions here, but according to the summary, other parts of the project are moving to AwesomeAssertions. This might lead to inconsistent assertion styles across the codebase.


🏁 Script executed:

#!/bin/bash
# Check which assertion libraries are being used across test projects
rg -l "using .*Assertions;" --type csharp

Length of output: 145


Action Required: Align Assertion Library Usage

The ControllerTests.cs file currently imports and uses FluentAssertions, while evidence from ControllerDatasourceTests.cs shows a shift toward AwesomeAssertions. To ensure consistency across test projects, please standardize on AwesomeAssertions by updating the import and any affected test assertions accordingly.


namespace K8sOperator.NET.Tests;

public class ControllerTests
{
Expand Down
10 changes: 10 additions & 0 deletions test/K8sOperator.NET.Tests/K8sOperator.NET.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@
<PackageReference Include="System.Linq.Async" />
<PackageReference Include="System.Reactive" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Loading