Skip to content

Open or create all maps from cilium-agent #9276

@joestringer

Description

@joestringer

Currently (early v1.7 cycle), some of the global maps used by multiple BPF programs are opened/created from cilium-agent in the function below:

cilium/daemon/datapath.go

Lines 530 to 533 in d0f2435

// initMaps opens all BPF maps (and creates them if they do not exist). This
// must be done *before* any operations which read BPF maps, especially
// restoring endpoints and services.
func (d *Daemon) initMaps() error {

But others (such as conntrack, or the global tail call map) are not.

Note that we must make sure that if any map is being created, its attributes must match the attributes defined in the C templates, otherwise when we load a program for an endpoint the first time, it will delete/recreate the map.

Tasks:

  • Gather a list of globally shared maps that are not opened/created in the daemon (see pkg/maps/ and bpf/)
  • Make sure that the map attributes are guaranteed to be in sync for those map types between the BPF C definitions and the Golang definitions
  • Add OpenOrCreate() calls for all maps to initMaps() so we can be sure that the globally shared maps are guaranteed to be in place before the first BPF program load
    • Some maps, such as the tail call maps, are never used from the cilium-agent. These should be created, and pinned to the filesystem, then the fd closed.

Metadata

Metadata

Assignees

Labels

area/daemonImpacts operation of the Cilium daemon.area/datapathImpacts bpf/ or low-level forwarding details, including map management and monitor messages.good-first-issueGood starting point for new developers, which requires minimal understanding of Cilium.kind/cleanupThis includes no functional changes.pinnedThese issues are not marked stale by our issue bot.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions