Skip to content

Commit

Permalink
Merge pull request kubernetes#982 from mm4tt/apiserver_profiles
Browse files Browse the repository at this point in the history
Fix gathering profiles for kube-apiserver.
  • Loading branch information
k8s-ci-robot committed Jan 15, 2020
2 parents 9117226 + bae7e55 commit e9a7adb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion clusterloader2/pkg/measurement/common/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ func (p *profileMeasurement) gatherProfile(c clientset.Interface) ([]measurement
if err != nil {
return nil, fmt.Errorf("profile gathering failed finding component port: %v", err)
}
getCommand := fmt.Sprintf("curl -s localhost:%v/debug/pprof/%s", profilePort, p.config.kind)
profileProtocol := getProtocolForComponent(p.config.componentName)
getCommand := fmt.Sprintf("curl -s %slocalhost:%v/debug/pprof/%s", profileProtocol, profilePort, p.config.kind)

var summaries []measurement.Summary
for _, host := range p.config.hosts {
Expand Down Expand Up @@ -216,3 +217,12 @@ func getPortForComponent(componentName string) (int, error) {
}
return -1, fmt.Errorf("port for component %v unknown", componentName)
}

func getProtocolForComponent(componentName string) string {
switch componentName {
case "kube-apiserver":
return "https://"
default:
return "http://"
}
}

0 comments on commit e9a7adb

Please sign in to comment.