Skip to content

Commit af97970

Browse files
authored
Update XML Comments (#10)
1 parent d5637a1 commit af97970

38 files changed

+933
-285
lines changed

assets/logo.afdesign

-1.17 KB
Binary file not shown.

examples/SimpleOperator/Projects/ProjectController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using k8s;
2-
using k8s.Models;
3-
using K8sOperator.NET;
1+
using K8sOperator.NET;
42

53
namespace SimpleOperator.Projects;
64

examples/SimpleOperator/SimpleOperator.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Company>pmdevers</Company>
88

9-
<PackageVersion>2.0.0</PackageVersion>
109
</PropertyGroup>
1110

1211
<ItemGroup>
13-
<PackageReference Include="K8sOperator.NET" Version="0.0.1-alpha0002" />
12+
<PackageReference Include="K8sOperator.NET" Version="0.0.1-alpha0003" />
1413
</ItemGroup>
1514

1615

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: testitems.sonarcloud.io
5+
spec:
6+
group: sonarcloud.io
7+
names:
8+
kind: TestItem
9+
listKind: TestItemList
10+
plural: testitems
11+
singular: testitem
12+
scope: Namespaced
13+
versions:
14+
- name: v1alpha1
15+
schema:
16+
openAPIV3Schema:
17+
properties:
18+
status:
19+
nullable: false
20+
type: object
21+
spec:
22+
nullable: false
23+
properties:
24+
scope:
25+
enum:
26+
- Cluster
27+
- Namespaced
28+
type: string
29+
string:
30+
nullable: false
31+
type: string
32+
required:
33+
- scope
34+
type: object
35+
type: object
36+
served: true
37+
storage: true
38+
---
39+
apiVersion: apiextensions.k8s.io/v1
40+
kind: CustomResourceDefinition
41+
metadata:
42+
name: projects.sonarcloud.io
43+
spec:
44+
group: sonarcloud.io
45+
names:
46+
kind: Project
47+
listKind: ProjectList
48+
plural: projects
49+
singular: project
50+
scope: Namespaced
51+
versions:
52+
- name: v1alpha1
53+
schema:
54+
openAPIV3Schema:
55+
properties:
56+
status:
57+
nullable: false
58+
properties:
59+
result:
60+
nullable: false
61+
type: string
62+
required:
63+
- result
64+
type: object
65+
spec:
66+
nullable: false
67+
properties:
68+
name:
69+
nullable: false
70+
type: string
71+
organization:
72+
nullable: false
73+
type: string
74+
project:
75+
nullable: false
76+
type: string
77+
required:
78+
- name
79+
- organization
80+
- project
81+
type: object
82+
type: object
83+
served: true
84+
storage: true
85+
---
86+
apiVersion: rbac.authorization.k8s.io/v1
87+
kind: ClusterRole
88+
metadata:
89+
name: simple-operator-role
90+
rules:
91+
- apiGroups:
92+
- ""
93+
resources:
94+
- events
95+
verbs:
96+
- get
97+
- list
98+
- create
99+
- update
100+
- apiGroups:
101+
- coordination.k8s.io
102+
resources:
103+
- leases
104+
verbs:
105+
- '*'
106+
- apiGroups:
107+
- sonarcloud.io
108+
resources:
109+
- testitems
110+
- projects
111+
verbs:
112+
- '*'
113+
- apiGroups:
114+
- sonarcloud.io
115+
resources:
116+
- testitems/status
117+
- projects/status
118+
verbs:
119+
- get
120+
- update
121+
- patch
122+
---
123+
apiVersion: rbac.authorization.k8s.io/v1
124+
kind: ClusterRoleBinding
125+
metadata:
126+
name: simple-operator-role-binding
127+
roleRef:
128+
apiGroup: rbac.authorization.k8s.io
129+
kind: ClusterRole
130+
name: simple-operator-role
131+
subjects:
132+
- kind: ServiceAccount
133+
name: default
134+
namespace: system
135+
---
136+
apiVersion: apps/v1
137+
kind: Deployment
138+
metadata:
139+
labels:
140+
operator-deployment: simple-operator
141+
name: simple-operator-deployment
142+
spec:
143+
replicas: 1
144+
revisionHistoryLimit: 0
145+
selector:
146+
matchLabels:
147+
operator-deployment: simple-operator
148+
template:
149+
metadata:
150+
labels:
151+
operator-deployment: simple-operator
152+
spec:
153+
containers:
154+
- env:
155+
- name: test
156+
valueFrom:
157+
fieldRef:
158+
fieldPath: metadata.namespace
159+
image: ghcr.io/pmdevers/simple-operator:1.0.0
160+
name: simple-operator
161+
resources:
162+
limits:
163+
cpu: 100m
164+
memory: 128Mi
165+
requests:
166+
cpu: 100m
167+
memory: 64Mi
168+
securityContext:
169+
allowPrivilegeEscalation: false
170+
capabilities:
171+
drop:
172+
- ALL
173+
runAsGroup: 2024
174+
runAsNonRoot: true
175+
runAsUser: 2024
176+
securityContext:
177+
runAsNonRoot: true
178+
seccompProfile:
179+
type: RuntimeDefault
180+
terminationGracePeriodSeconds: 10

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
5+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<IsPackable>true</IsPackable>

src/Directory.Packages.props

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,14 @@
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="DotMake.CommandLine" Version="1.8.8" />
87
<PackageVersion Include="KubernetesClient" Version="14.0.9" />
98
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
10-
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.10.0" />
11-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
12-
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
13-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
149
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
1510
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
16-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
17-
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
18-
<PackageVersion Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
1911
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
20-
<PackageVersion Include="SystemTextJsonPatch" Version="3.2.1" />
12+
<PackageVersion Include="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
2113
</ItemGroup>
2214
<ItemGroup>
2315
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="all" />
2416
</ItemGroup>
25-
</Project>
17+
</Project>

src/K8sOperator.NET/Builder/IControllerBuilder.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
using k8s.Models;
22
using Microsoft.Extensions.DependencyInjection;
3-
using System;
43
using System.Reflection;
54

65
namespace K8sOperator.NET.Builder;
76

87
/// <summary>
9-
///
8+
/// Interface for building an Operator Controller.
109
/// </summary>
1110
public interface IControllerBuilder
1211
{
1312
/// <summary>
14-
///
13+
/// Gets the list of metadata associated with the controller.
1514
/// </summary>
1615
List<object> Metadata { get; }
1716
}
@@ -37,12 +36,6 @@ public IController Build()
3736
}
3837
}
3938

40-
public class ControllerBuilderResult
41-
{
42-
public IController Controller { get; set; }
43-
public List<object> Metadata { get; set;}
44-
}
45-
4639
internal class EventWatcherBuilder(IServiceProvider serviceProvider, IController controller, IReadOnlyList<object> metadata)
4740
{
4841
public IEventWatcher Build()

src/K8sOperator.NET/Builder/IControllerDataSource.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
namespace K8sOperator.NET.Builder;
22

33
/// <summary>
4-
///
4+
/// Describes a Controller Datasource
55
/// </summary>
66
public interface IControllerDataSource
77
{
8+
/// <summary>
9+
/// Gets a readonly list of metadata
10+
/// </summary>
811
IReadOnlyList<object> Metadata { get; }
912

1013
/// <summary>
11-
///
14+
/// Adds a controller to the datasource.
1215
/// </summary>
1316
/// <returns></returns>
1417
IControllerConventionBuilder AddController(Type controllerType);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
using Microsoft.Extensions.DependencyInjection;
22

33
namespace K8sOperator.NET.Builder;
4+
5+
/// <summary>
6+
/// Describes a IKubernetesBuilder
7+
/// </summary>
48
public interface IKubernetesBuilder
59
{
10+
/// <summary>
11+
/// The service collection.
12+
/// </summary>
613
public IServiceCollection Services { get; }
714
}

src/K8sOperator.NET/Builder/IOperatorHostBuilder.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,45 @@
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.DependencyInjection;
55
using Microsoft.Extensions.Logging;
6-
using System.Diagnostics;
76
using System.Reflection;
87

9-
108
namespace K8sOperator.NET.Builder;
9+
10+
/// <summary>
11+
/// Interface for building an Operator Application.
12+
/// </summary>
1113
public interface IOperatorApplicationBuilder
1214
{
15+
/// <summary>
16+
/// Gets the configuration settings for the application.
17+
/// </summary>
1318
IConfiguration Configuration { get; }
19+
20+
/// <summary>
21+
/// Gets the collection of services used by the application.
22+
/// </summary>
1423
IServiceCollection Services { get; }
24+
25+
/// <summary>
26+
/// Gets the logging builder for configuring logging services.
27+
/// </summary>
1528
ILoggingBuilder Logging { get; }
29+
30+
/// <summary>
31+
/// Gets the data source for the controller, providing access to the Kubernetes resources.
32+
/// </summary>
1633
IControllerDataSource DataSource { get; }
1734

35+
/// <summary>
36+
/// Gets the list of metadata associated with the application.
37+
/// </summary>
1838
List<object> Metadata { get; }
19-
39+
40+
/// <summary>
41+
/// Builds the Operator Application based on the configured settings and services.
42+
/// </summary>
43+
/// <returns>An instance of <see cref="IOperatorApplication"/> representing the built application.</returns>
44+
2045
IOperatorApplication Build();
2146
}
2247

0 commit comments

Comments
 (0)