ciliumcrds

package
v0.0.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2025 License: MIT, Apache-2.0 Imports: 50 Imported by: 1

Documentation

Index

Constants

View Source
const RetinaOperatorMetricsNamespace = "networkobservability_operator"

Variables

View Source
var (
	Operator = cell.Module(
		"operator",
		"Retina Operator",

		cell.Invoke(func(l logrus.FieldLogger) {

			l.Info("starting hive. Some logs will say 'cilium' since some code is derived from cilium")
		}),
		Infrastructure,
		ControlPlane,
	)

	Infrastructure = cell.Module(
		"operator-infra",
		"Operator Infrastructure",

		config.Cell,

		cell.Invoke(setupZapHook),

		cell.Provide(func(cfg config.Config) telemetry.Config {
			return telemetry.Config{
				Component:             "retina-operator",
				EnableTelemetry:       cfg.EnableTelemetry,
				ApplicationInsightsID: buildinfo.ApplicationInsightsID,
				RetinaVersion:         buildinfo.Version,
			}
		}),
		telemetry.Constructor,

		pprof.Cell,
		cell.Config(pprof.Config{
			Pprof:        true,
			PprofAddress: option.PprofAddressAgent,
			PprofPort:    option.PprofPortAgent,
		}),

		k8sClient.Cell,

		operatorMetrics.Cell,
		cell.Provide(func(
			operatorCfg *operatorOption.OperatorConfig,
		) operatorMetrics.SharedConfig {
			return operatorMetrics.SharedConfig{

				EnableMetrics:    operatorCfg.EnableMetrics,
				EnableGatewayAPI: operatorCfg.EnableGatewayAPI,
			}
		}),
		cell.Provide(func() *k8sruntime.Scheme {
			scheme := k8sruntime.NewScheme()

			utilruntime.Must(clientgoscheme.AddToScheme(scheme))

			return scheme
		}),
	)

	// ControlPlane implements the control functions.
	ControlPlane = cell.Module(
		"operator-controlplane",
		"Operator Control Plane",

		cell.Config(cmtypes.DefaultClusterInfo),
		cell.Invoke(func(cinfo cmtypes.ClusterInfo) error {
			err := cinfo.Validate()
			if err != nil {
				return fmt.Errorf("error validating cluster info: %w", err)
			}
			return nil
		}),

		cell.Invoke(
			registerOperatorHooks,
		),

		cell.Provide(func() *option.DaemonConfig {
			return option.Config
		}),

		cell.Provide(func() *operatorOption.OperatorConfig {
			return operatorOption.Config
		}),

		cell.Provide(func(
			daemonCfg *option.DaemonConfig,
			_ *operatorOption.OperatorConfig,
		) identitygc.SharedConfig {
			return identitygc.SharedConfig{
				IdentityAllocationMode: daemonCfg.IdentityAllocationMode,
			}
		}),

		cell.Provide(func(
			operatorCfg *operatorOption.OperatorConfig,
			daemonCfg *option.DaemonConfig,
		) endpointgc.SharedConfig {
			return endpointgc.SharedConfig{
				Interval:                 operatorCfg.EndpointGCInterval,
				DisableCiliumEndpointCRD: daemonCfg.DisableCiliumEndpointCRD,
			}
		}),

		controller.Cell,

		WithLeaderLifecycle(

			apis.RegisterCRDsCell,

			cell.Provide(func(scheme *k8sruntime.Scheme) (ctrl.Manager, error) {

				logf.SetLogger(zapf.New())

				manager, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
					Scheme: scheme,
				})
				if err != nil {
					return nil, fmt.Errorf("failed to create manager: %w", err)
				}
				return manager, nil
			}),
			endpointcontroller.Cell,

			operatorK8s.ResourcesCell,

			auth.Cell,

			store.Cell,

			identitygc.Cell,

			endpointgc.Cell,

			telemetry.Heartbeat,
		),
	)

	FlagsHooks []ProviderFlagsHooks
)
View Source
var (
	MaxFileSizeMB = 100
	MaxBackups    = 3
	MaxAgeDays    = 30
)
View Source
var MetricsCmd = &cobra.Command{
	Use:   "metrics",
	Short: "Access metric status of the operator",
}

MetricsCmd represents the metrics command for the operator.

Functions

func Execute

func Execute(h *hive.Hive)

func InitGlobalFlags

func InitGlobalFlags(cmd *cobra.Command, vp *viper.Viper)

func WithLeaderLifecycle

func WithLeaderLifecycle(cells ...cell.Cell) cell.Cell

Types

type LeaderLifecycle

type LeaderLifecycle struct {
	cell.DefaultLifecycle
}

LeaderLifecycle is the inner lifecycle of the operator that is started when this operator instance is elected leader. It implements cell.Lifecycle allowing cells to use it.

type ProviderFlagsHooks

type ProviderFlagsHooks interface {
	RegisterProviderFlag(cmd *cobra.Command, vp *viper.Viper)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL