Compare commits

...

1 Commits

Author SHA1 Message Date
Andrii Dema
c8b8212196 PT-1931: pt-k8s-debug-collector does not gather summaries for PSMDB
https://jira.percona.com/browse/PT-1931

When I tried to reproduce the bug, `pt-mongodb-summary` didn't launch only when option `--cluster` was specified. This PR fixes this behavior and also fixes https://jira.percona.com/browse/PT-1932
2021-07-20 11:45:30 +03:00

View File

@@ -166,12 +166,12 @@ func (d *Dumper) DumpCluster() error {
continue
}
location = filepath.Join(d.location, ns.Name, pod.Name, "/pt-summary.txt")
component := d.crType
if d.crType == "psmdb" {
component := resourceType(d.crType)
if component == "psmdb" {
component = "mongod"
}
if pod.Labels["app.kubernetes.io/component"] == component {
output, err = d.getPodSummary(d.crType, pod.Name, pod.Labels["app.kubernetes.io/instance"], tw)
output, err = d.getPodSummary(resourceType(d.crType), pod.Name, pod.Labels["app.kubernetes.io/instance"], tw)
if err != nil {
d.logError(err.Error(), d.crType, pod.Name)
err = addToArchive(location, d.mode, []byte(err.Error()), tw)
@@ -353,3 +353,12 @@ func (d *Dumper) getDataFromSecret(secretName, dataName string) (string, error)
return string(pass), nil
}
func resourceType(s string) string {
if s == "pxc" || strings.HasPrefix(s, "pxc/") {
return "pxc"
} else if s == "psmdb" || strings.HasPrefix(s, "psmdb/") {
return "psmdb"
}
return s
}