-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prove key invariants for VReplicaSet possibly involving PodEvent (#549)
The following invariants have been proven: `every_create_matching_pod_request_implies_at_after_create_pod_step` `every_delete_matching_pod_request_implies_at_after_delete_pod_step` (partially). Investigating the latter led to addition of delete preconditions to the V2 state machine to which the controller will be ported. --------- Signed-off-by: Cody Rivera <[email protected]>
- Loading branch information
1 parent
51332cf
commit 19ab8fc
Showing
8 changed files
with
366 additions
and
4 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
264 changes: 262 additions & 2 deletions
264
src/controller_examples/v_replica_set_controller/proof/helper_invariants/proof.rs
Large diffs are not rendered by default.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
pub mod helper_invariants; | ||
pub mod liveness; | ||
pub mod predicate; | ||
pub mod utility_lemmas; |
52 changes: 52 additions & 0 deletions
52
src/controller_examples/v_replica_set_controller/proof/utility_lemmas.rs
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2022 VMware, Inc. | ||
// SPDX-License-Identifier: MIT | ||
#![allow(unused_imports)] | ||
use crate::kubernetes_api_objects::spec::{ | ||
api_method::*, common::*, prelude::*, resource::*, stateful_set::*, | ||
}; | ||
use crate::kubernetes_cluster::proof::controller_runtime::*; | ||
use crate::kubernetes_cluster::spec::{ | ||
cluster::*, | ||
cluster_state_machine::Step, | ||
controller::types::{ControllerActionInput, ControllerStep}, | ||
message::*, | ||
}; | ||
use crate::temporal_logic::defs::*; | ||
use crate::v_replica_set_controller::model::{reconciler::*}; | ||
use crate::v_replica_set_controller::trusted::{ | ||
liveness_theorem::*, spec_types::*, step::*, | ||
}; | ||
use crate::v_replica_set_controller::proof::{ | ||
predicate::*, | ||
}; | ||
use vstd::{prelude::*, math::abs}; | ||
|
||
verus! { | ||
|
||
#[verifier(external_body)] | ||
pub proof fn lemma_filtered_pods_set_equals_matching_pods( | ||
s: VRSCluster, vrs: VReplicaSetView, resp_msg: VRSMessage | ||
) | ||
ensures | ||
({ | ||
let objs = resp_msg.content.get_list_response().res.unwrap(); | ||
let pods_or_none = objects_to_pods(objs); | ||
let pods = pods_or_none.unwrap(); | ||
let filtered_pods = filter_pods(pods, vrs); | ||
&&& filtered_pods.no_duplicates() | ||
&&& filtered_pods.len() == matching_pod_entries(vrs, s.resources()).len() | ||
&&& filtered_pods.map_values(|p: PodView| p.marshal()).to_set() == matching_pod_entries(vrs, s.resources()).values() | ||
}), | ||
{} | ||
// | ||
// TODO: Prove this. | ||
// | ||
// filter_pods filters pods in a very similar way to matching_pods, but the former | ||
// works on a sequence of PodViews, while the latter works on the key-value store directly. | ||
// I need to do some manual effort to make the two representations work together. | ||
// | ||
// Once proven, this will supplant the earlier lemma | ||
// lemma_filtered_pods_len_equals_matching_pods_len. | ||
// | ||
|
||
} |
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