-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgresCluster names and namespaces for support #75
PostgresCluster names and namespaces for support #75
Conversation
Adds all reachable postgrescluster names and their namespaces to support export. Issue: PGO-272
6a1cfe8
to
92536d3
Compare
@@ -71,6 +71,7 @@ kubectl pgo support export daisy --monitoring-namespace another-namespace --outp | |||
| Note: No data or k8s secrets are collected. | |||
└──────────────────────────────────────────────────────────────── | |||
Collecting PGO CLI version... | |||
Collecting names and namespaces for PostgresClusters... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
ns, found, err := unstructured.NestedString(item.Object, "metadata", "namespace") | ||
if !found { | ||
return fmt.Errorf("key not found: metadata.namespace") | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
name, found, err := unstructured.NestedString(item.Object, "metadata", "name") | ||
if !found { | ||
return fmt.Errorf("key not found: metadata.name") | ||
} | ||
if err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌱 Every PostgresCluster returned from the API will have a namespace and name. There's also no harm in proceeding if we do encounter something unexpected. I think we prefer to gather the remainder of the list rather than give up early.
ns, found, err := unstructured.NestedString(item.Object, "metadata", "namespace") | |
if !found { | |
return fmt.Errorf("key not found: metadata.namespace") | |
} | |
if err != nil { | |
return err | |
} | |
name, found, err := unstructured.NestedString(item.Object, "metadata", "name") | |
if !found { | |
return fmt.Errorf("key not found: metadata.name") | |
} | |
if err != nil { | |
return err | |
} | |
ns, _, _ := unstructured.NestedString(item.Object, "metadata", "namespace") | |
name, _, _ := unstructured.NestedString(item.Object, "metadata", "name") |
Adds all reachable postgrescluster names and their namespaces to support export.
Issue: PGO-272