generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 48
Implement Status Reporting for EtcdCluster #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ballista01
wants to merge
4
commits into
etcd-io:main
Choose a base branch
from
ballista01:etcd-cluster-status
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2775776
controller: add status conditions reporting
ballista01 30a3c85
e2e: record EtcdCluster status history during tests
ballista01 71194f3
fix: correct code comment
ballista01 ba8b561
e2e: keep status recorder alive for full test lifecycle
ballista01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -28,3 +28,6 @@ go.work | |
|
|
||
| # macOS | ||
| .DS_Store | ||
|
|
||
| # CI Artifacts | ||
| artifacts | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -130,6 +130,82 @@ type ProviderCertManagerConfig struct { | |
| type EtcdClusterStatus struct { | ||
| // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
| // Important: Run "make" to regenerate code after modifying this file | ||
|
|
||
| // ObservedGeneration is the most recent generation observed for this EtcdCluster by the controller. | ||
| // +optional | ||
| ObservedGeneration int64 `json:"observedGeneration,omitempty"` | ||
|
|
||
| // CurrentReplicas is the number of etcd pods managed by the StatefulSet for this cluster. | ||
| // This reflects the .spec.replicas of the underlying StatefulSet. | ||
| // +optional | ||
| CurrentReplicas int32 `json:"currentReplicas,omitempty"` | ||
|
|
||
| // ReadyReplicas is the number of etcd pods managed by the StatefulSet that are currently ready. | ||
| // This reflects the .status.readyReplicas of the underlying StatefulSet. | ||
| // +optional | ||
| ReadyReplicas int32 `json:"readyReplicas,omitempty"` | ||
|
|
||
| // MemberCount is the number of members currently registered in the etcd cluster, | ||
| // as reported by the etcd 'member list' API. This may differ from CurrentReplicas | ||
| // during scaling operations or if members are added/removed outside the operator's direct control. | ||
| // +optional | ||
| MemberCount int32 `json:"memberCount,omitempty"` | ||
|
|
||
| // CurrentVersion is the observed etcd version of the cluster. | ||
| // This is typically derived from the version of the healthy leader or a consensus among healthy members. | ||
| // +optional | ||
| CurrentVersion string `json:"currentVersion,omitempty"` | ||
|
|
||
| // LeaderId is the hex-encoded ID of the current etcd cluster leader, if one exists and is known. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what would be the value if there is no known leader? |
||
| // +optional | ||
| LeaderId string `json:"leaderId,omitempty"` | ||
|
|
||
| // TODO: expose LastDefragTime once the controller owns automated defragmentation. | ||
|
|
||
| // Members provides the status of each individual etcd member. | ||
| // +optional | ||
| // +listType=map | ||
| // +listMapKey=id | ||
| // Alternative listMapKey could be 'name' if 'id' is not always immediately available or stable during init. | ||
| // However, 'id' is more canonical once a member is part of the cluster. | ||
| Members []MemberStatus `json:"members,omitempty"` | ||
|
|
||
| // Conditions represent the latest available observations of the EtcdCluster's state. | ||
| // +optional | ||
| // +patchMergeKey=type | ||
| // +patchStrategy=merge | ||
| // +listType=map | ||
| // +listMapKey=type | ||
| Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` | ||
| } | ||
|
|
||
| // MemberStatus defines the observed state of a single etcd member. | ||
| type MemberStatus struct { | ||
| // Name of the etcd member, typically the pod name (e.g., "etcd-cluster-example-0"). | ||
| // This can also be the name reported by etcd itself if set. | ||
| // +optional | ||
| Name string `json:"name,omitempty"` | ||
|
|
||
| // ID is the hex-encoded member ID as reported by etcd. | ||
| // This is the canonical identifier for an etcd member. | ||
| ID string `json:"id"` // Made non-optional as it's key for identification | ||
|
|
||
| // Version of etcd running on this member. | ||
| // +optional | ||
| Version string `json:"version,omitempty"` | ||
|
|
||
| // IsHealthy indicates if the member is considered healthy. | ||
| // A member is healthy if its etcd /health endpoint is reachable and reports OK, | ||
| // and its Status endpoint does not report any 'Errors'. | ||
| IsHealthy bool `json:"isHealthy"` // No omitempty, always show health | ||
|
|
||
| // IsLearner indicates if the member is currently a learner in the etcd cluster. | ||
| // +optional | ||
| IsLearner bool `json:"isLearner,omitempty"` | ||
|
|
||
| // IsLeader indicates if this member is currently the cluster leader. | ||
| // +optional | ||
| IsLeader bool `json:"isLeader,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahrtr @ballista01 was the status API agreed before this implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's agreed in #182