Skip to content
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

Merged

Conversation

codyjrivera
Copy link
Collaborator

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 the replicas field.

&&& 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()))
Copy link
Collaborator

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()
Copy link
Collaborator

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?

Copy link
Collaborator Author

@codyjrivera codyjrivera Jun 7, 2024

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@marshtompsxd marshtompsxd changed the title Add specification for verified ReplicaSet controller Add liveness specification for VReplicaSet controller Jun 7, 2024
@marshtompsxd marshtompsxd added this pull request to the merge queue Jun 7, 2024
Merged via the queue into anvil-verifier:main with commit b93bd94 Jun 7, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants