Skip to content

Commit

Permalink
Add age column and fix column order (#81)
Browse files Browse the repository at this point in the history
A few UX changes:

    Adds an age column (with Kubebuilder this disappears from the CRD as soon as you add the first printcolumn)
    Orders the condition columns to feature the "Ready" condition as the last one
  • Loading branch information
jstudler authored Oct 1, 2024
1 parent d3d6f7e commit fd9f308
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions api/v1/ipaddress_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type IpAddressStatus struct {
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id`
//+kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.status.url`
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:resource:shortName=ip

// IpAddress is the Schema for the ipaddresses API
Expand Down
3 changes: 2 additions & 1 deletion api/v1/ipaddressclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ type IpAddressClaimStatus struct {
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
//+kubebuilder:printcolumn:name="IpAddress",type=string,JSONPath=`.status.ipAddress`
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
//+kubebuilder:printcolumn:name="IpAssigned",type=string,JSONPath=`.status.conditions[?(@.type=="IPAssigned")].status`
//+kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:resource:shortName=ipc

// IpAddressClaim is the Schema for the ipaddressclaims API
Expand Down
1 change: 1 addition & 0 deletions api/v1/prefix_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type PrefixStatus struct {
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id`
// +kubebuilder:printcolumn:name="URL",type=string,JSONPath=`.status.url`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:resource:shortName=px
// Prefix is the Schema for the prefixes API
type Prefix struct {
Expand Down
3 changes: 2 additions & 1 deletion api/v1/prefixclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ type PrefixClaimStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Prefix",type=string,JSONPath=`.status.prefix`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="PrefixAssigned",type=string,JSONPath=`.status.conditions[?(@.type=="PrefixAssigned")].status`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:resource:shortName=pxc
// PrefixClaim is the Schema for the prefixclaims API
type PrefixClaim struct {
Expand Down
9 changes: 6 additions & 3 deletions config/crd/bases/netbox.dev_ipaddressclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ spec:
- jsonPath: .status.ipAddress
name: IpAddress
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .status.conditions[?(@.type=="IPAssigned")].status
name: IpAssigned
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/netbox.dev_ipaddresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ spec:
- jsonPath: .status.url
name: URL
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down
9 changes: 6 additions & 3 deletions config/crd/bases/netbox.dev_prefixclaims.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ spec:
- jsonPath: .status.prefix
name: Prefix
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .status.conditions[?(@.type=="PrefixAssigned")].status
name: PrefixAssigned
type: string
- jsonPath: .status.conditions[?(@.type=="Ready")].status
name: Ready
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/netbox.dev_prefixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ spec:
- jsonPath: .status.url
name: URL
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down

0 comments on commit fd9f308

Please sign in to comment.