Skip to content

Commit 28e6d5f

Browse files
authored
schemars 1 with kube pre-2 and k8s-openapi pins (#166)
* Use pinned k8s-openapi and kube for schemars 1 Signed-off-by: clux <[email protected]> * bump edition Signed-off-by: clux <[email protected]> * fmt Signed-off-by: clux <[email protected]> --------- Signed-off-by: clux <[email protected]>
1 parent d22ab47 commit 28e6d5f

File tree

7 files changed

+53
-35
lines changed

7 files changed

+53
-35
lines changed

Cargo.lock

Lines changed: 31 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "controller"
33
version = "0.16.0"
44
authors = ["clux <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
default-run = "controller"
77
license = "Apache-2.0"
88
publish = false
@@ -29,8 +29,9 @@ telemetry = ["opentelemetry-otlp"]
2929
actix-web = "4.11.0"
3030
futures = "0.3.31"
3131
tokio = { version = "1.46.1", features = ["macros", "rt-multi-thread"] }
32-
k8s-openapi = { version = "0.25.0", features = ["latest"] }
33-
schemars = { version = "0.8.22", features = ["chrono"] }
32+
#k8s-openapi = { version = "0.25.0", features = ["latest"] }
33+
k8s-openapi = { git = "https://github.com/Arnavion/k8s-openapi.git", rev = "e9a9eaf", features=["latest"] }
34+
schemars = { version = "1", features = ["chrono04"] }
3435
serde = { version = "1.0.219", features = ["derive"] }
3536
serde_json = "1.0.140"
3637
serde_yaml = "0.9.25"
@@ -53,10 +54,10 @@ tower-test = "0.4.0"
5354

5455
[dependencies.kube]
5556
features = ["runtime", "client", "derive"]
56-
version = "1.1.0"
57+
# version = "1.1.0"
5758

5859
# testing new releases - ignore
59-
# git = "https://github.com/kube-rs/kube.git"
60+
git = "https://github.com/kube-rs/kube.git"
6061
# branch = "main"
61-
#rev = "19b90ad3a4dbc83e1dd742847c7707333259b1bb"
62-
#path = "../kube/kube"
62+
rev = "06e843bf026d0838dca159433e8af8268b6cc0bf"
63+
# path = "../kube/kube"

src/controller.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use crate::{telemetry, Error, Metrics, Result};
1+
use crate::{Error, Metrics, Result, telemetry};
22
use chrono::{DateTime, Utc};
33
use futures::StreamExt;
44
use kube::{
5+
CustomResource, Resource,
56
api::{Api, ListParams, Patch, PatchParams, ResourceExt},
67
client::Client,
78
runtime::{
89
controller::{Action, Controller},
910
events::{Event, EventType, Recorder, Reporter},
10-
finalizer::{finalizer, Event as Finalizer},
11+
finalizer::{Event as Finalizer, finalizer},
1112
watcher::Config,
1213
},
13-
CustomResource, Resource,
1414
};
1515
use schemars::JsonSchema;
1616
use serde::{Deserialize, Serialize};
@@ -233,9 +233,9 @@ pub async fn run(state: State) {
233233
// Mock tests relying on fixtures.rs and its primitive apiserver mocks
234234
#[cfg(test)]
235235
mod test {
236-
use super::{error_policy, reconcile, Context, Document};
236+
use super::{Context, Document, error_policy, reconcile};
237237
use crate::{
238-
fixtures::{timeout_after_1s, Scenario},
238+
fixtures::{Scenario, timeout_after_1s},
239239
metrics::ErrorLabels,
240240
};
241241
use std::sync::Arc;

src/fixtures.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Helper methods only available for tests
2-
use crate::{Context, Document, DocumentSpec, DocumentStatus, Result, DOCUMENT_FINALIZER};
2+
use crate::{Context, DOCUMENT_FINALIZER, Document, DocumentSpec, DocumentStatus, Result};
33
use assert_json_diff::assert_json_include;
44
use http::{Request, Response};
5-
use kube::{client::Body, runtime::events::Recorder, Client, Resource, ResourceExt};
5+
use kube::{Client, Resource, ResourceExt, client::Body, runtime::events::Recorder};
66
use std::sync::Arc;
77

88
impl Document {

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(unused_imports, unused_variables)]
2-
use actix_web::{get, middleware, web::Data, App, HttpRequest, HttpResponse, HttpServer, Responder};
3-
pub use controller::{self, telemetry, State};
2+
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, get, middleware, web::Data};
3+
pub use controller::{self, State, telemetry};
44

55
#[get("/metrics")]
66
async fn metrics(c: Data<State>, _req: HttpRequest) -> impl Responder {

src/telemetry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(unused_imports)] // some used only for telemetry feature
22
use opentelemetry::trace::{TraceId, TracerProvider};
3-
use opentelemetry_sdk::{runtime, trace as sdktrace, trace::Config, Resource};
4-
use tracing_subscriber::{prelude::*, EnvFilter, Registry};
3+
use opentelemetry_sdk::{Resource, runtime, trace as sdktrace, trace::Config};
4+
use tracing_subscriber::{EnvFilter, Registry, prelude::*};
55

66
/// Fetch an opentelemetry::trace::TraceId as hex through the full tracing stack
77
pub fn get_trace_id() -> TraceId {

yaml/crd.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ spec:
2323
description: |-
2424
Generate the Kubernetes wrapper struct `Document` from our Spec and Status struct
2525
26-
This provides a hook for generating the CRD yaml (in crdgen.rs) NB: CustomResource generates a pub struct Document here To query for documents.kube.rs with kube, use Api<Document>.
26+
This provides a hook for generating the CRD yaml (in crdgen.rs)
27+
NB: CustomResource generates a pub struct Document here
28+
To query for documents.kube.rs with kube, use Api<Document>.
2729
properties:
2830
content:
2931
type: string

0 commit comments

Comments
 (0)