Skip to content

Commit

Permalink
configmap: register map
Browse files Browse the repository at this point in the history
To always guarantee the initialization of the config bpf map
before the bpf loader, with this commit, the auth map gets
registered in the map registry.

Signed-off-by: Marco Hofstetter <marco.hofstetter@isovalent.com>
  • Loading branch information
mhofstetter authored and michi-covalent committed Apr 25, 2023
1 parent 4d02add commit a194628
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
4 changes: 0 additions & 4 deletions pkg/datapath/cells.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/cilium/cilium/pkg/hive/cell"
ipcache "github.com/cilium/cilium/pkg/ipcache/types"
"github.com/cilium/cilium/pkg/maps"
"github.com/cilium/cilium/pkg/maps/configmap"
"github.com/cilium/cilium/pkg/option"
wg "github.com/cilium/cilium/pkg/wireguard/agent"
wgTypes "github.com/cilium/cilium/pkg/wireguard/types"
Expand All @@ -33,9 +32,6 @@ var Cell = cell.Module(
// Provides all BPF Map which are already provided by via hive cell.
maps.Cell,

// ConfigMap stores runtime configuration state for the Cilium datapath.
configmap.Cell,

// Utime synchronizes utime from userspace to datapath via configmap.Map.
utime.Cell,

Expand Down
4 changes: 4 additions & 0 deletions pkg/maps/cells.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package maps
import (
"github.com/cilium/cilium/pkg/hive/cell"
"github.com/cilium/cilium/pkg/maps/authmap"
"github.com/cilium/cilium/pkg/maps/configmap"
)

// Cell contains all cells which are providing BPF Maps.
Expand All @@ -15,4 +16,7 @@ var Cell = cell.Module(

// Provides the auth.Map which contains the authentication state between Cilium security identities.
authmap.Cell,

// ConfigMap stores runtime configuration state for the Cilium datapath.
configmap.Cell,
)
16 changes: 13 additions & 3 deletions pkg/maps/configmap/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package configmap

import (
"github.com/cilium/cilium/pkg/bpf"
"github.com/cilium/cilium/pkg/hive"
"github.com/cilium/cilium/pkg/hive/cell"
)
Expand All @@ -14,10 +15,9 @@ var Cell = cell.Module(
"eBPF map config contains runtime configuration state for the Cilium datapath",

cell.Provide(newMap),
cell.Invoke(func(Map) {}),
)

func newMap(lifecycle hive.Lifecycle) Map {
func newMap(lifecycle hive.Lifecycle) MapOut {
configmap := newConfigMap()

lifecycle.Append(hive.Hook{
Expand All @@ -29,5 +29,15 @@ func newMap(lifecycle hive.Lifecycle) Map {
},
})

return configmap
return MapOut{
ConfigMap: configmap,
BpfMap: configmap,
}
}

type MapOut struct {
cell.Out

ConfigMap Map
BpfMap bpf.BpfMap `group:"bpf-maps"`
}

0 comments on commit a194628

Please sign in to comment.