Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pkg/diagnostics/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func RunCollect(cmd *cobra.Command, args []string) {
c.CollectPVs(listOptions)
c.CollectPVCs(listOptions)
c.CollectSCC()
c.CollectDBUpgradeLogs()

c.ExportDiagnostics(destDir)

Expand Down Expand Up @@ -151,6 +152,28 @@ func (c *Collector) CollectPodsLogs(listOptions client.ListOptions) {
}
}

// CollectDBUpgradeLogs collects the logs produced during psql 12 to 15 upgrade.
func (c *Collector) CollectDBUpgradeLogs() {
// List all pods and select only noobaa pods within the relevant namespace
c.log.Println("Collecting upgrade logs from DB pod")

upgradeLogNames := []string{"revertdb.log", "upgradedb.log", "dumpdb.log"}

for _, logName := range upgradeLogNames {
cmd := exec.Command(c.kubeCommand, "cp", "-n", options.Namespace, "noobaa-db-pg-0:/var/lib/pgsql/"+logName, c.folderName+"/"+logName)
// handle custom path for kubeconfig file,
// see --kubeconfig cli options
if len(c.kubeconfig) > 0 {
cmd.Env = append(cmd.Env, "KUBECONFIG="+c.kubeconfig)
}
// Execute the command, generating the dump file
if err := cmd.Run(); err != nil {
c.log.Printf(`❌ cannot export upgrade log %s from DB pod: %v`, logName, err)
}
}

}

// CollectPVs collects describe of PVs
func (c *Collector) CollectPVs(listOptions client.ListOptions) {
// List all PVs and select only noobaa PVs within the relevant namespace
Expand Down
Loading