chore: Update dependencies

This commit is contained in:
2025-12-21 06:19:04 +01:00
parent f98677eb1e
commit 72bb27aae0
13 changed files with 754 additions and 812 deletions

View File

@@ -1,4 +1,3 @@
#![feature(let_chains)]
pub mod context;
pub mod lldap;
pub mod resources;

View File

@@ -37,10 +37,10 @@ pub enum Error {
pub type Result<T, E = Error> = std::result::Result<T, E>;
fn check_graphql_errors<T>(response: GraphQlResponse<T>) -> Result<T> {
if let Some(errors) = &response.errors {
if !errors.is_empty() {
Err(errors.first().expect("Should not be empty").clone())?;
}
if let Some(errors) = &response.errors
&& !errors.is_empty()
{
Err(errors.first().expect("Should not be empty").clone())?;
}
Ok(response

View File

@@ -1,6 +1,7 @@
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use kube::CustomResource;
use kube::runtime::controller::Action;
use schemars::JsonSchema;
@@ -19,6 +20,7 @@ use crate::context::{Context, ControllerEvents};
#[serde(rename_all = "camelCase")]
pub struct GroupSpec {}
#[async_trait]
impl Reconcile for Group {
async fn reconcile(self: Arc<Self>, ctx: Arc<Context>) -> Result<Action> {
let name = self

View File

@@ -5,6 +5,7 @@ mod user_attribute;
use core::fmt;
use std::sync::Arc;
use async_trait::async_trait;
use k8s_openapi::{ClusterResourceScope, NamespaceResourceScope};
use kube::runtime::controller::Action;
use kube::runtime::finalizer;
@@ -43,7 +44,8 @@ impl From<finalizer::Error<Self>> for Error {
type Result<T, E = Error> = std::result::Result<T, E>;
trait Reconcile {
#[async_trait]
pub trait Reconcile {
async fn reconcile(self: Arc<Self>, ctx: Arc<Context>) -> Result<Action>;
async fn cleanup(self: Arc<Self>, ctx: Arc<Context>) -> Result<Action>;

View File

@@ -3,6 +3,7 @@ use std::str::from_utf8;
use std::sync::Arc;
use std::time::Duration;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use k8s_openapi::api::core::v1::Secret;
use k8s_openapi::apimachinery::pkg::apis::meta::v1::OwnerReference;
@@ -76,6 +77,7 @@ fn format_username(name: &str, namespace: &str) -> String {
format!("{name}.{namespace}")
}
#[async_trait]
impl Reconcile for ServiceUser {
async fn reconcile(self: Arc<Self>, ctx: Arc<Context>) -> Result<Action> {
let name = self

View File

@@ -1,8 +1,9 @@
use std::time::Duration;
use async_trait::async_trait;
use kube::api::{Patch, PatchParams};
use kube::runtime::controller::Action;
use kube::{Api, CELSchema, CustomResource};
use kube::{Api, CustomResource, KubeSchema};
use queries::AttributeType;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@@ -33,7 +34,7 @@ impl From<Type> for AttributeType {
}
}
#[derive(CustomResource, Deserialize, Serialize, Clone, Debug, CELSchema)]
#[derive(CustomResource, Deserialize, Serialize, Clone, Debug, KubeSchema)]
#[kube(
kind = "UserAttribute",
group = "lldap.huizinga.dev",
@@ -51,11 +52,11 @@ impl From<Type> for AttributeType {
printcolumn = r#"{"name":"Age", "type":"date", "jsonPath":".metadata.creationTimestamp"}"#
)]
#[kube(
rule = Rule::new("self.spec == oldSelf.spec").message("User attributes are immutable"),
rule = Rule::new("!self.spec.userEditable || self.spec.userVisible && self.spec.userEditable").message("Editable attribute must also be visible")
validation = Rule::new("self.spec == oldSelf.spec").message("User attributes are immutable"),
validation = Rule::new("!self.spec.userEditable || self.spec.userVisible && self.spec.userEditable").message("Editable attribute must also be visible")
)]
#[serde(rename_all = "camelCase")]
pub struct UesrAttributeSpec {
pub struct UserAttributeSpec {
r#type: Type,
#[serde(default)]
list: bool,
@@ -70,6 +71,7 @@ pub struct UserAttributesStatus {
pub synced: bool,
}
#[async_trait]
impl Reconcile for UserAttribute {
async fn reconcile(
self: std::sync::Arc<Self>,