Skip to content

Commit

Permalink
feat: Update reflector options and dependencies
Browse files Browse the repository at this point in the history
- Added `configuration.kubernetes.skipTlsVerify` parameter to helm deployment values
- Added `KubernetesOptions` property to `ReflectorOptions` to support SkipTlsVerify
- Updated package references for Autofac.Extensions.DependencyInjection, KubernetesClient, MediatR, Microsoft.AspNetCore.JsonPatch, Microsoft.VisualStudio.Azure.Containers.Tools.Targets, Serilog.Extensions.Hosting, Serilog.Extensions.Logging, and Serilog.Settings.Configuration
  • Loading branch information
winromulus committed Sep 16, 2023
1 parent 064e55f commit 90da0c8
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 32 deletions.
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,30 @@ $ helm upgrade --install reflector emberstack/reflector

You can customize the values of the helm deployment by using the following Values:

| Parameter | Description | Default |
| ------------------------------------ | ------------------------------------------------ | ------------------------------------------------------- |
| `nameOverride` | Overrides release name | `""` |
| `fullnameOverride` | Overrides release fullname | `""` |
| `image.repository` | Container image repository | `emberstack/kubernetes-reflector` |
| `image.tag` | Container image tag | `Same as chart version` |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `configuration.logging.minimumLevel` | Logging minimum level | `Information` |
| `configuration.watcher.timeout` | Maximum watcher lifetime in seconds | `` |
| `rbac.enabled` | Create and use RBAC resources | `true` |
| `serviceAccount.create` | Create ServiceAccount | `true` |
| `serviceAccount.name` | ServiceAccount name | _release name_ |
| `livenessProbe.initialDelaySeconds` | `livenessProbe` initial delay | `5` |
| `livenessProbe.periodSeconds` | `livenessProbe` period | `10` |
| `readinessProbe.initialDelaySeconds` | `readinessProbe` initial delay | `5` |
| `readinessProbe.periodSeconds` | `readinessProbe` period | `10` |
| `startupProbe.failureThreshold` | `startupProbe` failure threshold | `10` |
| `startupProbe.periodSeconds` | `startupProbe` period | `5` |
| `resources` | Resource limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Node affinity for pod assignment | `{}` |
| `priorityClassName` | `priorityClassName` for pods | `""` |
| Parameter | Description | Default |
| ---------------------------------------- | ------------------------------------------------ | ------------------------------------------------------- |
| `nameOverride` | Overrides release name | `""` |
| `fullnameOverride` | Overrides release fullname | `""` |
| `image.repository` | Container image repository | `emberstack/kubernetes-reflector` |
| `image.tag` | Container image tag | `Same as chart version` |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `configuration.logging.minimumLevel` | Logging minimum level | `Information` |
| `configuration.watcher.timeout` | Maximum watcher lifetime in seconds | `` |
| `configuration.kubernetes.skipTlsVerify` | Skip TLS verify when connecting the the cluster | `false` |
| `rbac.enabled` | Create and use RBAC resources | `true` |
| `serviceAccount.create` | Create ServiceAccount | `true` |
| `serviceAccount.name` | ServiceAccount name | _release name_ |
| `livenessProbe.initialDelaySeconds` | `livenessProbe` initial delay | `5` |
| `livenessProbe.periodSeconds` | `livenessProbe` period | `10` |
| `readinessProbe.initialDelaySeconds` | `readinessProbe` initial delay | `5` |
| `readinessProbe.periodSeconds` | `readinessProbe` period | `10` |
| `startupProbe.failureThreshold` | `startupProbe` failure threshold | `10` |
| `startupProbe.periodSeconds` | `startupProbe` period | `5` |
| `resources` | Resource limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Node affinity for pod assignment | `{}` |
| `priorityClassName` | `priorityClassName` for pods | `""` |

> Find us on [Artifact Hub](https://artifacthub.io/packages/helm/emberstack/reflector)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ES.Kubernetes.Reflector.Core.Configuration;

public class KubernetesOptions
{
public bool? SkipTlsVerify { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
public class ReflectorOptions
{
public WatcherOptions? Watcher { get; set; }
public KubernetesOptions? Kubernetes { get; set; }
}
14 changes: 7 additions & 7 deletions src/ES.Kubernetes.Reflector/ES.Kubernetes.Reflector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="KubernetesClient" Version="10.1.4" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="7.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
<PackageReference Include="KubernetesClient" Version="12.0.16" />
<PackageReference Include="MediatR" Version="12.1.1" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="7.0.11" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
</ItemGroup>

Expand Down
14 changes: 12 additions & 2 deletions src/ES.Kubernetes.Reflector/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ES.Kubernetes.Reflector.Core;
using ES.Kubernetes.Reflector.Core.Configuration;
using k8s;
using Microsoft.Extensions.Options;
using Serilog;

Log.Logger = new LoggerConfiguration()
Expand Down Expand Up @@ -40,18 +41,27 @@
builder.Services.AddMediatR(config => config.RegisterServicesFromAssembly(typeof(void).Assembly));
builder.Services.AddControllers();

builder.Services.AddSingleton<KubernetesClientConfiguration>(_ =>
builder.Services.Configure<ReflectorOptions>(builder.Configuration.GetSection("Reflector"));


builder.Services.AddSingleton<KubernetesClientConfiguration>(s =>
{
var reflectorOptions = s.GetRequiredService<IOptions<ReflectorOptions>>();

var config = KubernetesClientConfiguration.BuildDefaultConfig();
config.HttpClientTimeout = TimeSpan.FromMinutes(30);
if (reflectorOptions.Value.Kubernetes is not null)
{
config.SkipTlsVerify =
reflectorOptions.Value.Kubernetes.SkipTlsVerify.GetValueOrDefault(false);
}
return config;
});


builder.Services.AddSingleton<IKubernetes>(s =>
new Kubernetes(s.GetRequiredService<KubernetesClientConfiguration>()));

builder.Services.Configure<ReflectorOptions>(builder.Configuration.GetSection("Reflector"));


builder.Host.ConfigureContainer((ContainerBuilder container) =>
Expand Down
3 changes: 3 additions & 0 deletions src/ES.Kubernetes.Reflector/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"Reflector": {
"Watcher": {
"Timeout": ""
},
"Kubernetes": {
"SkipTlsVerify": false
}
}
}
2 changes: 2 additions & 0 deletions src/helm/reflector/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ spec:
value: {{ .Values.configuration.logging.minimumLevel | quote }}
- name: ES_Reflector__Watcher__Timeout
value: {{ .Values.configuration.watcher.timeout | quote }}
- name: ES_Reflector__Kubernetes__SkipTlsVerify
value: {{ .Values.configuration.kubernetes.skipTlsVerify | quote }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions src/helm/reflector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ configuration:
minimumLevel: Information
watcher:
timeout: ""
kubernetes:
skipTlsVerify: false

rbac:
enabled: true
Expand Down

0 comments on commit 90da0c8

Please sign in to comment.