Skip to content

Commit

Permalink
Fix gathering profiles for kube-apiserver.
Browse files Browse the repository at this point in the history
  • Loading branch information
mm4tt committed Jan 15, 2020
1 parent 9117226 commit bae7e55
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 bae7e55

Please sign in to comment.