- 
                Notifications
    
You must be signed in to change notification settings  - Fork 235
 
Description
Hi, I found something a bit unexpected while integration testing.
The use case:
We want to integrate with a third party, optionally setting up an Informer Event Source if the third party CRD is present in kubernetes. The third party (Strimzi) offers an API module that contains fabric8 CustomResources and CustomResourceDefinitionss, but not any CRD yaml manifests.
The problem
To integration test this I want to use LocallyRunOperatorExtension to additionally install one of these Custom Resource Definitions.
I cannot use LocallyRunOperatorExtension.builder().withAdditionalCustomResourceDefinition(Kafka.class) as their module does not contain CRD files in META-INF, and JOSDK looks like it would want them in a specific naming convention too.
I can take the relevant CustomResourceDefinition and serialize it to a temporary file and attempt to apply it with  LocallyRunOperatorExtension.builder().withAdditionalCRD("/path/to/crd). But it appears that the LocallyRunOperatorExtension applies the CRD after it registers the Reconciler, so the CRD is not applied at the point we are trying to prepare the Event Sources.
Here's a minimal reproducer  based off of io.javaoperatorsdk:bootstrapper:5.1.4:create
The reproducer also demonstates a workaround, using a fabric8 KubernetesClient from an @BeforeAll and @AfterAll to directly apply the CustomResourceDefinition from the module.
Ideas/Questions
- Would you be open to supporting the fabric8 
CustomResourceDefinitiondirectly? Like adding awithAdditionalCustomResourceDefinition(CustomResourceDefinition definition)type method and applying them at the same time as the Class based one. - Why are the CRDs passed with 
withAdditionalCustomResourceDefinitionandwithAdditionalCRDapplied at different times? Could they all be applied before the Reconciler is registered? 
Thanks!
I'm happy to take a crack at making those changes