Skip to content

Commit e42945e

Browse files
committed
fix describe for clusterrole and clusterrolebinding on openshift
1 parent 308444a commit e42945e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

internal/cmd/export.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,23 @@ Collecting PGO CLI logs...
608608

609609
writeInfo(cmd, "Running kubectl describe clusterrole...")
610610
err = runKubectlCommand(tw, cmd, clusterName+"/describe/clusterrole", "describe", "clusterrole", "postgres-operator")
611+
if err != nil {
612+
writeInfo(cmd, "Could not find clusterrole 'postgres-operator'. Looking for 'postgresoperator'...")
613+
writeInfo(cmd, "Running kubectl describe clusterrole...")
614+
err = runKubectlCommand(tw, cmd, clusterName+"/describe/clusterrole", "describe", "clusterrole", "postgresoperator")
615+
}
616+
611617
if err != nil {
612618
writeInfo(cmd, fmt.Sprintf("Error running kubectl describe clusterrole: %s", err))
613619
}
614620

615621
writeInfo(cmd, "Running kubectl describe clusterrolebinding...")
616622
err = runKubectlCommand(tw, cmd, clusterName+"/describe/clusterrolebinding", "describe", "clusterrolebinding", "postgres-operator")
623+
if err != nil {
624+
writeInfo(cmd, "Could not find clusterrolebinding 'postgres-operator'. Looking for 'postgresoperator'...")
625+
writeInfo(cmd, "Running kubectl describe clusterrole...")
626+
err = runKubectlCommand(tw, cmd, clusterName+"/describe/clusterrolebinding", "describe", "clusterrolebinding", "postgresoperator")
627+
}
617628
if err != nil {
618629
writeInfo(cmd, fmt.Sprintf("Error running kubectl describe clusterrolebinding: %s", err))
619630
}
@@ -769,6 +780,7 @@ func runKubectlCommand(tw *tar.Writer, cmd *cobra.Command, path string, cmdArgs
769780
There was an error running the command. Verify permissions and that the resource exists.`)...)
770781

771782
writeInfo(cmd, fmt.Sprintf("Error: '%s'", msg))
783+
return err
772784
}
773785

774786
if err := writeTar(tw, msg, path, cmd); err != nil {
@@ -1101,7 +1113,7 @@ func gatherCrds(ctx context.Context,
11011113
tw *tar.Writer,
11021114
cmd *cobra.Command,
11031115
) error {
1104-
writeInfo(cmd, "Collecting events...")
1116+
writeInfo(cmd, "Collecting CRDs...")
11051117
// list, err := clientset.CoreV1().Events(namespace).List(ctx, metav1.ListOptions{})
11061118

11071119
labelSelector := "app.kubernetes.io/name=pgo"

0 commit comments

Comments
 (0)