fix: resolve k8s deployment issues with init containers and updated helm deps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 11:02:16 -05:00
parent f1115497c4
commit c105312178
11 changed files with 60 additions and 32 deletions

View File

@@ -0,0 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 16.4.1
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 20.6.1
digest: sha256:ea3cce1373c9e02bbea41a3403106ce1a0affa558c79fcbd8fc43a39fce078bb
generated: "2026-01-11T10:55:33.886923107-05:00"

View File

@@ -7,10 +7,10 @@ appVersion: "1.0.0"
dependencies:
- name: postgresql
version: "14.0.0"
version: "16.4.1"
repository: "https://charts.bitnami.com/bitnami"
condition: postgresql.enabled
- name: redis
version: "18.0.0"
version: "20.6.1"
repository: "https://charts.bitnami.com/bitnami"
condition: redis.enabled

View File

@@ -52,7 +52,7 @@ app.kubernetes.io/instance: {{ .Release.Name }}
PostgreSQL connection string
*/}}
{{- define "incidentops.postgresConnectionString" -}}
Host={{ .Release.Name }}-postgresql;Port=5432;Database={{ .Values.postgresql.auth.database }};Username={{ .Values.postgresql.auth.username }};Password={{ .Values.postgresql.auth.password }}
Host={{ .Release.Name }}-postgresql;Port=5432;Database={{ .Values.postgresql.auth.database }};Username={{ .Values.postgresql.auth.username }};Password={{ .Values.postgresql.auth.password }};Pooling=true;MinPoolSize=1;MaxPoolSize=20
{{- end }}
{{/*

View File

@@ -17,6 +17,13 @@ spec:
{{- include "incidentops.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: api
spec:
initContainers:
- name: wait-for-postgres
image: busybox:1.36
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-postgresql 5432; do echo "Waiting for PostgreSQL..."; sleep 2; done; echo "PostgreSQL is ready!"']
- name: wait-for-redis
image: busybox:1.36
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-redis-master 6379; do echo "Waiting for Redis..."; sleep 2; done; echo "Redis is ready!"']
containers:
- name: api
image: "{{ .Values.api.image }}:{{ .Values.api.tag }}"
@@ -49,13 +56,13 @@ spec:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 10
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /readyz
port: http
initialDelaySeconds: 5
initialDelaySeconds: 10
periodSeconds: 5
resources:
{{- toYaml .Values.api.resources | nindent 12 }}

View File

@@ -17,6 +17,13 @@ spec:
{{- include "incidentops.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: worker
spec:
initContainers:
- name: wait-for-postgres
image: busybox:1.36
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-postgresql 5432; do echo "Waiting for PostgreSQL..."; sleep 2; done; echo "PostgreSQL is ready!"']
- name: wait-for-redis
image: busybox:1.36
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-redis-master 6379; do echo "Waiting for Redis..."; sleep 2; done; echo "Redis is ready!"']
containers:
- name: worker
image: "{{ .Values.worker.image }}:{{ .Values.worker.tag }}"

View File

@@ -52,21 +52,26 @@ ingress:
postgresql:
enabled: true
image:
tag: latest
pullPolicy: IfNotPresent
auth:
username: postgres
password: postgres
username: incidentops
password: incidentops
database: incidentops
postgresPassword: postgres
primary:
persistence:
enabled: true
size: 1Gi
enabled: false
redis:
enabled: true
image:
tag: latest
pullPolicy: IfNotPresent
architecture: standalone
auth:
enabled: false
master:
persistence:
enabled: true
size: 1Gi
enabled: false

View File

@@ -11,7 +11,7 @@ RUN dotnet restore src/IncidentOps.Api/IncidentOps.Api.csproj
# Copy source and build
COPY src/ src/
WORKDIR /src/src/IncidentOps.Api
RUN dotnet publish -c Release -o /app --no-restore
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app

View File

@@ -14,7 +14,7 @@
<PackageReference Include="Hangfire.Core" Version="1.8.22" />
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
<PackageReference Include="Npgsql" Version="10.0.1" />
<PackageReference Include="StackExchange.Redis" Version="2.10.1" />
</ItemGroup>

View File

@@ -11,7 +11,7 @@ RUN dotnet restore src/IncidentOps.Worker/IncidentOps.Worker.csproj
# Copy source and build
COPY src/ src/
WORKDIR /src/src/IncidentOps.Worker
RUN dotnet publish -c Release -o /app --no-restore
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app

View File

@@ -1,31 +1,31 @@
FROM node:20-alpine AS deps
FROM oven/bun:latest AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY package.json bun.lock* ./
RUN bun install --frozen-lockfile 2>/dev/null || bun install
FROM node:20-alpine AS builder
FROM oven/bun:latest AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build
FROM node:20-alpine AS runner
# Ensure public folder exists for the build
RUN mkdir -p public
ENV NEXT_TELEMETRY_DISABLED=1
RUN bun run build
FROM oven/bun:latest AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]
CMD ["bun", "server.js"]

0
web/public/.gitkeep Normal file
View File