Skip to content

schemars 1 with kube pre-2 and k8s-openapi pins #166

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

Merged
merged 3 commits into from
Jul 8, 2025
Merged
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
47 changes: 31 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "controller"
version = "0.16.0"
authors = ["clux <[email protected]>"]
edition = "2021"
edition = "2024"
default-run = "controller"
license = "Apache-2.0"
publish = false
Expand All @@ -29,8 +29,9 @@ telemetry = ["opentelemetry-otlp"]
actix-web = "4.11.0"
futures = "0.3.31"
tokio = { version = "1.46.1", features = ["macros", "rt-multi-thread"] }
k8s-openapi = { version = "0.25.0", features = ["latest"] }
schemars = { version = "0.8.22", features = ["chrono"] }
#k8s-openapi = { version = "0.25.0", features = ["latest"] }
k8s-openapi = { git = "https://github.com/Arnavion/k8s-openapi.git", rev = "e9a9eaf", features=["latest"] }
schemars = { version = "1", features = ["chrono04"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
serde_yaml = "0.9.25"
Expand All @@ -53,10 +54,10 @@ tower-test = "0.4.0"

[dependencies.kube]
features = ["runtime", "client", "derive"]
version = "1.1.0"
# version = "1.1.0"

# testing new releases - ignore
# git = "https://github.com/kube-rs/kube.git"
git = "https://github.com/kube-rs/kube.git"
# branch = "main"
#rev = "19b90ad3a4dbc83e1dd742847c7707333259b1bb"
#path = "../kube/kube"
rev = "06e843bf026d0838dca159433e8af8268b6cc0bf"
# path = "../kube/kube"
10 changes: 5 additions & 5 deletions src/controller.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use crate::{telemetry, Error, Metrics, Result};
use crate::{Error, Metrics, Result, telemetry};
use chrono::{DateTime, Utc};
use futures::StreamExt;
use kube::{
CustomResource, Resource,
api::{Api, ListParams, Patch, PatchParams, ResourceExt},
client::Client,
runtime::{
controller::{Action, Controller},
events::{Event, EventType, Recorder, Reporter},
finalizer::{finalizer, Event as Finalizer},
finalizer::{Event as Finalizer, finalizer},
watcher::Config,
},
CustomResource, Resource,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -233,9 +233,9 @@ pub async fn run(state: State) {
// Mock tests relying on fixtures.rs and its primitive apiserver mocks
#[cfg(test)]
mod test {
use super::{error_policy, reconcile, Context, Document};
use super::{Context, Document, error_policy, reconcile};
use crate::{
fixtures::{timeout_after_1s, Scenario},
fixtures::{Scenario, timeout_after_1s},
metrics::ErrorLabels,
};
use std::sync::Arc;
Expand Down
4 changes: 2 additions & 2 deletions src/fixtures.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Helper methods only available for tests
use crate::{Context, Document, DocumentSpec, DocumentStatus, Result, DOCUMENT_FINALIZER};
use crate::{Context, DOCUMENT_FINALIZER, Document, DocumentSpec, DocumentStatus, Result};
use assert_json_diff::assert_json_include;
use http::{Request, Response};
use kube::{client::Body, runtime::events::Recorder, Client, Resource, ResourceExt};
use kube::{Client, Resource, ResourceExt, client::Body, runtime::events::Recorder};
use std::sync::Arc;

impl Document {
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(unused_imports, unused_variables)]
use actix_web::{get, middleware, web::Data, App, HttpRequest, HttpResponse, HttpServer, Responder};
pub use controller::{self, telemetry, State};
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, get, middleware, web::Data};
pub use controller::{self, State, telemetry};

#[get("/metrics")]
async fn metrics(c: Data<State>, _req: HttpRequest) -> impl Responder {
Expand Down
4 changes: 2 additions & 2 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(unused_imports)] // some used only for telemetry feature
use opentelemetry::trace::{TraceId, TracerProvider};
use opentelemetry_sdk::{runtime, trace as sdktrace, trace::Config, Resource};
use tracing_subscriber::{prelude::*, EnvFilter, Registry};
use opentelemetry_sdk::{Resource, runtime, trace as sdktrace, trace::Config};
use tracing_subscriber::{EnvFilter, Registry, prelude::*};

/// Fetch an opentelemetry::trace::TraceId as hex through the full tracing stack
pub fn get_trace_id() -> TraceId {
Expand Down
4 changes: 3 additions & 1 deletion yaml/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ spec:
description: |-
Generate the Kubernetes wrapper struct `Document` from our Spec and Status struct

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>.
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>.
properties:
content:
type: string
Expand Down
Loading