@@ -9,6 +9,7 @@ use stackable_operator::{
99 crd:: authentication:: { core as auth_core, ldap, oidc, r#static} ,
1010 k8s_openapi:: api:: core:: v1:: { KeyToPath , SecretVolumeSource , Volume } ,
1111 kube:: { ResourceExt , runtime:: reflector:: ObjectRef } ,
12+ v2:: types:: operator:: ClusterName ,
1213} ;
1314
1415use crate :: { crd:: v1alpha1, security:: oidc:: build_oidc_admin_password_secret_name} ;
@@ -115,7 +116,6 @@ impl DereferencedAuthenticationClasses {
115116 }
116117}
117118
118- #[ allow( clippy:: large_enum_variant) ]
119119#[ derive( Clone ) ]
120120pub enum NifiAuthenticationConfig {
121121 SingleUser {
@@ -127,7 +127,7 @@ pub enum NifiAuthenticationConfig {
127127 Oidc {
128128 provider : oidc:: v1alpha1:: AuthenticationProvider ,
129129 oidc : oidc:: v1alpha1:: ClientAuthenticationOptions ,
130- nifi : v1alpha1 :: NifiCluster ,
130+ cluster_name : ClusterName ,
131131 } ,
132132}
133133
@@ -243,11 +243,15 @@ impl NifiAuthenticationConfig {
243243 . add_volumes_and_mounts ( pod_builder, container_builders)
244244 . context ( AddLdapVolumesSnafu ) ?;
245245 }
246- Self :: Oidc { provider, nifi, .. } => {
246+ Self :: Oidc {
247+ provider,
248+ cluster_name,
249+ ..
250+ } => {
247251 let admin_volume = Volume {
248252 name : STACKABLE_ADMIN_USERNAME . to_string ( ) ,
249253 secret : Some ( SecretVolumeSource {
250- secret_name : Some ( build_oidc_admin_password_secret_name ( nifi ) ) ,
254+ secret_name : Some ( build_oidc_admin_password_secret_name ( cluster_name ) ) ,
251255 optional : Some ( false ) ,
252256 items : Some ( vec ! [ KeyToPath {
253257 key: STACKABLE_ADMIN_USERNAME . to_string( ) ,
@@ -285,7 +289,7 @@ impl NifiAuthenticationConfig {
285289 /// * LDAP TLS verification is enabled if TLS is used
286290 /// * an OIDC client spec is present when the provider is OIDC
287291 pub fn validate (
288- nifi : & v1alpha1 :: NifiCluster ,
292+ cluster_name : & ClusterName ,
289293 dereferenced : & DereferencedAuthenticationClasses ,
290294 ) -> Result < Self > {
291295 let ( entry, auth_class) = match dereferenced. entries . as_slice ( ) {
@@ -321,7 +325,7 @@ impl NifiAuthenticationConfig {
321325 . oidc_or_error ( & auth_class_name)
322326 . context ( OidcConfigurationInvalidSnafu ) ?
323327 . clone ( ) ,
324- nifi : nifi . clone ( ) ,
328+ cluster_name : cluster_name . clone ( ) ,
325329 } ) ,
326330 _ => AuthenticationClassProviderNotSupportedSnafu {
327331 authentication_class_provider : auth_class. spec . provider . to_string ( ) ,
0 commit comments