Skip to content

Commit

Permalink
fix(crd): remove omitempty tag from CSPI status fields (#63)
Browse files Browse the repository at this point in the history
- remove omitempty tag from CSPI status fields
- moves the Allocated and Type fields from default printer columns

Signed-off-by: mittachaitu <sai.chaithanya@mayadata.io>
  • Loading branch information
sai chaithanya authored Aug 13, 2020
1 parent b9bd480 commit a86aa61
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions config/crds/all-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ spec:
description: The amount of storage space within the pool that has been physically
allocated
name: Allocated
priority: 1
type: string
- JSONPath: .status.capacity.free
description: The amount of usable free space available in the pool
Expand All @@ -533,6 +534,7 @@ spec:
- JSONPath: .spec.poolConfig.dataRaidGroupType
description: Represents the type of the storage pool
name: Type
priority: 1
type: string
- JSONPath: .status.phase
description: Identifies the current health of the pool
Expand Down Expand Up @@ -884,6 +886,10 @@ spec:
readOnly:
description: ReadOnly if pool is readOnly or not
type: boolean
required:
- healthyReplicas
- provisionedReplicas
- readOnly
type: object
versionDetails:
description: VersionDetails is the openebs version.
Expand Down
6 changes: 6 additions & 0 deletions config/crds/bases/cstor.openebs.io_cstorpoolinstances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ spec:
description: The amount of storage space within the pool that has been physically
allocated
name: Allocated
priority: 1
type: string
- JSONPath: .status.capacity.free
description: The amount of usable free space available in the pool
Expand All @@ -41,6 +42,7 @@ spec:
- JSONPath: .spec.poolConfig.dataRaidGroupType
description: Represents the type of the storage pool
name: Type
priority: 1
type: string
- JSONPath: .status.phase
description: Identifies the current health of the pool
Expand Down Expand Up @@ -392,6 +394,10 @@ spec:
readOnly:
description: ReadOnly if pool is readOnly or not
type: boolean
required:
- healthyReplicas
- provisionedReplicas
- readOnly
type: object
versionDetails:
description: VersionDetails is the openebs version.
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/cstor/v1/cstorpoolinstance.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ import (
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Namespaced,shortName=cspi
// +kubebuilder:printcolumn:name="HostName",type=string,JSONPath=`.spec.hostName`,description="Host name where cstorpool instances scheduled"
// +kubebuilder:printcolumn:name="Allocated",type=string,JSONPath=`.status.capacity.used`,description="The amount of storage space within the pool that has been physically allocated"
// +kubebuilder:printcolumn:name="Allocated",type=string,JSONPath=`.status.capacity.used`,description="The amount of storage space within the pool that has been physically allocated",priority=1
// +kubebuilder:printcolumn:name="Free",type=string,JSONPath=`.status.capacity.free`,description="The amount of usable free space available in the pool"
// +kubebuilder:printcolumn:name="Capacity",type=string,JSONPath=`.status.capacity.total`,description="Total amount of usable space in pool"
// +kubebuilder:printcolumn:name="ReadOnly",type=boolean,JSONPath=`.status.readOnly`,description="Identifies the pool read only mode"
// +kubebuilder:printcolumn:name="ProvisionedReplicas",type=integer,JSONPath=`.status.provisionedReplicas`,description="Represents no.of replicas present in the pool"
// +kubebuilder:printcolumn:name="HealthyReplicas",type=integer,JSONPath=`.status.healthyReplicas`,description="Represents no.of healthy replicas present in the pool"
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.poolConfig.dataRaidGroupType`,description="Represents the type of the storage pool"
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.poolConfig.dataRaidGroupType`,description="Represents the type of the storage pool",priority=1
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase`,description="Identifies the current health of the pool"
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="Age of CStorPoolInstance"
type CStorPoolInstance struct {
Expand Down Expand Up @@ -117,13 +117,13 @@ type CStorPoolInstanceStatus struct {
// Capacity describes the capacity details of a cstor pool
Capacity CStorPoolInstanceCapacity `json:"capacity,omitempty"`
//ReadOnly if pool is readOnly or not
ReadOnly bool `json:"readOnly,omitempty"`
ReadOnly bool `json:"readOnly"`
// ProvisionedReplicas describes the total count of Volume Replicas
// present in the cstor pool
ProvisionedReplicas int32 `json:"provisionedReplicas,omitempty"`
ProvisionedReplicas int32 `json:"provisionedReplicas"`
// HealthyReplicas describes the total count of healthy Volume Replicas
// in the cstor pool
HealthyReplicas int32 `json:"healthyReplicas,omitempty"`
HealthyReplicas int32 `json:"healthyReplicas"`
}

// CStorPoolInstanceCapacity stores the pool capacity related attributes.
Expand Down

0 comments on commit a86aa61

Please sign in to comment.