Documentation ¶
Index ¶
- Variables
- func Execute(cmd *cobra.Command)
- func InitGlobalFlags(cmd *cobra.Command, vp *viper.Viper)
- func NewOperatorCmd(h *hive.Hive) *cobra.Command
- func RunCNPStatusNodesCleaner(ctx context.Context, clientset k8sClient.Clientset, rateLimit *rate.Limiter)
- func WithLeaderLifecycle(cells ...cell.Cell) cell.Cell
- type LeaderLifecycle
- type ProviderFlagsHooks
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Operator = cell.Module( "operator", "Cilium Operator", Infrastructure, ControlPlane, ) Infrastructure = cell.Module( "operator-infra", "Operator Infrastructure", pprof.Cell, cell.ProvidePrivate(func(cfg operatorPprofConfig) pprof.Config { return pprof.Config{ Pprof: cfg.OperatorPprof, PprofAddress: cfg.OperatorPprofAddress, PprofPort: cfg.OperatorPprofPort, } }), cell.Config(operatorPprofConfig{ OperatorPprofAddress: operatorOption.PprofAddressOperator, OperatorPprofPort: operatorOption.PprofPortOperator, }), gops.Cell(defaults.GopsPortOperator), k8sClient.Cell, operatorMetrics.Cell, cell.Provide(func( operatorCfg *operatorOption.OperatorConfig, ) operatorMetrics.SharedConfig { return operatorMetrics.SharedConfig{ EnableMetrics: operatorCfg.EnableMetrics, EnableGatewayAPI: operatorCfg.EnableGatewayAPI, } }), ) // ControlPlane implements the control functions. ControlPlane = cell.Module( "operator-controlplane", "Operator Control Plane", cell.Config(cmtypes.DefaultClusterInfo), cell.Invoke(func(cinfo cmtypes.ClusterInfo) error { return cinfo.InitClusterIDMax() }), cell.Invoke(func(cinfo cmtypes.ClusterInfo) error { return cinfo.Validate() }), 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, operatorCfg *operatorOption.OperatorConfig, ) identitygc.SharedConfig { return identitygc.SharedConfig{ IdentityAllocationMode: daemonCfg.IdentityAllocationMode, K8sNamespace: daemonCfg.CiliumNamespaceName(), } }), cell.Provide(func( daemonCfg *option.DaemonConfig, ) ciliumendpointslice.SharedConfig { return ciliumendpointslice.SharedConfig{ EnableCiliumEndpointSlice: daemonCfg.EnableCiliumEndpointSlice, } }), cell.Provide(func( operatorCfg *operatorOption.OperatorConfig, daemonCfg *option.DaemonConfig, ) endpointgc.SharedConfig { return endpointgc.SharedConfig{ Interval: operatorCfg.EndpointGCInterval, DisableCiliumEndpointCRD: daemonCfg.DisableCiliumEndpointCRD, } }), api.HealthHandlerCell( kvstoreEnabled, isLeader.Load, ), api.MetricsHandlerCell, controller.Cell, operatorApi.SpecCell, api.ServerCell, job.Cell, WithLeaderLifecycle( apis.RegisterCRDsCell, operatorK8s.ResourcesCell, lbipam.Cell, auth.Cell, store.Cell, legacyCell, identitygc.Cell, ciliumendpointslice.Cell, endpointgc.Cell, controllerruntime.Cell, gatewayapi.Cell, ingress.Cell, secretsync.Cell, ciliumenvoyconfig.Cell, ), ) FlagsHooks []ProviderFlagsHooks )
View Source
var MetricsCmd = &cobra.Command{
Use: "metrics",
Short: "Access metric status of the operator",
}
MetricsCmd represents the metrics command for the operator.
View Source
var MetricsListCmd = &cobra.Command{ Use: "list", Short: "List all metrics for the operator", Run: func(cmd *cobra.Command, args []string) { c := client.NewHTTPClientWithConfig( strfmt.Default, client.DefaultTransportConfig().WithHost(operatorAddr)) res, err := c.Metrics.GetMetrics(nil) if err != nil { log.Fatalf("Cannot get metrics list: %s", err) } re, err := regexp.Compile(matchPattern) if err != nil { log.Fatalf("Cannot compile regex: %s", err) } metrics := make([]*models.Metric, 0, len(res.Payload)) for _, metric := range res.Payload { if re.MatchString(metric.Name) { metrics = append(metrics, metric) } } if command.OutputOption() { if err := command.PrintOutput(metrics); err != nil { os.Exit(1) } return } w := tabwriter.NewWriter(os.Stdout, 5, 0, 3, ' ', 0) fmt.Fprintln(w, "Metric\tLabels\tValue") for _, metric := range metrics { label := "" if len(metric.Labels) > 0 { labelArray := []string{} for key, value := range metric.Labels { labelArray = append(labelArray, fmt.Sprintf(`%s="%s"`, key, value)) } label = strings.Join(labelArray, " ") } fmt.Fprintf(w, "%s\t%s\t%f\n", metric.Name, label, metric.Value) } w.Flush() }, }
MetricsListCmd dumps all metrics into stdout
Functions ¶
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.
Click to show internal directories.
Click to hide internal directories.