github.com/cilium/cilium@v1.16.2/clustermesh-apiserver/clustermesh/cells.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright Authors of Cilium 3 4 package clustermesh 5 6 import ( 7 "github.com/cilium/hive/cell" 8 9 cmk8s "github.com/cilium/cilium/clustermesh-apiserver/clustermesh/k8s" 10 "github.com/cilium/cilium/clustermesh-apiserver/health" 11 cmmetrics "github.com/cilium/cilium/clustermesh-apiserver/metrics" 12 "github.com/cilium/cilium/clustermesh-apiserver/option" 13 "github.com/cilium/cilium/clustermesh-apiserver/syncstate" 14 cmtypes "github.com/cilium/cilium/pkg/clustermesh/types" 15 "github.com/cilium/cilium/pkg/controller" 16 "github.com/cilium/cilium/pkg/defaults" 17 "github.com/cilium/cilium/pkg/gops" 18 k8sClient "github.com/cilium/cilium/pkg/k8s/client" 19 "github.com/cilium/cilium/pkg/k8s/synced" 20 "github.com/cilium/cilium/pkg/kvstore" 21 "github.com/cilium/cilium/pkg/kvstore/heartbeat" 22 "github.com/cilium/cilium/pkg/kvstore/store" 23 "github.com/cilium/cilium/pkg/pprof" 24 ) 25 26 var Cell = cell.Module( 27 "clustermesh", 28 "Cilium ClusterMesh", 29 30 cell.Config(option.DefaultLegacyClusterMeshConfig), 31 32 // We don't validate that the ClusterID is different from 0 (and the 33 // ClusterName is not the default one), because they are valid in 34 // case we only use the external workloads feature, and not clustermesh. 35 cell.Config(cmtypes.DefaultClusterInfo), 36 cell.Invoke(cmtypes.ClusterInfo.InitClusterIDMax), 37 cell.Invoke(cmtypes.ClusterInfo.Validate), 38 39 pprof.Cell, 40 cell.Config(pprof.Config{ 41 PprofAddress: option.PprofAddress, 42 PprofPort: option.PprofPortClusterMesh, 43 }), 44 controller.Cell, 45 46 gops.Cell(defaults.GopsPortApiserver), 47 48 k8sClient.Cell, 49 cmk8s.ResourcesCell, 50 51 kvstore.Cell(kvstore.EtcdBackendName), 52 cell.Provide(func(ss syncstate.SyncState) *kvstore.ExtraOptions { 53 return &kvstore.ExtraOptions{ 54 BootstrapComplete: ss.WaitChannel(), 55 } 56 }), 57 store.Cell, 58 59 // Shared synchronization structures for waiting on K8s resources to 60 // be synced 61 synced.Cell, 62 63 // Provide CRD resource names for 'synced.CRDSyncCell' below. 64 cell.Provide(func() synced.CRDSyncResourceNames { return synced.ClusterMeshAPIServerResourceNames() }), 65 66 // CRDSyncCell provides a promise that is resolved as soon as CRDs used by the 67 // clustermesh-apiserver have synced. 68 // Allows cells to wait for CRDs before trying to list Cilium resources. 69 synced.CRDSyncCell, 70 71 heartbeat.Cell, 72 HealthAPIEndpointsCell, 73 health.HealthAPIServerCell, 74 75 cmmetrics.Cell, 76 77 usersManagementCell, 78 cell.Invoke(registerHooks), 79 externalWorkloadsCell, 80 )