@@ -306,6 +306,19 @@ impl Struct {
306306 & self ,
307307 version : & VersionDefinition ,
308308 ) -> Option < ( IdentString , String , TokenStream ) > {
309+ let kube_core_crate_default = & Path :: from_string ( "::kube::core" ) . expect ( "valid path" ) ;
310+ let kube_core_crate = self . common . options . kubernetes_options . as_ref ( ) . map_or_else (
311+ || quote ! { #kube_core_crate_default} ,
312+ |options| {
313+ if let Some ( crates) = & options. crates {
314+ if let Some ( kube_core) = & crates. kube_core {
315+ return quote ! { #kube_core} ;
316+ }
317+ }
318+ quote ! { #kube_core_crate_default}
319+ } ,
320+ ) ;
321+
309322 match & self . common . options . kubernetes_options {
310323 Some ( options) if !options. skip_merged_crd => {
311324 let enum_variant_ident = version. inner . as_variant_ident ( ) ;
@@ -316,7 +329,7 @@ impl Struct {
316329 let qualified_path: Path = parse_quote ! ( #module_ident:: #struct_ident) ;
317330
318331 let merge_crds_fn_call = quote ! {
319- <#qualified_path as :: kube :: CustomResourceExt >:: crd( )
332+ <#qualified_path as #kube_core_crate :: CustomResourceExt >:: crd( )
320333 } ;
321334
322335 Some ( ( enum_variant_ident, enum_variant_string, merge_crds_fn_call) )
@@ -342,6 +355,19 @@ impl Struct {
342355 // module (in standalone mode).
343356 let automatically_derived = is_nested. not ( ) . then ( || quote ! { #[ automatically_derived] } ) ;
344357
358+ let kube_core_crate_default = & Path :: from_string ( "::kube::core" ) . expect ( "valid path" ) ;
359+ let kube_core_crate = self . common . options . kubernetes_options . as_ref ( ) . map_or_else (
360+ || quote ! { #kube_core_crate_default} ,
361+ |options| {
362+ if let Some ( crates) = & options. crates {
363+ if let Some ( kube_core) = & crates. kube_core {
364+ return quote ! { #kube_core} ;
365+ }
366+ }
367+ quote ! { #kube_core_crate_default}
368+ } ,
369+ ) ;
370+
345371 let k8s_openapi_crate_default = & Path :: from_string ( "::k8s_openapi" ) . expect ( "valid path" ) ;
346372 let k8s_openapi_crate = self . common . options . kubernetes_options . as_ref ( ) . map_or_else (
347373 || quote ! { #k8s_openapi_crate_default} ,
@@ -379,8 +405,8 @@ impl Struct {
379405 /// Generates a merged CRD which contains all versions defined using the `#[versioned()]` macro.
380406 pub fn merged_crd(
381407 stored_apiversion: Self
382- ) -> :: std:: result:: Result <#k8s_openapi_crate:: apiextensions_apiserver:: pkg:: apis:: apiextensions:: v1:: CustomResourceDefinition , :: kube :: core :: crd:: MergeError > {
383- :: kube :: core :: crd:: merge_crds( vec![ #( #fn_calls) , * ] , & stored_apiversion. to_string( ) )
408+ ) -> :: std:: result:: Result <#k8s_openapi_crate:: apiextensions_apiserver:: pkg:: apis:: apiextensions:: v1:: CustomResourceDefinition , #kube_core_crate :: crd:: MergeError > {
409+ #kube_core_crate :: crd:: merge_crds( vec![ #( #fn_calls) , * ] , & stored_apiversion. to_string( ) )
384410 }
385411
386412 /// Generates and writes a merged CRD which contains all versions defined using the `#[versioned()]`
0 commit comments