prop/k8s/deployment.yaml
Graham McIntire 55251df8a0
feat(elixir): OpenTelemetry trace export to cluster OTel Collector
Adds the OTel deps (opentelemetry + exporter + phoenix / ecto / oban /
bandit auto-instrumentation helpers) and attaches them in
Application.start/2 so the existing Phoenix, Ecto, Oban, and Bandit
telemetry events flow as OTLP spans without any call-site changes.

Exporter config is gated on OTEL_EXPORTER_OTLP_ENDPOINT in
config/runtime.exs — set in the k8s manifests to the cluster
collector (otel-collector.observability.svc.cluster.local:4317).
When unset we switch traces_exporter to :none so nothing is shipped;
dev/test stays quiet.

Resource attributes tag spans with service.name=microwaveprop and
service.namespace=prop, matching the Rust workers' attribute shape
so Tempo can group the full hourly chain across both languages.

Both the main prop deployment and the backfill deployment get the
env; backfill is still a full BEAM node running enrichment workers,
so its Oban/Ecto spans are worth seeing too.
2026-04-20 12:02:15 -05:00

122 lines
3.5 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: prop
namespace: prop
spec:
replicas: 4
minReadySeconds: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: prop
template:
metadata:
labels:
# `tier: hot` distinguishes these pods from prop-backfill (same
# app: prop label) so the Service selector can exclude backfill
# from its endpoint pool — backfill runs PHX_SERVER=false and
# doesn't listen on :5000.
app: prop
tier: hot
spec:
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: prop
topologyKey: topology.kubernetes.io/physical-host
serviceAccountName: prop
imagePullSecrets:
- name: forgejo-registry
securityContext:
runAsUser: 65534
runAsNonRoot: true
fsGroup: 65534
seccompProfile:
type: RuntimeDefault
containers:
- name: prop
image: git.mcintire.me/graham/prop:main-1776694898-8089a16 # {"$imagepolicy": "flux-system:prop"}
imagePullPolicy: IfNotPresent
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: PHX_SERVER
value: "true"
- name: PHX_HOST
value: "prop.w5isp.com"
- name: PORT
value: "5000"
- name: HRRR_BASE_URL
value: "http://skippy.w5isp.com:8080"
# Elixir OTLP/gRPC trace export to the cluster OTel
# Collector. See vntx-infra/observability/ and
# config/runtime.exs for wiring. Unset disables exports.
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: "http://otel-collector.observability.svc.cluster.local:4317"
envFrom:
- secretRef:
name: prop-secrets
ports:
- name: http
containerPort: 5000
protocol: TCP
startupProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 5
periodSeconds: 3
failureThreshold: 10
timeoutSeconds: 3
readinessProbe:
httpGet:
path: /health
port: 5000
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 2
timeoutSeconds: 2
livenessProbe:
httpGet:
path: /health
port: 5000
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 3
resources:
requests:
cpu: 100m
memory: 512Mi
limits:
cpu: "2"
memory: 6Gi
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 65534
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
volumeMounts:
- name: data
mountPath: /data
volumes:
- name: data
nfs:
server: 10.0.15.103
path: /data