Skip to content

Commit abc2ad5

Browse files
committed
feat(kubernetes): enhance configuration and health checks
- Added support for environment variables prefixed with "ES_". - Updated ReflectorOptions configuration to use nameof for better maintainability. - Changed the container port from 25080 to 8080 in deployment.yaml. - Modified liveness and readiness probes to point to new health check paths. - Introduced a new Kubernetes setting for skipping TLS verification. BREAKING CHANGE: Health check endpoints have been updated.
1 parent 27c07fa commit abc2ad5

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

src/ES.Kubernetes.Reflector/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
{
1313
var builder = WebApplication.CreateBuilder(args);
1414
builder.Logging.ClearProviders();
15+
16+
builder.Configuration.AddEnvironmentVariables("ES_");
17+
1518
builder.Ignite();
1619
builder.IgniteSerilog();
1720
builder.IgniteSeqOpenTelemetryExporter();
1821
builder.Services.AddMediatR(config =>
1922
config.RegisterServicesFromAssembly(typeof(Program).Assembly));
2023

21-
builder.Services.Configure<ReflectorOptions>(builder.Configuration.GetSection("Reflector"));
24+
builder.Services.Configure<ReflectorOptions>(builder.Configuration.GetSection(nameof(ES.Kubernetes.Reflector)));
2225

2326
builder.Services.AddTransient(s =>
2427
{
@@ -45,7 +48,6 @@
4548

4649
var app = builder.Build();
4750
app.Ignite();
48-
4951
await app.RunAsync();
5052
return 0;
5153
});

src/ES.Kubernetes.Reflector/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"commandName": "Project",
55
"launchBrowser": false,
66
"environmentVariables": {
7-
"ES_ENVIRONMENT": "Development"
7+
"ASPNETCORE_ENVIRONMENT": "Development"
88
},
99
"applicationUrl": "http://0.0.0.0:8080",
1010
"dotnetRunMessages": false

src/helm/reflector/templates/cron.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ spec:
6868
value: {{ .Values.configuration.logging.minimumLevel | quote }}
6969
- name: ES_Reflector__Watcher__Timeout
7070
value: {{ .Values.configuration.watcher.timeout | quote }}
71+
- name: ES_Reflector__Kubernetes__SkipTlsVerify
72+
value: {{ .Values.configuration.kubernetes.skipTlsVerify | quote }}
73+
{{- with .Values.extraEnv }}
74+
{{- toYaml . | nindent 12 }}
75+
{{- end }}
7176
resources:
7277
{{- toYaml .Values.resources | nindent 16 }}
7378
{{- end }}

src/helm/reflector/templates/deployment.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,15 @@ spec:
5757

5858
ports:
5959
- name: http
60-
containerPort: 25080
60+
containerPort: 8080
6161
protocol: TCP
6262
livenessProbe:
63-
{{- toYaml .Values.healthcheck | nindent 12 }}
64-
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
65-
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
63+
{{- toYaml .Values.livenessProbe | nindent 12 }}
6664
readinessProbe:
67-
{{- toYaml .Values.healthcheck | nindent 12 }}
68-
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
69-
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
65+
{{- toYaml .Values.readinessProbe | nindent 12 }}
7066
{{- if semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version }}
7167
startupProbe:
72-
{{- toYaml .Values.healthcheck | nindent 12 }}
73-
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
74-
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
68+
{{- toYaml .Values.startupProbe | nindent 12 }}
7569
{{- end }}
7670
resources:
7771
{{- toYaml .Values.resources | nindent 12 }}

src/helm/reflector/values.yaml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,31 @@ securityContext:
6060
runAsNonRoot: true
6161
runAsUser: 1000
6262

63-
healthcheck:
63+
livenessProbe:
6464
httpGet:
65-
path: /healthz
65+
path: /health/live
6666
port: http
67-
68-
livenessProbe:
67+
timeoutSeconds: 10
6968
initialDelaySeconds: 5
7069
periodSeconds: 10
70+
failureThreshold: 5
7171
readinessProbe:
72+
httpGet:
73+
path: /health/ready
74+
port: http
75+
timeoutSeconds: 10
7276
initialDelaySeconds: 5
7377
periodSeconds: 10
78+
failureThreshold: 5
7479
startupProbe:
75-
# The application will have a maximum of 50s (10 * 5 = 50s) to finish its startup.
76-
failureThreshold: 10
77-
periodSeconds: 5
80+
httpGet:
81+
path: /health/ready
82+
port: http
83+
timeoutSeconds: 10
84+
initialDelaySeconds: 5
85+
periodSeconds: 10
86+
failureThreshold: 5
87+
7888

7989
resources:
8090
{}

0 commit comments

Comments
 (0)