Skip to content

Commit

Permalink
Merge pull request rook#13958 from NymanRobin/improve-kubectl-get-output
Browse files Browse the repository at this point in the history
operator: improve the output of kubectl get
  • Loading branch information
subhamkrai authored Apr 3, 2024
2 parents 04ccc53 + 17adb16 commit 71b3728
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 7 deletions.
54 changes: 54 additions & 0 deletions deploy/charts/rook-ceph/templates/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,27 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.info.type
name: Type
type: string
- jsonPath: .status.info.failureDomain
name: FailureDomain
type: string
- jsonPath: .spec.replicated.size
name: Replication
priority: 1
type: integer
- jsonPath: .spec.erasureCoded.codingChunks
name: EC-CodingChunks
priority: 1
type: integer
- jsonPath: .spec.erasureCoded.dataChunks
name: EC-DataChunks
priority: 1
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -671,6 +692,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -828,6 +852,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -5763,6 +5790,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -7919,6 +7949,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -10017,6 +10050,15 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.info.endpoint
name: Endpoint
type: string
- jsonPath: .status.info.secureEndpoint
name: SecureEndpoint
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11511,6 +11553,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11748,6 +11793,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11841,6 +11889,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -12332,6 +12383,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down
54 changes: 54 additions & 0 deletions deploy/examples/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.info.type
name: Type
type: string
- jsonPath: .status.info.failureDomain
name: FailureDomain
type: string
- jsonPath: .spec.replicated.size
name: Replication
priority: 1
type: integer
- jsonPath: .spec.erasureCoded.codingChunks
name: EC-CodingChunks
priority: 1
type: integer
- jsonPath: .spec.erasureCoded.dataChunks
name: EC-DataChunks
priority: 1
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -671,6 +692,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -827,6 +851,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -5759,6 +5786,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -7913,6 +7943,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -10008,6 +10041,15 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .status.info.endpoint
name: Endpoint
type: string
- jsonPath: .status.info.secureEndpoint
name: SecureEndpoint
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11501,6 +11543,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11737,6 +11782,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11829,6 +11877,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -12319,6 +12370,9 @@ spec:
- jsonPath: .status.phase
name: Phase
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
Expand Down
17 changes: 17 additions & 0 deletions pkg/apis/ceph.rook.io/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,12 @@ type CrashCollectorSpec struct {

// CephBlockPool represents a Ceph Storage Pool
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.status.info.type`
// +kubebuilder:printcolumn:name="FailureDomain",type=string,JSONPath=`.status.info.failureDomain`
// +kubebuilder:printcolumn:name="Replication",type=integer,JSONPath=`.spec.replicated.size`,priority=1
// +kubebuilder:printcolumn:name="EC-CodingChunks",type=integer,JSONPath=`.spec.erasureCoded.codingChunks`,priority=1
// +kubebuilder:printcolumn:name="EC-DataChunks",type=integer,JSONPath=`.spec.erasureCoded.dataChunks`,priority=1
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephBlockPool struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -1401,6 +1407,9 @@ type PeerStatSpec struct {

// CephObjectStore represents a Ceph Object Store Gateway
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Endpoint",type=string,JSONPath=`.status.info.endpoint`
// +kubebuilder:printcolumn:name="SecureEndpoint",type=string,JSONPath=`.status.info.secureEndpoint`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephObjectStore struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -1664,6 +1673,7 @@ type ObjectStoreHostingSpec struct {
// CephObjectStoreUser represents a Ceph Object Store Gateway User
// +kubebuilder:resource:shortName=rcou;objectuser
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephObjectStoreUser struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -1841,6 +1851,7 @@ type PullSpec struct {

// CephObjectZoneGroup represents a Ceph Object Store Gateway Zone Group
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephObjectZoneGroup struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -1871,6 +1882,7 @@ type ObjectZoneGroupSpec struct {

// CephObjectZone represents a Ceph Object Store Gateway Zone
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephObjectZone struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -1933,6 +1945,7 @@ type ObjectZoneSpec struct {

// CephBucketTopic represents a Ceph Object Topic for Bucket Notifications
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephBucketTopic struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -2569,6 +2582,7 @@ type DisruptionManagementSpec struct {

// CephClient represents a Ceph Client
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephClient struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -2656,6 +2670,7 @@ type SanitizeDisksSpec struct {

// CephRBDMirror represents a Ceph RBD Mirror
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephRBDMirror struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -2727,6 +2742,7 @@ type MirroringPeerSpec struct {

// CephFilesystemMirror is the Ceph Filesystem Mirror object definition
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephFilesystemMirror struct {
metav1.TypeMeta `json:",inline"`
Expand Down Expand Up @@ -2961,6 +2977,7 @@ type StorageClassDeviceSet struct {

// CephFilesystemSubVolumeGroup represents a Ceph Filesystem SubVolumeGroup
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
// +kubebuilder:subresource:status
type CephFilesystemSubVolumeGroup struct {
metav1.TypeMeta `json:",inline"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/operator/ceph/pool/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile

// The CR was just created, initializing status fields
if cephBlockPool.Status == nil {
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionProgressing, nil, k8sutil.ObservedGenerationNotAvailable)
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionProgressing, k8sutil.ObservedGenerationNotAvailable)
}

// Make sure a CephCluster is present otherwise do nothing
Expand Down Expand Up @@ -287,7 +287,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile
logger.Info(opcontroller.OperatorNotInitializedMessage)
return opcontroller.WaitForRequeueIfOperatorNotInitialized, *cephBlockPool, nil
}
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionFailure, nil, k8sutil.ObservedGenerationNotAvailable)
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionFailure, k8sutil.ObservedGenerationNotAvailable)
return reconcileResponse, *cephBlockPool, errors.Wrapf(err, "failed to create pool %q.", cephBlockPool.GetName())
}

Expand All @@ -302,7 +302,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile
// Always create a bootstrap peer token in case another cluster wants to add us as a peer
reconcileResponse, err = opcontroller.CreateBootstrapPeerSecret(r.context, clusterInfo, cephBlockPool, k8sutil.NewOwnerInfo(cephBlockPool, r.scheme))
if err != nil {
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionFailure, nil, k8sutil.ObservedGenerationNotAvailable)
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionFailure, k8sutil.ObservedGenerationNotAvailable)
return reconcileResponse, *cephBlockPool, errors.Wrapf(err, "failed to create rbd-mirror bootstrap peer for pool %q.", cephBlockPool.GetName())
}

Expand Down Expand Up @@ -334,7 +334,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile

// update ObservedGeneration in status at the end of reconcile
// Set Ready status, we are done reconciling
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionReady, opcontroller.GenerateStatusInfo(cephBlockPool), observedGeneration)
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionReady, observedGeneration)

// If not mirrored there is no Status Info field to fulfil
} else {
Expand All @@ -345,7 +345,7 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile
}
// update ObservedGeneration in status at the end of reconcile
// Set Ready status, we are done reconciling
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionReady, nil, observedGeneration)
updateStatus(r.opManagerContext, r.client, request.NamespacedName, cephv1.ConditionReady, observedGeneration)

// Stop monitoring the mirroring status of this pool
if blockPoolContextsExists && r.blockPoolContexts[blockPoolChannelKey].started {
Expand Down
Loading

0 comments on commit 71b3728

Please sign in to comment.