chore: pending worktree changes (k8s probe, profile loader, e2e Makefile)

- k8s/deployment.yaml: bump startup-probe failureThreshold from 12 to 24
  (70s -> 130s max startup time) to give the app more headroom on cold start.
- lib/towerops/profiles/yaml_profiles.ex: defer YAML profile loading from
  init/1 to a handle_info(:load_profiles, ...) so the supervisor (and Bandit)
  come up immediately and the profiles populate in the background within ~60s.
- e2e/Makefile: convenience target wrappers around the existing npm scripts.
This commit is contained in:
Graham McIntire 2026-04-28 12:39:26 -05:00
parent a91c00f3cf
commit e4686f31ce
3 changed files with 33 additions and 8 deletions

24
e2e/Makefile Normal file
View file

@ -0,0 +1,24 @@
.PHONY: all test local staging ui headed debug report
all: test
test:
npm test
local:
npm run test:local
staging:
npm run test:staging
ui:
npm run test:ui
headed:
npm run test:headed
debug:
npm run test:debug
report:
npm run report

View file

@ -215,7 +215,7 @@ spec:
initialDelaySeconds: 10
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 12 # 10s + (12 * 5s) = 70s max startup time
failureThreshold: 24 # 10s + (24 * 5s) = 130s max startup time
livenessProbe:
httpGet:
path: /health

View file

@ -87,18 +87,19 @@ defmodule Towerops.Profiles.YamlProfiles do
@impl true
def init(_opts) do
# Create ETS table for profiles
_ = :ets.new(@table, [:named_table, :set, :public, read_concurrency: true])
# Defer loading so the supervisor (and Bandit) start immediately.
# Profiles will be available within ~60s; SNMP polling starts well after that.
send(self(), :load_profiles)
{:ok, %{}}
end
# Load profiles and collect raw YAML data
@impl true
def handle_info(:load_profiles, state) do
raw_profiles = load_all_profiles()
# Extract MIB names and trigger asynchronous pre-resolution in MibCache
# This doesn't block - MibCache will resolve in the background
mib_names = extract_mib_names_from_profiles(raw_profiles)
MibCache.pre_resolve(mib_names)
{:ok, %{}}
{:noreply, state}
end
@impl true