Skip to content

Commit

Permalink
clusterloader2/: Enable KSMLatency tests for GCE env
Browse files Browse the repository at this point in the history
Currently enable KubeStateMetrics for GCE env only.

As we use kubeconfig for kube-state-metrics and this is not supported in
kubemark we cannot run those for kubemark env.
  • Loading branch information
lilic committed Mar 25, 2021
1 parent 9ec2abd commit d0706e1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func CreateKSMLatencyMeasurement() measurement.Measurement {
// it also collects initial latency metrics.
// - gather - gathers latency metrics and creates a latency summary.
func (m *ksmLatencyMeasurement) Execute(config *measurement.Config) ([]measurement.Summary, error) {
if !config.CloudProvider.Features().SupportKubeStateMetrics {
klog.Infof("not executing KSMLatencyMeasurement: unsupported for provider, %s", config.ClusterFramework.GetClusterConfig().Provider.Name())
return nil, nil
}
action, err := util.GetString(config.Params, "action")
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion clusterloader2/pkg/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (pc *Controller) SetUpPrometheusStack() error {
}
}

if pc.clusterLoaderConfig.PrometheusConfig.ScrapeKubeStateMetrics {
if pc.clusterLoaderConfig.PrometheusConfig.ScrapeKubeStateMetrics && pc.clusterLoaderConfig.ClusterConfig.Provider.Features().SupportKubeStateMetrics {
klog.V(2).Infof("Applying kube-state-metrics in the cluster.")
if err := pc.applyManifests(pc.clusterLoaderConfig.PrometheusConfig.KubeStateMetricsManifests); err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions clusterloader2/pkg/provider/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func NewGCEProvider(_ map[string]string) Provider {
SupportEnablePrometheusServer: true,
SupportGrabMetricsFromKubelets: true,
SupportAccessAPIServerPprofEndpoint: true,
SupportKubeStateMetrics: true,
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions clusterloader2/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type Features struct {
SupportNodeKiller bool
// SupportGrabMetricsFromKubelets determines whether getting metrics from kubelet is supported.
SupportGrabMetricsFromKubelets bool
// SupportKubeStateMetrics determines if running kube-state-metrics is supported.
SupportKubeStateMetrics bool

// ShouldPrometheusScrapeApiserverOnly determines if we should set PROMETHEUS_SCRAPE_APISERVER_ONLY by default.
ShouldPrometheusScrapeApiserverOnly bool
Expand Down

0 comments on commit d0706e1

Please sign in to comment.