Small tweaks to bring in line with other Kubernetes tools

This commit is contained in:
2025-04-18 16:06:53 +02:00
parent 2d2ef6903b
commit fb553a8fe7
11 changed files with 83 additions and 33 deletions

View File

@@ -1,3 +1,7 @@
#![feature(let_chains)]
pub mod context;
pub mod lldap;
pub mod resources;
mod version;
pub use version::VERSION;

View File

@@ -7,6 +7,7 @@ use kube::runtime::controller::{self, Action};
use kube::runtime::reflector::ObjectRef;
use kube::runtime::{Controller, watcher};
use kube::{Api, Client as KubeClient, Resource};
use lldap_controller::VERSION;
use lldap_controller::context::Context;
use lldap_controller::lldap::LldapConfig;
use lldap_controller::resources::{
@@ -47,7 +48,7 @@ async fn main() -> anyhow::Result<()> {
Registry::default().with(logger).with(env_filter).init();
}
info!("Starting controller");
info!(version = VERSION, "Starting");
let client = KubeClient::try_default().await?;

View File

@@ -1,19 +1,18 @@
use std::time::Duration;
use kube::{
Api, CELSchema, CustomResource,
api::{Patch, PatchParams},
runtime::controller::Action,
};
use kube::api::{Patch, PatchParams};
use kube::runtime::controller::Action;
use kube::{Api, CELSchema, CustomResource};
use queries::AttributeType;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::json;
use tracing::{debug, trace, warn};
use crate::{context::ControllerEvents, lldap, resources::Error};
use super::Reconcile;
use crate::context::ControllerEvents;
use crate::lldap;
use crate::resources::Error;
#[derive(Deserialize, Serialize, Clone, Copy, Debug, JsonSchema)]
pub enum Type {

11
src/version.rs Normal file
View File

@@ -0,0 +1,11 @@
pub const VERSION: &str = get_version();
const fn get_version() -> &'static str {
if let Some(version) = std::option_env!("RELEASE_VERSION")
&& !version.is_empty()
{
version
} else {
git_version::git_version!(fallback = "unknown")
}
}