Adjusted secret name to prevent conflicts

This commit is contained in:
Dreaded_X 2025-03-14 04:26:13 +01:00
parent 280ac723b5
commit 39a57e35ac
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4

View File

@ -44,6 +44,7 @@ async fn reconcile(obj: Arc<ServiceUser>, ctx: Arc<Data>) -> Result<Action> {
.name .name
.clone() .clone()
.ok_or(Error::MissingObjectKey(".metadata.name"))?; .ok_or(Error::MissingObjectKey(".metadata.name"))?;
let secret_name = format!("{name}-lldap-credentials");
let namespace = obj let namespace = obj
.metadata .metadata
.namespace .namespace
@ -59,11 +60,11 @@ async fn reconcile(obj: Arc<ServiceUser>, ctx: Arc<Data>) -> Result<Action> {
// TODO: Potentially issue: someone modifies the secret and removes the pass // TODO: Potentially issue: someone modifies the secret and removes the pass
let mut created = false; let mut created = false;
let mut secret = secrets let mut secret = secrets
.entry(&name) .entry(&secret_name)
.await .await
.map_err(Error::Kube)? .map_err(Error::Kube)?
.or_insert(|| { .or_insert(|| {
debug!(name, "Generating new secret"); debug!(name, secret_name, "Generating new secret");
let mut contents = BTreeMap::new(); let mut contents = BTreeMap::new();
contents.insert("username".into(), name.clone()); contents.insert("username".into(), name.clone());