-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add liveness specification for VReplicaSet controller #497
Add liveness specification for VReplicaSet controller #497
Conversation
Signed-off-by: Cody Rivera <[email protected]>
Signed-off-by: Cody Rivera <[email protected]>
Signed-off-by: Cody Rivera <[email protected]>
Signed-off-by: Cody Rivera <[email protected]>
&&& resources.contains_key(key) | ||
&&& obj.kind == PodView::kind() | ||
&&& obj.metadata.owner_references_contains(vrs.controller_owner_ref()) | ||
&&& vrs.spec.selector.matches(obj.metadata.labels.unwrap_or(Map::empty())) |
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.
@codyjrivera could you add one more line here
&&& obj.metadata.deletion_timestamp.is_None()
Basically we only want to count the pods that are NOT in terminating state.
See the new commit I just added today: 0f03d84
|
||
pub open spec fn resource_state_matches(vrs: VReplicaSetView, resources: StoredState) -> bool { | ||
let pods: Set<ObjectRef> = Set::new(|k: ObjectRef| owned_selector_match_is(vrs, resources, k)); | ||
&&& pods.finite() |
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.
Just curious: do we need this line since we have the next line that talks about the length of the pods?
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.
The file https://github.com/verus-lang/verus/blob/main/source/vstd/set.rs says that len
is only meaningful when the set is finite: infinite sets are allowed. Also it can't return anything like -1 to represent an infinite set.
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.
OK
Signed-off-by: Cody Rivera <[email protected]>
Here I state a basic liveness theorem, based on Eventually Stable Reconciliation, for ReplicaSets. To check whether the cluster state matches the spec, I gather up all pods that match the label selector
selector
and are owned by the ReplicaSet into a Verus set. I then check whether the cardinality of that set is equal to thereplicas
field.