Skip to content

Commit

Permalink
Export various stats about services in the metrics exported by this c…
Browse files Browse the repository at this point in the history
…ontroller.
  • Loading branch information
mmamczur committed Feb 23, 2023
1 parent ed35b2e commit 0e76ed7
Show file tree
Hide file tree
Showing 4 changed files with 1,109 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/glbc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"k8s.io/ingress-gce/pkg/l4lb"
"k8s.io/ingress-gce/pkg/psc"
"k8s.io/ingress-gce/pkg/serviceattachment"
"k8s.io/ingress-gce/pkg/servicemetrics"
"k8s.io/ingress-gce/pkg/svcneg"
"k8s.io/klog/v2"

Expand Down Expand Up @@ -293,6 +294,12 @@ func runControllers(ctx *ingctx.ControllerContext) {
klog.V(0).Infof("PSC Controller started")
}

if flags.F.EnableServiceMetrics {
metricsController := servicemetrics.NewController(ctx, flags.F.MetricsExportInterval, stopCh)
go metricsController.Run()
klog.V(0).Infof("Service Metrics Controller started")
}

var zoneGetter negtypes.ZoneGetter
zoneGetter = lbc.Translator
// In NonGCP mode, use the zone specified in gce.conf directly.
Expand Down
2 changes: 2 additions & 0 deletions pkg/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ var (
EnablePinhole bool
EnableL4ILBDualStack bool
EnableMultipleIGs bool
EnableServiceMetrics bool
MaxIGSize int
}{
GCERateLimitScale: 1.0,
Expand Down Expand Up @@ -244,6 +245,7 @@ L7 load balancing. CSV values accepted. Example: -node-port-ranges=80,8080,400-5
flag.BoolVar(&F.RunIngressController, "run-ingress-controller", true, `Optional, whether or not to run IngressController as part of glbc. If set to false, ingress resources will not be processed. Only the L4 Service controller will be run, if that flag is set to true.`)
flag.BoolVar(&F.RunL4Controller, "run-l4-controller", false, `Optional, whether or not to run L4 Service Controller as part of glbc. If set to true, services of Type:LoadBalancer with Internal annotation will be processed by this controller.`)
flag.BoolVar(&F.RunL4NetLBController, "run-l4-netlb-controller", false, `Optional, f enabled then the L4NetLbController will be run.`)
flag.BoolVar(&F.EnableServiceMetrics, "enable-service-metrics", false, `Optional, if enabled then the service metrics controller will be run.`)
flag.BoolVar(&F.EnableBackendConfigHealthCheck, "enable-backendconfig-healthcheck", false, "Enable configuration of HealthChecks from the BackendConfig")
flag.BoolVar(&F.EnablePSC, "enable-psc", false, "Enable PSC controller")
flag.BoolVar(&F.EnableIngressGAFields, "enable-ingress-ga-fields", false, "Enable using Ingress Class GA features")
Expand Down
Loading

0 comments on commit 0e76ed7

Please sign in to comment.