Revision f8e61f3c740c4d90783cde7954487b89cee0458f authored by Martynas Pumputis on 30 November 2023, 16:27:08 UTC, committed by André Martins on 05 December 2023, 15:46:22 UTC
Signed-off-by: Martynas Pumputis <m@lambda.lt>
1 parent 29515a7
Raw File
cells.go
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

package clustermesh

import (
	cmk8s "github.com/cilium/cilium/clustermesh-apiserver/clustermesh/k8s"
	cmmetrics "github.com/cilium/cilium/clustermesh-apiserver/metrics"
	"github.com/cilium/cilium/clustermesh-apiserver/option"
	cmtypes "github.com/cilium/cilium/pkg/clustermesh/types"
	"github.com/cilium/cilium/pkg/controller"
	"github.com/cilium/cilium/pkg/defaults"
	"github.com/cilium/cilium/pkg/gops"
	"github.com/cilium/cilium/pkg/hive/cell"
	k8sClient "github.com/cilium/cilium/pkg/k8s/client"
	"github.com/cilium/cilium/pkg/kvstore"
	"github.com/cilium/cilium/pkg/kvstore/heartbeat"
	"github.com/cilium/cilium/pkg/kvstore/store"
	"github.com/cilium/cilium/pkg/pprof"
)

var Cell = cell.Module(
	"clustermesh",
	"Cilium ClusterMesh",

	cell.Config(option.DefaultLegacyClusterMeshConfig),

	// We don't validate that the ClusterID is different from 0 (and the
	// ClusterName is not the default one), because they are valid in
	// case we only use the external workloads feature, and not clustermesh.
	cell.Config(cmtypes.DefaultClusterInfo),
	cell.Invoke(func(cinfo cmtypes.ClusterInfo) error { return cinfo.InitClusterIDMax() }),
	cell.Invoke(func(cinfo cmtypes.ClusterInfo) error { return cinfo.Validate() }),

	pprof.Cell,
	cell.Config(pprof.Config{
		PprofAddress: option.PprofAddress,
		PprofPort:    option.PprofPortClusterMesh,
	}),
	controller.Cell,

	gops.Cell(defaults.GopsPortApiserver),

	k8sClient.Cell,
	cmk8s.ResourcesCell,

	kvstore.Cell(kvstore.EtcdBackendName),
	cell.Provide(func() *kvstore.ExtraOptions { return nil }),
	store.Cell,

	heartbeat.Cell,
	healthAPIServerCell,

	cmmetrics.Cell,

	usersManagementCell,
	cell.Invoke(registerHooks),
	externalWorkloadsCell,
)
back to top