feat(adapter): replace kubelet HTTP polling with SharedIndexInformer#110
Conversation
SharedIndexInformer Closes optiqor#19 - Use SharedInformerFactory scoped to local node via spec.nodeName field selector - In-cluster service account auth by default, kubeconfig fallback for dev - Index pods by UID variants and container ID (full + 12-char prefix) for O(1) lookups - Exponential backoff retry (1s→2min); stale index preserved during reconnect - Remove all kubelet HTTP polling code paths entirely - Add 1000-pod fixture: correctness + p99 < 10µs latency assertions - Trim ClusterRole to pods get/list/watch only - Inject NODE_NAME via Downward API in DaemonSet Signed-off-by: Heidi Ho <honhuhuynh1210@gmail.com>
|
🚀 First PR — welcome aboard! A few things to expect:
If you get stuck, reply here or jump to Discussions. We want this PR to land. |
|
@huynna12 lints are failing.. |
btwshivam
left a comment
There was a problem hiding this comment.
ci's red from the go.mod bump to 1.26.0 (ci runs 1.25), and the title scope adapter/k8s isn't allowed (use feat(adapter): or feat(k8s):). fix both and it's close, the informer locking and cache-sync look right.
| module github.com/optiqor/kerno | ||
|
|
||
| go 1.25.4 | ||
| go 1.26.0 |
There was a problem hiding this comment.
this bumps the go directive to 1.26.0, but ci runs 1.25.x, so go test dies with go.mod requires go >= 1.26.0 (running go 1.25.10) and golangci-lint fails because it's built with go1.25 and can't target 1.26.0. that's both red checks. looks like an accidental bump from go mod tidy on a 1.26 toolchain. set it back to go 1.25.4.
| hostPort: {{ .Values.prometheus.port }} | ||
| protocol: TCP | ||
| env: | ||
| - name: NODE_NAME |
There was a problem hiding this comment.
this duplicates KERNO_NODE_NAME four lines down, both injected from spec.nodeName. the adapter already falls back to KERNO_NODE_NAME (kubernetes.go:63-66), so NODE_NAME is redundant and it breaks the KERNO_ env convention the rest of the daemonset uses. drop it and rely on KERNO_NODE_NAME.
|
rest eveything looks good.. well done.. fix them.. then we can merge!! |
Signed-off-by: Heidi Ho <honhuhuynh1210@gmail.com>
Signed-off-by: Heidi Ho <honhuhuynh1210@gmail.com>
I fixed it all. Please check it again and let me know if there are things else that I need to change/fix. Thank you. |
|
@huynna12 I can still see conflicts.. fix it please |
|
@btwshivam there is no conflict now |
What
Replaces the periodic kubelet HTTP polling in internal/adapter/kubernetes.go
with a SharedIndexInformer scoped to the local node, giving instant pod
visibility and eliminating kubelet read-only API dependency.
Why
Fixes #19
How
nodeName)
lookups
prefix)
enrichment continues degraded
dev
Testing
go build ./...passesgo test ./...passesgo vet ./...passesgolangci-lint run ./...passessudo ./bin/bpf-verify --read 5sconfirms 6/6 programs still load./scripts/verify.shpasses (or specific phase:./scripts/verify.sh quality)Checklist
feat(scope): subject)git commit -s)scripts/verify.sh