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

Enhance validation logic in zk api spec #271

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 VMware, Inc.
// SPDX-License-Identifier: MIT
use crate::external_api::spec::*;
use crate::kubernetes_api_objects::{common::*, dynamic::*};
use crate::kubernetes_api_objects::{common::*, dynamic::*, resource::*, stateful_set::*};
use crate::pervasive_ext::string_view::*;
use crate::zookeeper_controller::common::*;
use vstd::{prelude::*, string::*};
Expand Down Expand Up @@ -134,7 +134,13 @@ pub open spec fn validate(name: StringView, namespace: StringView, port: int, pa
name: name,
};
&&& path.len() > 0
// The stateful set object exists
&&& resources.contains_key(key)
&&& StatefulSetView::from_dynamic_object(resources[key]).is_Ok()
&&& StatefulSetView::from_dynamic_object(resources[key]).get_Ok_0().spec.is_Some()
&&& StatefulSetView::from_dynamic_object(resources[key]).get_Ok_0().spec.get_Some_0().replicas.is_Some()
// and it has at least one replica to handle the request
&&& StatefulSetView::from_dynamic_object(resources[key]).get_Ok_0().spec.get_Some_0().replicas.get_Some_0() > 0
}

// handle_exists models the behavior of the zookeeper server handling the exists request.
Expand Down
Loading