Skip to content

Commit 1fd98b3

Browse files
anoopcs9phlogistonjohn
authored andcommitted
api: Add basic Printer Columns for SmbShare
With the help of additional printer columns following basic information for a share is displayed: * .spec.sharename * .spec.storage.pvc.path * .spec.scaling.availabilitymode Signed-off-by: Anoop C S <[email protected]>
1 parent 6bd5bea commit 1fd98b3

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

api/v1alpha1/smbshare_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,15 @@ type SmbShareStatus struct {
114114
ServerGroup string `json:"serverGroup,omitempty"`
115115
}
116116

117+
// revive:disable:line-length-limit kubebuilder markers
118+
119+
// nolint:lll
117120
// +kubebuilder:object:root=true
118121
// +kubebuilder:subresource:status
122+
// +kubebuilder:printcolumn:JSONPath=`.spec.shareName`,description="Name of the Samba share",name="Share-name",type=string
123+
// +kubebuilder:printcolumn:JSONPath=`.spec.storage.pvc.path`,description="Path for the share within PVC",name="Share-path",type=string
124+
// +kubebuilder:printcolumn:JSONPath=`.spec.scaling.availabilityMode`,description="Samba availability mode",name="Availability",type=string
125+
// +kubebuilder:printcolumn:JSONPath=`.metadata.creationTimestamp`,name="Age",type=date
119126

120127
// SmbShare is the Schema for the smbshares API
121128
type SmbShare struct {
@@ -126,6 +133,8 @@ type SmbShare struct {
126133
Status SmbShareStatus `json:"status,omitempty"`
127134
}
128135

136+
// revive:enable:line-length-limit
137+
129138
// +kubebuilder:object:root=true
130139

131140
// SmbShareList contains a list of SmbShare

config/crd/bases/samba-operator.samba.org_smbshares.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@ spec:
1414
singular: smbshare
1515
scope: Namespaced
1616
versions:
17-
- name: v1alpha1
17+
- additionalPrinterColumns:
18+
- description: Name of the Samba share
19+
jsonPath: .spec.shareName
20+
name: Share-name
21+
type: string
22+
- description: Path for the share within PVC
23+
jsonPath: .spec.storage.pvc.path
24+
name: Share-path
25+
type: string
26+
- description: Samba availability mode
27+
jsonPath: .spec.scaling.availabilityMode
28+
name: Availability
29+
type: string
30+
- jsonPath: .metadata.creationTimestamp
31+
name: Age
32+
type: date
33+
name: v1alpha1
1834
schema:
1935
openAPIV3Schema:
2036
description: SmbShare is the Schema for the smbshares API
@@ -46,6 +62,7 @@ spec:
4662
description: Scaling specifies parameters relating to how share resources can and should be scaled.
4763
properties:
4864
availabilityMode:
65+
default: standard
4966
description: AvailabilityMode specifies how the operator is to scale share resources for (high-)availability purposes.
5067
enum:
5168
- standard

0 commit comments

Comments
 (0)