Skip to content
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

display additional columns for databaseuserreferences #27

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions api/v1alpha1/databaseuserreference_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ type DatabaseUserReferenceStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
//+kubebuilder:printcolumn:name="Cluster name",type=string,JSONPath=`.spec.databaseCluster.name`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we specify .spec.databaseCluster here rather than just the name? It would be nice to see the type as well, but I'm not sure it deserves its own column. Wondering if it will pretty-print it in a reasonable way if we just tell it to print the whole object reference.

Copy link
Contributor Author

@kperath kperath Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what it looks like without the name

 NAME                 AGE     CLUSTER NAME                                                                                            USERNAME   ROLE
my-app-db-user-ref   3d17h   {"apiGroup":"databases.digitalocean.com","kind":"DatabaseClusterReference","name":"my-referenced-db"}   doadmin    primary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's gross. Let's stick with what's already in this PR.

//+kubebuilder:printcolumn:name="Username",type=string,JSONPath=`.spec.username`
//+kubebuilder:printcolumn:name="Role",type=string,JSONPath=`.status.role`

// DatabaseUserReference is the Schema for the databaseuserreferences API
type DatabaseUserReference struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ spec:
singular: databaseuserreference
scope: Namespaced
versions:
- name: v1alpha1
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .spec.databaseCluster.name
name: Cluster name
type: string
- jsonPath: .spec.username
name: Username
type: string
- jsonPath: .status.role
name: Role
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: DatabaseUserReference is the Schema for the databaseuserreferences
Expand Down