Skip to content
Open
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions crates/common/src/resources/admission_webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct ValidatingWebhookConfiguration {
pub api_version: String,
pub kind: String,
pub metadata: ObjectMeta,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub webhooks: Option<Vec<ValidatingWebhook>>,
}

Expand Down Expand Up @@ -69,7 +69,7 @@ pub struct ValidatingWebhook {
pub admission_review_versions: Vec<String>,

/// MatchConditions are CEL expressions that must be true for the webhook to be called
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub match_conditions: Option<Vec<MatchCondition>>,
}

Expand All @@ -80,7 +80,7 @@ pub struct MutatingWebhookConfiguration {
pub api_version: String,
pub kind: String,
pub metadata: ObjectMeta,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub webhooks: Option<Vec<MutatingWebhook>>,
}

Expand Down Expand Up @@ -135,7 +135,7 @@ pub struct MutatingWebhook {
pub admission_review_versions: Vec<String>,

/// MatchConditions are CEL expressions that must be true for the webhook to be called
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub match_conditions: Option<Vec<MatchCondition>>,

/// ReinvocationPolicy indicates whether this webhook should be called multiple times
Expand Down Expand Up @@ -232,11 +232,11 @@ pub enum ReinvocationPolicy {
#[serde(rename_all = "camelCase")]
pub struct LabelSelector {
/// MatchLabels is a map of {key,value} pairs
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub match_labels: Option<std::collections::HashMap<String, String>>,

/// MatchExpressions is a list of label selector requirements
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub match_expressions: Option<Vec<LabelSelectorRequirement>>,
}

Expand All @@ -251,7 +251,7 @@ pub struct LabelSelectorRequirement {
pub operator: LabelSelectorOperator,

/// Values is an array of string values
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}

Expand Down
8 changes: 4 additions & 4 deletions crates/common/src/resources/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct TokenReviewSpec {
/// verify that the token was intended for at least one of the audiences in
/// this list. If no audiences are provided, the audience will default to the
/// audience of the Kubernetes apiserver.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audiences: Option<Vec<String>>,

/// Token is the opaque bearer token.
Expand All @@ -57,7 +57,7 @@ pub struct TokenReviewStatus {
/// spec.audiences field should validate that a compatible audience identifier
/// is returned in the status.audiences field to ensure that the TokenReview
/// server is audience aware.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audiences: Option<Vec<String>>,

/// Authenticated indicates that the token was associated with a known user.
Expand All @@ -78,11 +78,11 @@ pub struct TokenReviewStatus {
#[serde(rename_all = "camelCase")]
pub struct UserInfo {
/// Any additional information provided by the authenticator.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extra: Option<HashMap<String, Vec<String>>>,

/// The names of groups this user is a part of.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<String>>,

/// A unique value that identifies this user across time. If this user is
Expand Down
24 changes: 14 additions & 10 deletions crates/common/src/resources/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ fn default_kind_subject_access_review() -> String {
#[serde(rename_all = "camelCase")]
pub struct SubjectAccessReviewSpec {
/// Extra corresponds to the user.Info.GetExtra() method from the authenticator.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extra: Option<HashMap<String, Vec<String>>>,

/// Groups is the groups you're testing for.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<String>>,

/// NonResourceAttributes describes information for a non-resource access request.
Expand Down Expand Up @@ -121,7 +121,7 @@ pub struct FieldSelectorAttributes {
pub raw_selector: Option<String>,

/// Requirements is the parsed interpretation of a field selector.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub requirements: Option<Vec<FieldSelectorRequirement>>,
}

Expand All @@ -136,7 +136,7 @@ pub struct FieldSelectorRequirement {
pub operator: String,

/// Values is an array of string values.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}

Expand All @@ -149,7 +149,7 @@ pub struct LabelSelectorAttributes {
pub raw_selector: Option<String>,

/// Requirements is the parsed interpretation of a label selector.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub requirements: Option<Vec<LabelSelectorRequirement>>,
}

Expand All @@ -164,7 +164,7 @@ pub struct LabelSelectorRequirement {
pub operator: String,

/// Values is an array of string values.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub values: Option<Vec<String>>,
}

Expand Down Expand Up @@ -312,7 +312,11 @@ pub struct SubjectRulesReviewStatus {
#[serde(rename_all = "camelCase")]
pub struct NonResourceRule {
/// NonResourceURLs is a set of partial urls that a user should have access to.
#[serde(rename = "nonResourceURLs", skip_serializing_if = "Option::is_none")]
#[serde(
rename = "nonResourceURLs",
default,
skip_serializing_if = "Option::is_none"
)]
pub non_resource_urls: Option<Vec<String>>,

/// Verb is a list of kubernetes non-resource API verbs.
Expand All @@ -324,15 +328,15 @@ pub struct NonResourceRule {
#[serde(rename_all = "camelCase")]
pub struct ResourceRule {
/// APIGroups is the name of the APIGroup that contains the resources.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub api_groups: Option<Vec<String>>,

/// ResourceNames is an optional white list of names that the rule applies to.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub resource_names: Option<Vec<String>>,

/// Resources is a list of resources this rule applies to.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub resources: Option<Vec<String>>,

/// Verb is a list of kubernetes resource API verbs.
Expand Down
28 changes: 14 additions & 14 deletions crates/common/src/resources/autoscaling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct HorizontalPodAutoscalerSpec {
pub max_replicas: i32,

/// Metrics to use for scaling decisions
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub metrics: Option<Vec<MetricSpec>>,

/// Behavior configures the scaling behavior (v2 API)
Expand Down Expand Up @@ -221,7 +221,7 @@ pub struct HPAScalingRules {
pub select_policy: Option<String>,

/// Policies is a list of potential scaling policies
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub policies: Option<Vec<HPAScalingPolicy>>,

#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -262,11 +262,11 @@ pub struct HorizontalPodAutoscalerStatus {
pub desired_replicas: i32,

/// Current metric values
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub current_metrics: Option<Vec<MetricStatus>>,

/// Conditions describe the current state of the autoscaler
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<HorizontalPodAutoscalerCondition>>,
}

Expand Down Expand Up @@ -450,7 +450,7 @@ pub struct VerticalPodAutoscalerSpec {
pub resource_policy: Option<PodResourcePolicy>,

/// Recommenders lists the names of vertical pod autoscaler recommenders to use
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub recommenders: Option<Vec<VerticalPodAutoscalerRecommenderSelector>>,
}

Expand All @@ -468,7 +468,7 @@ pub struct PodUpdatePolicy {
#[serde(rename_all = "camelCase")]
pub struct PodResourcePolicy {
/// Per-container resource policies
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub container_policies: Option<Vec<ContainerResourcePolicy>>,
}

Expand All @@ -485,15 +485,15 @@ pub struct ContainerResourcePolicy {
pub mode: Option<String>,

/// MinAllowed specifies the minimum resource amounts
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub min_allowed: Option<std::collections::HashMap<String, String>>,

/// MaxAllowed specifies the maximum resource amounts
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub max_allowed: Option<std::collections::HashMap<String, String>>,

/// ControlledResources specifies which resource types are controlled (cpu, memory)
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub controlled_resources: Option<Vec<String>>,
}

Expand All @@ -514,7 +514,7 @@ pub struct VerticalPodAutoscalerStatus {
pub recommendation: Option<RecommendedPodResources>,

/// Conditions describe the current state of the VPA
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<VerticalPodAutoscalerCondition>>,
}

Expand All @@ -523,7 +523,7 @@ pub struct VerticalPodAutoscalerStatus {
#[serde(rename_all = "camelCase")]
pub struct RecommendedPodResources {
/// Recommended resources for each container
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub container_recommendations: Option<Vec<RecommendedContainerResources>>,
}

Expand All @@ -538,15 +538,15 @@ pub struct RecommendedContainerResources {
pub target: std::collections::HashMap<String, String>,

/// Lower bound on resource amounts
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub lower_bound: Option<std::collections::HashMap<String, String>>,

/// Upper bound on resource amounts
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub upper_bound: Option<std::collections::HashMap<String, String>>,

/// Uncapped target resource amounts (without limits)
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub uncapped_target: Option<std::collections::HashMap<String, String>>,
}

Expand Down
6 changes: 3 additions & 3 deletions crates/common/src/resources/certificates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ pub struct CertificateSigningRequestSpec {
pub uid: Option<String>,

/// groups contains group membership of the user that created the CertificateSigningRequest
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub groups: Option<Vec<String>>,

/// extra contains extra attributes of the user that created the CertificateSigningRequest
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub extra: Option<HashMap<String, Vec<String>>>,
}

Expand Down Expand Up @@ -117,7 +117,7 @@ pub enum KeyUsage {
#[serde(rename_all = "camelCase")]
pub struct CertificateSigningRequestStatus {
/// conditions applied to the request
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<CertificateSigningRequestCondition>>,

/// certificate is populated with an issued certificate
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/resources/componentstatus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct ComponentStatus {
pub metadata: ObjectMeta,

/// Conditions holds the status of the component
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub conditions: Option<Vec<ComponentCondition>>,
}

Expand Down
12 changes: 6 additions & 6 deletions crates/common/src/resources/csi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub struct CSIDriverSpec {
pub storage_capacity: Option<bool>,

/// volumeLifecycleModes defines what kind of volumes this CSI volume driver supports
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub volume_lifecycle_modes: Option<Vec<VolumeLifecycleMode>>,

/// tokenRequests indicates the CSI driver needs service account tokens
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub token_requests: Option<Vec<TokenRequest>>,

/// requiresRepublish indicates the CSI driver wants NodePublishVolume to be periodically called
Expand Down Expand Up @@ -107,7 +107,7 @@ pub struct CSINodeDriver {
pub node_id: String,

/// topologyKeys is the list of keys supported by the driver
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub topology_keys: Option<Vec<String>>,

/// allocatable represents the volume resources of a node that are available for scheduling
Expand Down Expand Up @@ -188,7 +188,7 @@ pub struct CSIVolumeSource {
pub fs_type: Option<String>,

/// volumeAttributes of the volume to publish
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub volume_attributes: Option<HashMap<String, String>>,

/// nodePublishSecretRef is a reference to the secret object containing sensitive information
Expand All @@ -203,7 +203,7 @@ pub struct VolumeAttachmentStatus {
pub attached: bool,

/// attachmentMetadata is populated with any information returned by the attach operation
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub attachment_metadata: Option<HashMap<String, String>>,

/// attachError represents the last error encountered during attach operation
Expand Down Expand Up @@ -263,7 +263,7 @@ pub struct VolumeAttributesClass {
pub driver_name: String,

/// parameters hold volume attributes defined by the CSI driver
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub parameters: Option<HashMap<String, String>>,
}

Expand Down
10 changes: 7 additions & 3 deletions crates/common/src/resources/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ impl Endpoints {
#[serde(rename_all = "camelCase")]
pub struct EndpointSubset {
/// IP addresses which offer the related ports that are marked as ready.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub addresses: Option<Vec<EndpointAddress>>,

/// IP addresses which offer the related ports but are not currently marked as ready.
#[serde(skip_serializing_if = "Option::is_none", rename = "notReadyAddresses")]
#[serde(
rename = "notReadyAddresses",
default,
skip_serializing_if = "Option::is_none"
)]
pub not_ready_addresses: Option<Vec<EndpointAddress>>,

/// Port numbers available on the related IP addresses.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ports: Option<Vec<EndpointPort>>,
}

Expand Down
Loading