github.com/cilium/cilium@v1.16.2/pkg/maps/configmap/cell.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package configmap
     5  
     6  import (
     7  	"github.com/cilium/hive/cell"
     8  
     9  	"github.com/cilium/cilium/pkg/bpf"
    10  )
    11  
    12  // Cell initializes and manages the config map.
    13  var Cell = cell.Module(
    14  	"config-map",
    15  	"eBPF map config contains runtime configuration state for the Cilium datapath",
    16  
    17  	cell.Provide(newMap),
    18  )
    19  
    20  func newMap(lifecycle cell.Lifecycle) bpf.MapOut[Map] {
    21  	configmap := newConfigMap()
    22  
    23  	lifecycle.Append(cell.Hook{
    24  		OnStart: func(startCtx cell.HookContext) error {
    25  			return configmap.init()
    26  		},
    27  		OnStop: func(stopCtx cell.HookContext) error {
    28  			return configmap.close()
    29  		},
    30  	})
    31  
    32  	return bpf.NewMapOut(Map(configmap))
    33  }