-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update describe for status field
- Loading branch information
Showing
5 changed files
with
99 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,35 +110,44 @@ const ( | |
) | ||
|
||
type Condition struct { | ||
Type ConditionType `json:"type"` | ||
Status corev1.ConditionStatus `json:"status"` | ||
LastUpdateTime string `json:"lastUpdateTime,omitempty"` | ||
LastUpdateAt metav1.Time `json:"-"` | ||
LastTransitionTime string `json:"lastTransitionTime,omitempty"` | ||
// Status of cluster condition. | ||
Type ConditionType `json:"type"` | ||
// Status of the condition, one of True, False, Unknown. | ||
Status corev1.ConditionStatus `json:"status"` | ||
// The reason for the condition's last transition. | ||
Reason string `json:"reason,omitempty"` | ||
// A human readable message indicating details about the transition. | ||
Message string `json:"message,omitempty"` | ||
// Last time the condition transitioned from one status to another. | ||
LastTransitionTime string `json:"lastTransitionTime,omitempty"` | ||
// The last time this condition was updated. | ||
LastUpdateTime string `json:"lastUpdateTime,omitempty"` | ||
LastUpdateAt metav1.Time `json:"-"` | ||
} | ||
|
||
type EMQXNodeStatus struct { | ||
Node string `json:"node,omitempty"` | ||
type EmqxNode struct { | ||
// EMQX node name, example: [email protected] | ||
Node string `json:"node,omitempty"` | ||
// EMQX node status, example: Running | ||
NodeStatus string `json:"node_status,omitempty"` | ||
// Erlang/OTP version used by EMQX, example: 24.2/12.2 | ||
OTPRelease string `json:"otp_release,omitempty"` | ||
Version string `json:"version,omitempty"` | ||
Role string `json:"role,omitempty"` | ||
// EMQX version | ||
Version string `json:"version,omitempty"` | ||
// EMQX cluster node role | ||
Role string `json:"role,omitempty"` | ||
} | ||
|
||
// EMQXStatus defines the observed state of EMQX | ||
type EMQXStatus struct { | ||
CurrentImage string `json:"currentImage,omitempty"` | ||
OriginalImage string `json:"originalImage,omitempty"` | ||
CoreReplicas int32 `json:"coreReplicas,omitempty"` | ||
ReadyCoreReplicas int32 `json:"readyCoreReplicas,omitempty"` | ||
ReplicantReplicas int32 `json:"replicantReplicas,omitempty"` | ||
ReadyReplicantReplicas int32 `json:"readyReplicantReplicas,omitempty"` | ||
NodeStatuses []EMQXNodeStatus `json:"nodes,omitempty"` | ||
Conditions []Condition `json:"conditions,omitempty"` | ||
CurrentImage string `json:"currentImage,omitempty"` | ||
OriginalImage string `json:"originalImage,omitempty"` | ||
CoreReplicas int32 `json:"coreReplicas,omitempty"` | ||
ReadyCoreReplicas int32 `json:"readyCoreReplicas,omitempty"` | ||
ReplicantReplicas int32 `json:"replicantReplicas,omitempty"` | ||
ReadyReplicantReplicas int32 `json:"readyReplicantReplicas,omitempty"` | ||
EmqxNodes []EmqxNode `json:"emqxNodes,omitempty"` | ||
Conditions []Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
@@ -192,9 +201,11 @@ func (s *EMQXStatus) IsCoreUpdating() bool { | |
} | ||
|
||
func (s *EMQXStatus) IsRunning() bool { | ||
cond := s.Conditions[0] | ||
if cond.Type == ClusterRunning && cond.Status == corev1.ConditionTrue { | ||
return true | ||
if len(s.Conditions) > 0 { | ||
cond := s.Conditions[0] | ||
if cond.Type == ClusterRunning && cond.Status == corev1.ConditionTrue { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13199,8 +13199,11 @@ spec: | |
items: | ||
properties: | ||
lastTransitionTime: | ||
description: Last time the condition transitioned from one status | ||
to another. | ||
type: string | ||
lastUpdateTime: | ||
description: The last time this condition was updated. | ||
type: string | ||
message: | ||
description: A human readable message indicating details about | ||
|
@@ -13210,8 +13213,10 @@ spec: | |
description: The reason for the condition's last transition. | ||
type: string | ||
status: | ||
description: Status of the condition, one of True, False, Unknown. | ||
type: string | ||
type: | ||
description: Status of cluster condition. | ||
type: string | ||
required: | ||
- status | ||
|
@@ -13223,18 +13228,23 @@ spec: | |
type: integer | ||
currentImage: | ||
type: string | ||
nodes: | ||
emqxNodes: | ||
items: | ||
properties: | ||
node: | ||
description: 'EMQX node name, example: [email protected]' | ||
type: string | ||
node_status: | ||
description: 'EMQX node status, example: Running' | ||
type: string | ||
otp_release: | ||
description: 'Erlang/OTP version used by EMQX, example: 24.2/12.2' | ||
type: string | ||
role: | ||
description: EMQX cluster node role | ||
type: string | ||
version: | ||
description: EMQX version | ||
type: string | ||
type: object | ||
type: array | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters