-
Notifications
You must be signed in to change notification settings - Fork 27
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
Proposal: Using Finite State Machine library to expose state diagram for configuration applied transitions #210
Conversation
a9365b3
to
1986f7f
Compare
68614bf
to
f7114dc
Compare
f7114dc
to
a688a82
Compare
cc0d5eb
to
2984b58
Compare
4655534
to
fb65a38
Compare
…nd OutOfDate to Completed
2f815fe
to
2534121
Compare
/lgtm |
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.
Although it's a nice use of fsm, i dont know if the concept of finite statement machine is compatible with the notion of k8s controller? Meaning operators are meant to be "level based", i.e look at the state of the cluster at every requeue until we reach desired state vs "edge-based" where we are relying to history stored in status.
Api convention doc specifically says .status
should not be used for state machines.
lots of great doc on this:
- https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md
- https://book.kubebuilder.io
Since this is totally new pattern we are introducing (I couldnt find any reference of fsm lib in operators anywhere), at the very least this should be better documented for anyone coming to develop this in the future?
The State diagram of the configuration state machine is generated below in dot format. | ||
A Link to the rendered diagram is at: [link](https://dreampuf.github.io/GraphvizOnline/?presentation#digraph%20%7B%0A%09compound=true%3B%0A%09node%20%5Bshape=Mrecord%5D%3B%0A%09rankdir=%22LR%22%3B%0A%0A%09ClusterNotReady%20%5Blabel=%22ClusterNotReady%7Centry%20%2F%20func2%22%5D%3B%0A%09Completed%20%5Blabel=%22Completed%7Centry%20%2F%20func5%22%5D%3B%0A%09InProgress%20%5Blabel=%22InProgress%7Centry%20%2F%20func3%22%5D%3B%0A%09Missing%20%5Blabel=%22Missing%7Centry%20%2F%20func1%22%5D%3B%0A%09OutOfDate%20%5Blabel=%22OutOfDate%7Centry%20%2F%20func4%22%5D%3B%0A%09Start%20%5Blabel=%22Start%22%5D%3B%0A%09TimedOut%20%5Blabel=%22TimedOut%7Centry%20%2F%20func6%22%5D%3B%0A%09ClusterNotReady%20-%3E%20ClusterNotReady%20%5Blabel=%22ClusterNotReady->%3BClusterNotReady%22%5D%3B%0A%09ClusterNotReady%20-%3E%20InProgress%20%5Blabel=%22ClusterNotReady->%3BInProgress%22%5D%3B%0A%09ClusterNotReady%20-%3E%20Missing%20%5Blabel=%22ClusterNotReady->%3BMissing%22%5D%3B%0A%09Completed%20-%3E%20Completed%20%5Blabel=%22Completed->%3BCompleted%22%5D%3B%0A%09Completed%20-%3E%20InProgress%20%5Blabel=%22Completed->%3BInProgress%22%5D%3B%0A%09InProgress%20-%3E%20ClusterNotReady%20%5Blabel=%22InProgress->%3BClusterNotReady%22%5D%3B%0A%09InProgress%20-%3E%20Completed%20%5Blabel=%22InProgress->%3BCompleted%22%5D%3B%0A%09InProgress%20-%3E%20InProgress%20%5Blabel=%22InProgress->%3BInProgress%22%5D%3B%0A%09InProgress%20-%3E%20OutOfDate%20%5Blabel=%22InProgress->%3BOutOfDate%22%5D%3B%0A%09InProgress%20-%3E%20TimedOut%20%5Blabel=%22InProgress->%3BTimedOut%22%5D%3B%0A%09Missing%20-%3E%20ClusterNotReady%20%5Blabel=%22Missing->%3BClusterNotReady%22%5D%3B%0A%09Missing%20-%3E%20Missing%20%5Blabel=%22Missing->%3BMissing%22%5D%3B%0A%09OutOfDate%20-%3E%20InProgress%20%5Blabel=%22OutOfDate->%3BInProgress%22%5D%3B%0A%09OutOfDate%20-%3E%20OutOfDate%20%5Blabel=%22OutOfDate->%3BOutOfDate%22%5D%3B%0A%09Start%20-%3E%20Missing%20%5Blabel=%22Start->%3BMissing%22%5D%3B%0A%09TimedOut%20-%3E%20InProgress%20%5Blabel=%22TimedOut->%3BInProgress%22%5D%3B%0A%09TimedOut%20-%3E%20TimedOut%20%5Blabel=%22TimedOut->%3BTimedOut%22%5D%3B%0A%09init%20%5Blabel=%22%22%2C%20shape=point%5D%3B%0A%09init%20-%3E%20Start%0A%7D%0A) | ||
``` | ||
digraph { |
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.
Would it be possible generate this using make generate
by sm.ToGraph()
as mentioned here
Also since this generated...would it be nicer to move this under say docs/generated/clusterrequest-fsm
to reflect the content better?
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Closing this PR for now, does not follow the no state/machine recommendation for operator. Should recompute the state from information available in the cluster. This follow up PR is attempting to do this: #246 |
Proposing to use https://github.com/qmuntal/stateless to expose the implicit state diagram used for The configuration applied status
The fsm_test.go tests the state machine transitions independently from kubenetes.
The ci-job process updates the state diagram in documentation (dev/config_fsm.mg link)
TODO:
Unit testsadd CGO in prow for creating SVG in docssystem test - retesting