Skip to content

Commit

Permalink
Move prost generation from HashMap to BTreeMap (#48)
Browse files Browse the repository at this point in the history
to match k8s-openapi
  • Loading branch information
clux authored Oct 13, 2024
2 parents f9b2b4d + cdaea7a commit d825f20
Show file tree
Hide file tree
Showing 32 changed files with 178 additions and 166 deletions.
3 changes: 1 addition & 2 deletions k8s-pb-codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ fn main() -> Result<()> {
let tmp_dir = root.join("./tmp");
let descriptor_file = tmp_dir.join("protos.fds");
prost_build::Config::new()
// should probably switch to this
//.btree_map(&["."])
.btree_map(&["."])
.out_dir(&tmp_dir)
.file_descriptor_set_path(&descriptor_file)
.compile_protos(protos.as_slice(), &["protos/"])?;
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/admission/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ pub struct AdmissionResponse {
/// admission webhook name (e.g. imagepolicy.example.com/error=image-blacklisted). AuditAnnotations will be provided by
/// the admission webhook to add additional context to the audit log for this request.
/// +optional
#[prost(map = "string, string", tag = "6")]
#[prost(btree_map = "string, string", tag = "6")]
pub audit_annotations:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// warnings is a list of warning messages to return to the requesting API client.
/// Warning messages describe a problem the client making the API request should correct or be aware of.
/// Limit warnings to 120 characters if possible.
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/admission/v1beta1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ pub struct AdmissionResponse {
/// admission webhook name (e.g. imagepolicy.example.com/error=image-blacklisted). AuditAnnotations will be provided by
/// the admission webhook to add additional context to the audit log for this request.
/// +optional
#[prost(map = "string, string", tag = "6")]
#[prost(btree_map = "string, string", tag = "6")]
pub audit_annotations:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// warnings is a list of warning messages to return to the requesting API client.
/// Warning messages describe a problem the client making the API request should correct or be aware of.
/// Limit warnings to 120 characters if possible.
Expand Down
9 changes: 5 additions & 4 deletions k8s-pb/src/api/apps/v1beta1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ pub struct DeploymentRollback {
pub name: ::core::option::Option<::prost::alloc::string::String>,
/// The annotations to be updated to a deployment
/// +optional
#[prost(map = "string, string", tag = "2")]
#[prost(btree_map = "string, string", tag = "2")]
pub updated_annotations:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// The config of this deployment rollback.
#[prost(message, optional, tag = "3")]
pub rollback_to: ::core::option::Option<RollbackConfig>,
Expand Down Expand Up @@ -309,8 +309,9 @@ pub struct ScaleStatus {
pub replicas: ::core::option::Option<i32>,
/// selector is a label query over pods that should match the replicas count. More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/>
/// +optional
#[prost(map = "string, string", tag = "2")]
pub selector: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(btree_map = "string, string", tag = "2")]
pub selector:
::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// targetSelector is the label selector for pods that should match the replicas count. This is a serializated
/// version of both map-based and more expressive set-based selectors. This is done to
/// avoid introspection in the clients. The string will be in the same format as the
Expand Down
5 changes: 3 additions & 2 deletions k8s-pb/src/api/apps/v1beta2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,9 @@ pub struct ScaleStatus {
/// selector is a label query over pods that should match the replicas count. More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/>
/// +optional
/// +mapType=atomic
#[prost(map = "string, string", tag = "2")]
pub selector: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
#[prost(btree_map = "string, string", tag = "2")]
pub selector:
::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// label selector for pods that should match the replicas count. This is a serializated
/// version of both map-based and more expressive set-based selectors. This is done to
/// avoid introspection in the clients. The string will be in the same format as the
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/authentication/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ pub struct UserInfo {
pub groups: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Any additional information provided by the authenticator.
/// +optional
#[prost(map = "string, message", tag = "4")]
pub extra: ::std::collections::HashMap<::prost::alloc::string::String, ExtraValue>,
#[prost(btree_map = "string, message", tag = "4")]
pub extra: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ExtraValue>,
}

impl crate::Resource for SelfSubjectReview {
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/authentication/v1beta1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ pub struct UserInfo {
pub groups: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Any additional information provided by the authenticator.
/// +optional
#[prost(map = "string, message", tag = "4")]
pub extra: ::std::collections::HashMap<::prost::alloc::string::String, ExtraValue>,
#[prost(btree_map = "string, message", tag = "4")]
pub extra: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ExtraValue>,
}

impl crate::Resource for SelfSubjectReview {
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/authorization/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ pub struct SubjectAccessReviewSpec {
/// Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer
/// it needs a reflection here.
/// +optional
#[prost(map = "string, message", tag = "5")]
pub extra: ::std::collections::HashMap<::prost::alloc::string::String, ExtraValue>,
#[prost(btree_map = "string, message", tag = "5")]
pub extra: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ExtraValue>,
/// UID information about the requesting user.
/// +optional
#[prost(string, optional, tag = "6")]
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/authorization/v1beta1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ pub struct SubjectAccessReviewSpec {
/// Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer
/// it needs a reflection here.
/// +optional
#[prost(map = "string, message", tag = "5")]
pub extra: ::std::collections::HashMap<::prost::alloc::string::String, ExtraValue>,
#[prost(btree_map = "string, message", tag = "5")]
pub extra: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ExtraValue>,
/// UID information about the requesting user.
/// +optional
#[prost(string, optional, tag = "6")]
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/certificates/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ pub struct CertificateSigningRequestSpec {
/// extra contains extra attributes of the user that created the CertificateSigningRequest.
/// Populated by the API server on creation and immutable.
/// +optional
#[prost(map = "string, message", tag = "6")]
pub extra: ::std::collections::HashMap<::prost::alloc::string::String, ExtraValue>,
#[prost(btree_map = "string, message", tag = "6")]
pub extra: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ExtraValue>,
}
/// CertificateSigningRequestStatus contains conditions used to indicate
/// approved/denied/failed status of the request, and the issued certificate.
Expand Down
4 changes: 2 additions & 2 deletions k8s-pb/src/api/certificates/v1beta1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ pub struct CertificateSigningRequestSpec {
/// Extra information about the requesting user.
/// See user.Info interface for details.
/// +optional
#[prost(map = "string, message", tag = "6")]
pub extra: ::std::collections::HashMap<::prost::alloc::string::String, ExtraValue>,
#[prost(btree_map = "string, message", tag = "6")]
pub extra: ::prost::alloc::collections::BTreeMap<::prost::alloc::string::String, ExtraValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CertificateSigningRequestStatus {
Expand Down
Loading

0 comments on commit d825f20

Please sign in to comment.