Skip to content

deps: bump cilium to v1.20.0 and migrate relocated internal APIs - #2628

Open
Quang Nguyen (nddq) wants to merge 1 commit into
mainfrom
deps/cilium-1.20
Open

deps: bump cilium to v1.20.0 and migrate relocated internal APIs#2628
Quang Nguyen (nddq) wants to merge 1 commit into
mainfrom
deps/cilium-1.20

Conversation

@nddq

Copy link
Copy Markdown
Member

Description

Bumps github.com/cilium/cilium v1.19.3v1.20.0, which transitively pulls k8s.io/* 0.36.3, controller-runtime 0.24.1, cilium/ebpf 0.22.0, cilium/statedb 0.8.3, and cilium/hive v1.0.4. Retina embeds part of Cilium's Hive graph for Hubble flow enrichment, and v1.20 repurposed pkg/datapath/types into generated BPF bindings, so the bump needs code changes:

  • API moves: datapath.NodeHandlernode.Handler, datapath.IptablesManageriptables.Manager, the datapath config interfaces → per-subsystem types.Config, pkg/datapath/fake/types → per-subsystem fake packages, daemonk8s table cells → pkg/k8s/tables.
  • Nil dereference fix: v1.20's CiliumSlimEndpointResource reads the previously-ignored *node.LocalNodeStore param in a new indexer, so the nil Retina passed panics the informer on the first CiliumEndpoint. Pass the real store, plus the Logger and MetricsProvider fields that were also unset.
  • Node handler registry: v1.20's hubble peer service subscribes one handler per gRPC Notify stream, making two defects reachable: Subscribe wrote the handlers map under RLock (concurrent streams crash the agent), and keying by Name() — constant "hubble-peer" for every peer handler — let a second stream evict the first. Key by handler identity under an exclusive lock, matching upstream.
  • Operator: provide the ztunnel.Config that auth.Cell now requires (disabled default); drop the SharedConfig providers for flags the metrics and endpoint-GC cells now own via cell.Config, and the then-unconsumed *operatorOption.OperatorConfig provider; declare the leader-election flags locally (same names and defaults) since operator/option stopped exporting them; align WithLeaderLifecycle and registerOperatorHooks ordering with upstream v1.20.
  • Stub cleanup: v1.20 rewrote the watcher constructors to depend on narrow types instead of the agentK8s.Resources bundle, leaving 12 of Retina's 20 no-op providers and all of NoOpPolicyRepository unreachable. Removed — net -86 lines of non-test code.
  • CRDs: regenerated with controller-gen v0.20.1; annotation bump only, no schema change.

Related Issue

N/A.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

go test -tags=unit,dashboard -skip=TestE2E* ./...        # all packages ok
go build ./...                                           # linux + windows + strict -mod
CGO_ENABLED=1 go test -tags=unit -race -count=5 \
    -run TestSubscribeConcurrentSameNameHandlers ./pkg/controllers/daemon/nodereconciler

New TestAgentHiveResolves / TestOperatorHiveResolves resolve both hives at test time, so a Cilium bump that adds a required provider fails in CI instead of crash-looping on a cluster (the auth.Cell change in this bump is exactly that class). The race test fails with DATA RACE when the Subscribe fix is reverted.

Deployed to a 2-node AKS cluster (k8s 1.35.6): zero restarts across agent, operator, and relay; flows enrich with pod identity and L7 DNS; eBPF plugins load under ebpf v0.22.0 with all metric families exporting. The handler-registry fixes were exercised directly — two relay replicas hold concurrent peer streams and both receive both peers, killing one relay leaves the survivor serving flows from both nodes, and three relay restart cycles plus an agent-pod kill produce no restarts or concurrent map errors.

Upgrade path: installed released retina-hubble v1.2.3 (pins cilium v1.19.3), then helm upgraded to these images. Rollout clean, and the Cilium CRD specs hash identically before and after, so v1.20 accepts CRDs a v1.19 operator created. Also validated with hubble.tls.enabled=true.

Additional Notes

N/A.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Retina Code Coverage Report

Total coverage increased from 36.5% to 36.7%

Increased diff

Impacted Files Coverage
operator/cmd/cilium-crds/zap_linux.go 0.0% ... 100.0% (100.0%) ⬆️
cmd/hubble/daemon_main_linux.go 0.0% ... 3.7% (3.7%) ⬆️
operator/cmd/cilium-crds/lifecycle.go 0.0% ... 100.0% (100.0%) ⬆️
pkg/controllers/daemon/nodereconciler/node_controller_linux.go 0.0% ... 12.5% (12.5%) ⬆️
operator/cmd/cilium-crds/root_linux.go 0.0% ... 5.04% (5.04%) ⬆️

Decreased diff

Impacted Files Coverage
pkg/controllers/operator/retinaendpoint/retinaendpoint_controller.go 83.28% ... 82.25% (-1.03%) ⬇️

@nddq
Quang Nguyen (nddq) marked this pull request as ready for review August 7, 2026 20:55
@nddq
Quang Nguyen (nddq) requested a review from a team as a code owner August 7, 2026 20:55
@nddq
Quang Nguyen (nddq) force-pushed the deps/cilium-1.20 branch 2 times, most recently from 4260814 to 9a60559 Compare August 7, 2026 21:23
Cilium v1.20 repurposed pkg/datapath/types into generated BPF C bindings
and moved every Go interface it held into per-subsystem packages, so this
bump needs code changes rather than a go.mod edit alone. It also pulls
k8s.io/* 0.35.x -> 0.36.3, controller-runtime 0.23.3 -> 0.24.1,
cilium/ebpf 0.21.0 -> 0.22.0, cilium/statedb 0.5.6 -> 0.8.3,
cilium/hive -> v1.0.4, and controller-tools 0.19.0 -> 0.20.1.

Track the moved APIs: datapath.NodeHandler -> node.Handler,
datapath.IptablesManager -> iptables.Manager, datapath.IPsecConfig ->
ipsectypes.Config, wgtypes.WireguardConfig -> wgtypes.Config, and
daemonk8s.PodTableCell/NamespaceTableCell -> pkg/k8s/tables. The
monolithic pkg/datapath/fake/types split into per-subsystem fake
packages. PolicyRepository swapped GetSelectorPolicy for
ComputeSelectorPolicy, and LocalNodeSynchronizer gained
WaitForNodeInformation.

CiliumSlimEndpointResource's second parameter was an ignored
_ *node.LocalNodeStore in v1.19, so Retina passed nil. v1.20 added a
localNode indexer that reads it on every CiliumEndpoint add, which panics
the informer and crash-loops the agent. Pass the real store, plus the
Logger and MetricsProvider fields that were also left nil.

Fix two defects in the node handler registry that v1.20's hubble peer
service makes reachable (it subscribes one handler per gRPC Notify
stream): Subscribe wrote the handlers map under RLock, so two concurrent
peer streams crash the agent with concurrent map writes; and the map was
keyed by Name(), which every peer handler reports as the constant
"hubble-peer", so a second stream evicted the first and the departing
stream's Unsubscribe deafened the survivor. Key the set by handler
identity, matching upstream's nodeManager, and lock exclusively. A
regression test covers both under -race.

On the operator, auth.Cell gained a ztunnel.Config dependency that fails
DI resolution at startup, so provide DefaultConfig with ztunnel disabled.
operatorMetrics.SharedConfig and endpointgc.SharedConfig.Interval are
gone because those cells now own --enable-metrics and
--cilium-endpoint-gc-interval through cell.Config, so drop the duplicate
registrations. Leader-election flag names and config fields are no longer
exported from operator/option; declare them locally under the same names
and defaults so existing operator configuration keeps working. With those
readers gone nothing consumes *operatorOption.OperatorConfig, so drop its
provider and Populate call. Align the WithLeaderLifecycle copy with
upstream v1.20 by also decorating job.Registry, so leader-scoped cells
that adopt job.Group attach jobs to the post-election lifecycle, and move
the registerOperatorHooks invoke to the end of the module per upstream's
ordering requirement.

v1.19's watcher constructors took an agentK8s.Resources bundle struct,
which forced every field in it to be resolvable and is why Retina carried
20 no-op DI providers. v1.20 rewrote those constructors to depend on
narrow types, leaving 12 of the providers and all of NoOpPolicyRepository
unreachable. Remove them, and add tests that resolve both the agent and
operator hives so a newly required provider fails in CI rather than on a
cluster.

Regenerate the CRDs with controller-gen v0.20.1: an annotation bump on
all four and one property reorder in retina.sh_captures.yaml, no schema
change.

Signed-off-by: Quang Nguyen <28567936+nddq@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant