Skip to content

Commit 4bc00f1

Browse files
authored
Make Property Conditionaly (#55) (#56)
1 parent 425ed92 commit 4bc00f1

File tree

7 files changed

+95
-22
lines changed

7 files changed

+95
-22
lines changed

README.md

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ To install the package, use the following command in your .NET Core project:
3131

3232
```bash
3333
dotnet add package K8sOperator.NET
34+
dotnet add package K8sOperator.NET.Generators
3435
```
3536

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

3839
```xml
3940
<PackageReference Include="K8sOperator.NET" Version="0.1.0" />
41+
<PackageReference Include="K8sOperator.NET.Generators" Version="0.1.0" />
4042
```
4143

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

51-
var builder = WebApplication.CreateBuilder(args);
53+
var builder = OperatorHost.CreateOperatorApplicationBuilder(args);
5254

55+
builder.AddController<ProjectController>()
56+
.WithFinalizer("project.local.finalizer");
5357

54-
```
58+
var app = builder.Build();
5559

56-
### Use
60+
app.AddInstall();
5761

58-
```csharp
62+
await app.RunAsync();
63+
64+
```
5965

60-
var test = new string();
66+
### add custom launchSettings.json
67+
68+
```json
69+
70+
{
71+
"profiles": {
72+
"Operator": {
73+
"commandName": "Project",
74+
"commandLineArgs": "operator",
75+
"environmentVariables": {
76+
"ASPNETCORE_ENVIRONMENT": "Development"
77+
},
78+
"dotnetRunMessages": true
79+
},
80+
"Install": {
81+
"commandName": "Project",
82+
"commandLineArgs": "install > ./install.yaml",
83+
"environmentVariables": {
84+
"ASPNETCORE_ENVIRONMENT": "Development"
85+
},
86+
"dotnetRunMessages": true
87+
},
88+
"Help": {
89+
"commandName": "Project",
90+
"commandLineArgs": "",
91+
"environmentVariables": {
92+
"ASPNETCORE_ENVIRONMENT": "Development"
93+
},
94+
"dotnetRunMessages": true
95+
},
96+
"Version": {
97+
"commandName": "Project",
98+
"commandLineArgs": "version",
99+
"environmentVariables": {
100+
"ASPNETCORE_ENVIRONMENT": "Development"
101+
},
102+
"dotnetRunMessages": true
103+
}
104+
},
105+
"$schema": "http://json.schemastore.org/launchsettings.json"
106+
}
61107

62108
```
63109

64110
## Configuration
65111

66-
[TODO]
112+
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.
113+
114+
Run the following command to install the operator:
115+
```bash
116+
kubectl apply -f install.yaml
117+
```
118+
67119

68120
## Contributing
69121

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

78130
## License
79131

80-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
132+
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.

src/Directory.Packages.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="KubernetesClient" Version="15.0.1" />
8-
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
7+
<PackageVersion Include="KubernetesClient" Version="16.0.2" />
8+
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
99
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
1010
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
1111
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
12-
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
12+
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.7.0.110445" />
1313
</ItemGroup>
1414
<ItemGroup>
1515
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" />
1616
</ItemGroup>
17-
</Project>
17+
</Project>

test/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="coverlet.collector" />
15-
<PackageReference Include="FluentAssertions" />
15+
<PackageReference Include="AwesomeAssertions" />
1616
<PackageReference Include="NSubstitute" />
1717
<PackageReference Include="Microsoft.NET.Test.Sdk" />
1818
<PackageReference Include="xunit" />

test/Directory.Packages.props

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
8-
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
9-
<PackageVersion Include="Microsoft.AspNetCore" Version="2.2.0" />
10-
<PackageVersion Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
7+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
8+
<PackageVersion Include="AwesomeAssertions" Version="8.0.2" />
9+
<PackageVersion Include="Microsoft.AspNetCore" Version="2.3.0" />
10+
<PackageVersion Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.3.0" />
1111
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.8" />
12-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
13-
<PackageVersion Include="NSubstitute" Version="5.1.0" />
12+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
13+
<PackageVersion Include="NSubstitute" Version="5.3.0" />
1414
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
1515
<PackageVersion Include="System.Reactive" Version="6.0.1" />
16-
<PackageVersion Include="xunit" Version="2.9.2" />
17-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
16+
<PackageVersion Include="xunit" Version="2.9.3" />
17+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
1818
</ItemGroup>
1919
</Project>
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
2+
<ItemGroup>
3+
<PackageReference Update="coverlet.collector">
4+
<PrivateAssets>all</PrivateAssets>
5+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6+
</PackageReference>
7+
<PackageReference Update="xunit.runner.visualstudio">
8+
<PrivateAssets>all</PrivateAssets>
9+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
10+
</PackageReference>
11+
</ItemGroup>
312
</Project>

test/K8sOperator.NET.Tests/ControllerTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace K8sOperator.NET.Tests;
1+
using FluentAssertions;
2+
3+
namespace K8sOperator.NET.Tests;
24

35
public class ControllerTests
46
{

test/K8sOperator.NET.Tests/K8sOperator.NET.Tests.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,14 @@
66
<PackageReference Include="System.Linq.Async" />
77
<PackageReference Include="System.Reactive" />
88
</ItemGroup>
9+
<ItemGroup>
10+
<PackageReference Update="coverlet.collector">
11+
<PrivateAssets>all</PrivateAssets>
12+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
13+
</PackageReference>
14+
<PackageReference Update="xunit.runner.visualstudio">
15+
<PrivateAssets>all</PrivateAssets>
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
17+
</PackageReference>
18+
</ItemGroup>
919
</Project>

0 commit comments

Comments
 (0)