Documentation
¶
Index ¶
- Variables
- func Execute(cmd *cobra.Command)
- func InitGlobalFlags(logger *slog.Logger, cmd *cobra.Command, vp *viper.Viper)
- func NewOperatorCmd(h *hive.Hive) *cobra.Command
- func WithLeaderLifecycle(cells ...cell.Cell) cell.Cell
- type LeaderLifecycle
- type ProviderFlagsHooks
- type UnmanagedPodsMetric
- type WorkqueuePrometheusMetricsProvider
- func (p WorkqueuePrometheusMetricsProvider) NewAddsMetric(name string) workqueue.CounterMetric
- func (p WorkqueuePrometheusMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric
- func (p WorkqueuePrometheusMetricsProvider) NewLatencyMetric(name string) workqueue.HistogramMetric
- func (p WorkqueuePrometheusMetricsProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric
- func (p WorkqueuePrometheusMetricsProvider) NewRetriesMetric(name string) workqueue.CounterMetric
- func (p WorkqueuePrometheusMetricsProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric
- func (p WorkqueuePrometheusMetricsProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Operator = cell.Module( "operator", "Cilium Operator", Infrastructure, ControlPlane, cell.Invoke( registerOperatorHooks, ), ) Infrastructure = cell.Module( "operator-infra", "Operator Infrastructure", cell.ProvidePrivate(func(cfg operatorPprofConfig) pprof.Config { return cfg.Config() }), pprof.Cell(defaultOperatorPprofConfig), gops.Cell(defaults.EnableGops, defaults.GopsPortOperator), client.Cell, cell.ProvidePrivate(func(clientParams operatorClientParams) k8sClient.ClientParams { return k8sClient.ClientParams{ K8sClientQPS: clientParams.OperatorK8sClientQPS, K8sClientBurst: clientParams.OperatorK8sClientBurst, } }), cell.Config(operatorClientParams{ OperatorK8sClientQPS: 100.0, OperatorK8sClientBurst: 200, }), cell.Provide(k8s.ServiceResource), dial.ServiceResolverCell, cell.Provide(kvstoreExtraOptions), kvstore.Cell(kvstore.DisabledBackendName), operatorMetrics.Cell, cell.Provide(func( operatorCfg *operatorOption.OperatorConfig, ) operatorMetrics.SharedConfig { return operatorMetrics.SharedConfig{ EnableMetrics: operatorCfg.EnableMetrics, } }), shell.Cell, ) // ControlPlane implements the control functions. ControlPlane = cell.Module( "operator-controlplane", "Operator Control Plane", cell.Config(cmtypes.DefaultClusterInfo), cell.Config(cmtypes.DefaultPolicyConfig), cell.Invoke(cmtypes.ClusterInfo.InitClusterIDMax), cell.Invoke(cmtypes.ClusterInfo.Validate), 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, } }), 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, } }), cell.Provide(func( daemonCfg *option.DaemonConfig, ) ciliumidentity.SharedConfig { return ciliumidentity.SharedConfig{ EnableCiliumEndpointSlice: daemonCfg.EnableCiliumEndpointSlice, DisableNetworkPolicy: !option.NetworkPolicyEnabled(daemonCfg), } }), api.HealthHandlerCell( isLeader.Load, ), api.MetricsHandlerCell, controller.Cell, operatorApi.SpecCell, api.ServerCell, WithLeaderLifecycle( apis.RegisterCRDsCell, operatorK8s.ResourcesCell, heartbeat.Enabled, heartbeat.Cell, clustercfgcell.WithSyncedCanaries(false), clustercfgcell.Cell, bgpv2.Cell, lbipam.Cell, nodeipam.Cell, auth.Cell, store.Cell, cmoperator.Cell, endpointslicesync.Cell, mcsapi.Cell, legacyCell, identitygc.Cell, ciliumidentity.Cell, doublewrite.Cell, ciliumendpointslice.Cell, endpointgc.Cell, controllerruntime.Cell, gatewayapi.Cell, ingress.Cell, secretsync.Cell, cell.Provide(func(cfg *operatorOption.OperatorConfig, dcfg *option.DaemonConfig) operatorWatchers.ServiceSyncConfig { return operatorWatchers.ServiceSyncConfig{ Enabled: cfg.SyncK8sServices, } }), operatorWatchers.ServiceSyncCell, mcsapi.ServiceExportSyncCell, ciliumenvoyconfig.Cell, networkpolicy.Cell, networkpolicy.SecretSyncCell, features.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) { logger := logging.DefaultSlogLogger c := client.NewHTTPClientWithConfig( strfmt.Default, client.DefaultTransportConfig().WithHost(operatorAddr)) res, err := c.Metrics.GetMetrics(nil) if err != nil { logging.Fatal(logger, fmt.Sprintf("Cannot get metrics list: %s", err)) } re, err := regexp.Compile(matchPattern) if err != nil { logging.Fatal(logger, fmt.Sprintf("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
View Source
var StatusClusterMesh = func() *cobra.Command { var host string var verbose bool cmd := &cobra.Command{ Use: "clustermesh", Short: "Display status of remote clusters", Run: func(cmd *cobra.Command, args []string) { status(cmd.Context(), host, cmd.OutOrStdout(), verbose) }, PersistentPreRun: func(cmd *cobra.Command, args []string) { ctx, _ := signal.NotifyContext(context.Background(), os.Interrupt) cmd.SetContext(ctx) }, } StatusCmd.AddCommand(cmd) command.AddOutputOption(cmd) cmd.Flags().StringVarP(&host, "server-address", "s", api.OperatorAPIServeAddrDefault, "Address of the operator API server") cmd.Flags().BoolVar(&verbose, "verbose", false, "Output verbose status information for ready clusters as well") return cmd }()
View Source
var StatusCmd = &cobra.Command{
Use: "status",
Short: "Display status of operator",
}
StatusCmd represents the status command for the operator.
Functions ¶
func InitGlobalFlags ¶
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 UnmanagedPodsMetric ¶ added in v1.17.0
type UnmanagedPodsMetric struct {
// UnmanagedPods records the pods that are unmanaged by Cilium.
// This includes Running pods not using hostNetwork, which do not have a corresponding CiliumEndpoint object.
UnmanagedPods metric.Gauge
}
func NewUnmanagedPodsMetric ¶ added in v1.17.0
func NewUnmanagedPodsMetric() *UnmanagedPodsMetric
type WorkqueuePrometheusMetricsProvider ¶ added in v1.18.0
type WorkqueuePrometheusMetricsProvider struct {
// contains filtered or unexported fields
}
func NewWorkqueuePrometheusMetricsProvider ¶ added in v1.18.0
func NewWorkqueuePrometheusMetricsProvider() *WorkqueuePrometheusMetricsProvider
func (WorkqueuePrometheusMetricsProvider) NewAddsMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewAddsMetric(name string) workqueue.CounterMetric
func (WorkqueuePrometheusMetricsProvider) NewDepthMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewDepthMetric(name string) workqueue.GaugeMetric
func (WorkqueuePrometheusMetricsProvider) NewLatencyMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewLatencyMetric(name string) workqueue.HistogramMetric
func (WorkqueuePrometheusMetricsProvider) NewLongestRunningProcessorSecondsMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewLongestRunningProcessorSecondsMetric(name string) workqueue.SettableGaugeMetric
func (WorkqueuePrometheusMetricsProvider) NewRetriesMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewRetriesMetric(name string) workqueue.CounterMetric
func (WorkqueuePrometheusMetricsProvider) NewUnfinishedWorkSecondsMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewUnfinishedWorkSecondsMetric(name string) workqueue.SettableGaugeMetric
func (WorkqueuePrometheusMetricsProvider) NewWorkDurationMetric ¶ added in v1.18.0
func (p WorkqueuePrometheusMetricsProvider) NewWorkDurationMetric(name string) workqueue.HistogramMetric
Click to show internal directories.
Click to hide internal directories.