diff --git a/crates/common/src/resources/admission_webhook.rs b/crates/common/src/resources/admission_webhook.rs index 24471fe4..e9053f01 100644 --- a/crates/common/src/resources/admission_webhook.rs +++ b/crates/common/src/resources/admission_webhook.rs @@ -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>, } @@ -69,7 +69,7 @@ pub struct ValidatingWebhook { pub admission_review_versions: Vec, /// 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>, } @@ -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>, } @@ -135,7 +135,7 @@ pub struct MutatingWebhook { pub admission_review_versions: Vec, /// 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>, /// ReinvocationPolicy indicates whether this webhook should be called multiple times @@ -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>, /// 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>, } @@ -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>, } diff --git a/crates/common/src/resources/authentication.rs b/crates/common/src/resources/authentication.rs index abb1945b..bb00733e 100644 --- a/crates/common/src/resources/authentication.rs +++ b/crates/common/src/resources/authentication.rs @@ -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>, /// Token is the opaque bearer token. @@ -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>, /// Authenticated indicates that the token was associated with a known user. @@ -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>>, /// 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>, /// A unique value that identifies this user across time. If this user is diff --git a/crates/common/src/resources/authorization.rs b/crates/common/src/resources/authorization.rs index 70dcf0c3..f46a0164 100644 --- a/crates/common/src/resources/authorization.rs +++ b/crates/common/src/resources/authorization.rs @@ -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>>, /// 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>, /// NonResourceAttributes describes information for a non-resource access request. @@ -121,7 +121,7 @@ pub struct FieldSelectorAttributes { pub raw_selector: Option, /// 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>, } @@ -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>, } @@ -149,7 +149,7 @@ pub struct LabelSelectorAttributes { pub raw_selector: Option, /// 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>, } @@ -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>, } @@ -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>, /// Verb is a list of kubernetes non-resource API verbs. @@ -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>, /// 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>, /// 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>, /// Verb is a list of kubernetes resource API verbs. diff --git a/crates/common/src/resources/autoscaling.rs b/crates/common/src/resources/autoscaling.rs index e876cf58..f76fc675 100644 --- a/crates/common/src/resources/autoscaling.rs +++ b/crates/common/src/resources/autoscaling.rs @@ -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>, /// Behavior configures the scaling behavior (v2 API) @@ -221,7 +221,7 @@ pub struct HPAScalingRules { pub select_policy: Option, /// 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>, #[serde(skip_serializing_if = "Option::is_none")] @@ -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>, /// 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>, } @@ -450,7 +450,7 @@ pub struct VerticalPodAutoscalerSpec { pub resource_policy: Option, /// 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>, } @@ -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>, } @@ -485,15 +485,15 @@ pub struct ContainerResourcePolicy { pub mode: Option, /// 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>, /// 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>, /// 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>, } @@ -514,7 +514,7 @@ pub struct VerticalPodAutoscalerStatus { pub recommendation: Option, /// 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>, } @@ -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>, } @@ -538,15 +538,15 @@ pub struct RecommendedContainerResources { pub target: std::collections::HashMap, /// Lower bound on resource amounts - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub lower_bound: Option>, /// Upper bound on resource amounts - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub upper_bound: Option>, /// 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>, } diff --git a/crates/common/src/resources/certificates.rs b/crates/common/src/resources/certificates.rs index 1530600d..e603b62a 100644 --- a/crates/common/src/resources/certificates.rs +++ b/crates/common/src/resources/certificates.rs @@ -54,11 +54,11 @@ pub struct CertificateSigningRequestSpec { pub uid: Option, /// 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>, /// 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>>, } @@ -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>, /// certificate is populated with an issued certificate diff --git a/crates/common/src/resources/componentstatus.rs b/crates/common/src/resources/componentstatus.rs index 546d397b..23788ec9 100644 --- a/crates/common/src/resources/componentstatus.rs +++ b/crates/common/src/resources/componentstatus.rs @@ -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>, } diff --git a/crates/common/src/resources/csi.rs b/crates/common/src/resources/csi.rs index 5389c899..9bcec2fb 100644 --- a/crates/common/src/resources/csi.rs +++ b/crates/common/src/resources/csi.rs @@ -34,11 +34,11 @@ pub struct CSIDriverSpec { pub storage_capacity: Option, /// 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>, /// 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>, /// requiresRepublish indicates the CSI driver wants NodePublishVolume to be periodically called @@ -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>, /// allocatable represents the volume resources of a node that are available for scheduling @@ -188,7 +188,7 @@ pub struct CSIVolumeSource { pub fs_type: Option, /// 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>, /// nodePublishSecretRef is a reference to the secret object containing sensitive information @@ -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>, /// attachError represents the last error encountered during attach operation @@ -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>, } diff --git a/crates/common/src/resources/endpoints.rs b/crates/common/src/resources/endpoints.rs index e6a4bd18..83c48f53 100644 --- a/crates/common/src/resources/endpoints.rs +++ b/crates/common/src/resources/endpoints.rs @@ -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>, /// 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>, /// 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>, } diff --git a/crates/common/src/resources/endpointslice.rs b/crates/common/src/resources/endpointslice.rs index fc79c16d..91edc441 100644 --- a/crates/common/src/resources/endpointslice.rs +++ b/crates/common/src/resources/endpointslice.rs @@ -205,7 +205,11 @@ pub struct Endpoint { pub hints: Option, /// deprecatedTopology is deprecated and has been replaced by the zone and hints fields. - #[serde(skip_serializing_if = "Option::is_none", rename = "deprecatedTopology")] + #[serde( + rename = "deprecatedTopology", + default, + skip_serializing_if = "Option::is_none" + )] pub deprecated_topology: Option>, } @@ -281,10 +285,10 @@ pub struct EndpointReference { #[serde(rename_all = "camelCase")] pub struct EndpointHints { /// forZones indicates the zone(s) this endpoint should be consumed by to enable topology aware routing. - #[serde(skip_serializing_if = "Option::is_none", rename = "forZones")] + #[serde(rename = "forZones", default, skip_serializing_if = "Option::is_none")] pub for_zones: Option>, - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub for_nodes: Option>, } diff --git a/crates/common/src/resources/flowcontrol.rs b/crates/common/src/resources/flowcontrol.rs index d9236d82..1c112347 100644 --- a/crates/common/src/resources/flowcontrol.rs +++ b/crates/common/src/resources/flowcontrol.rs @@ -88,7 +88,7 @@ pub struct ExemptPriorityLevelConfiguration { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PriorityLevelConfigurationStatus { - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub conditions: Option>, } @@ -135,7 +135,7 @@ pub struct FlowSchemaSpec { pub matching_precedence: i32, #[serde(skip_serializing_if = "Option::is_none")] pub distinguisher_method: Option, - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub rules: Option>, } @@ -162,9 +162,9 @@ pub enum FlowDistinguisherMethodType { #[serde(rename_all = "camelCase")] pub struct PolicyRulesWithSubjects { pub subjects: Vec, - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub resource_rules: Option>, - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub non_resource_rules: Option>, } @@ -214,7 +214,7 @@ pub struct ResourcePolicyRule { pub resources: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub cluster_scope: Option, - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub namespaces: Option>, } @@ -229,7 +229,7 @@ pub struct NonResourcePolicyRule { #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct FlowSchemaStatus { - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub conditions: Option>, } diff --git a/crates/common/src/resources/ingress.rs b/crates/common/src/resources/ingress.rs index d315f5a6..47679a93 100644 --- a/crates/common/src/resources/ingress.rs +++ b/crates/common/src/resources/ingress.rs @@ -49,11 +49,11 @@ pub struct IngressSpec { pub default_backend: Option, /// List of TLS configurations - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub tls: Option>, /// List of host rules - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub rules: Option>, } @@ -62,7 +62,7 @@ pub struct IngressSpec { #[serde(rename_all = "camelCase")] pub struct IngressTLS { /// Hosts are a list of hosts included in the TLS certificate - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub hosts: Option>, /// SecretName is the name of the secret used to terminate TLS traffic @@ -160,7 +160,7 @@ pub struct IngressStatus { #[serde(rename_all = "camelCase")] pub struct IngressLoadBalancerStatus { /// Ingress is a list containing ingress points for the load-balancer - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub ingress: Option>, } @@ -177,7 +177,7 @@ pub struct IngressLoadBalancerIngress { pub hostname: Option, /// Ports provide information about the ports exposed by the load-balancer - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub ports: Option>, } diff --git a/crates/common/src/resources/networking.rs b/crates/common/src/resources/networking.rs index a6fa1a40..cbb0c421 100644 --- a/crates/common/src/resources/networking.rs +++ b/crates/common/src/resources/networking.rs @@ -38,15 +38,15 @@ pub struct NetworkPolicySpec { pub pod_selector: LabelSelector, /// List of ingress rules to be applied - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub ingress: Option>, /// List of egress rules to be applied - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub egress: Option>, /// List of policy types that the NetworkPolicy relates to - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub policy_types: Option>, // "Ingress", "Egress" } @@ -55,11 +55,11 @@ pub struct NetworkPolicySpec { #[serde(rename_all = "camelCase")] pub struct NetworkPolicyIngressRule { /// List of ports which should be made accessible - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub ports: Option>, /// List of sources which should be able to access the pods - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub from: Option>, } @@ -68,11 +68,11 @@ pub struct NetworkPolicyIngressRule { #[serde(rename_all = "camelCase")] pub struct NetworkPolicyEgressRule { /// List of destination ports for outgoing traffic - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub ports: Option>, /// List of destinations for outgoing traffic of pods selected for this rule - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub to: Option>, } @@ -118,6 +118,6 @@ pub struct IPBlock { pub cidr: String, /// Except is a slice of CIDRs that should not be included within an IP Block - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub except: Option>, } diff --git a/crates/common/src/resources/policy.rs b/crates/common/src/resources/policy.rs index 19cbde38..20db8400 100644 --- a/crates/common/src/resources/policy.rs +++ b/crates/common/src/resources/policy.rs @@ -41,11 +41,11 @@ impl ResourceQuota { #[serde(rename_all = "camelCase")] pub struct ResourceQuotaSpec { /// Hard is the set of desired hard limits for each named resource - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub hard: Option>, /// A collection of filters that must match each object tracked by a quota - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub scopes: Option>, /// ScopeSelector is also a collection of filters like scopes that must match each object @@ -72,7 +72,7 @@ pub struct ScopedResourceSelectorRequirement { pub operator: String, /// An array of string values - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub values: Option>, } @@ -81,11 +81,11 @@ pub struct ScopedResourceSelectorRequirement { #[serde(rename_all = "camelCase")] pub struct ResourceQuotaStatus { /// Hard is the set of enforced hard limits for each named resource - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub hard: Option>, /// Used is the current observed total usage of the resource in the namespace - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub used: Option>, } @@ -136,23 +136,23 @@ pub struct LimitRangeItem { pub item_type: String, /// Max usage constraints on this kind by resource name - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub max: Option>, /// Min usage constraints on this kind by resource name - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub min: Option>, /// Default resource requirement limit value by resource name if not specified - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub default: Option>, /// DefaultRequest is the default resource requirement request value by resource name if not specified - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub default_request: Option>, /// MaxLimitRequestRatio represents the max burst value for the named resource - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub max_limit_request_ratio: Option>, } @@ -312,7 +312,7 @@ pub struct PodDisruptionBudgetStatus { pub observed_generation: Option, /// Conditions contain the latest available observations of the PDB's state - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub conditions: Option>, /// DisruptedPods contains information about pods whose eviction was @@ -322,7 +322,7 @@ pub struct PodDisruptionBudgetStatus { /// eviction request to the time when the pod is seen by PDB controller /// as having been marked for deletion (or after a timeout). The key in the map is the name of the pod /// and the value is the time when the API server processed the eviction request. - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub disrupted_pods: Option>>, } diff --git a/crates/common/src/resources/rbac.rs b/crates/common/src/resources/rbac.rs index 6e664aca..523d9cf1 100644 --- a/crates/common/src/resources/rbac.rs +++ b/crates/common/src/resources/rbac.rs @@ -78,21 +78,25 @@ pub struct PolicyRule { /// APIGroups is the name of the APIGroup that contains the resources /// If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub api_groups: Option>, /// Resources is a list of resources this rule applies to /// Examples: pods, services, deployments - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub resources: Option>, /// 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>, /// NonResourceURLs is a set of partial urls that a user should have access to /// *s are allowed, but only as the full, final step in the path - #[serde(rename = "nonResourceURLs", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "nonResourceURLs", + default, + skip_serializing_if = "Option::is_none" + )] pub non_resource_urls: Option>, } @@ -294,6 +298,6 @@ impl RoleRef { #[serde(rename_all = "camelCase")] pub struct AggregationRule { /// ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules - #[serde(skip_serializing_if = "Option::is_none")] + #[serde(default, skip_serializing_if = "Option::is_none")] pub cluster_role_selectors: Option>, }