Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The property quarkus.operator-sdk.crd.apply is ignored #242

Closed
Sgitario opened this issue Feb 23, 2022 · 6 comments
Closed

The property quarkus.operator-sdk.crd.apply is ignored #242

Sgitario opened this issue Feb 23, 2022 · 6 comments

Comments

@Sgitario
Copy link
Contributor

How to reproduce?

You can reproduce this issue by using the samples/joke example:

  1. cd samples/joke
  2. mvn clean install -Dquarkus.operator-sdk.crd.apply=true

The auto-generated JokeRequest CRD is not installed.

Problem

I think that the problem is that this is done when creating an instance of the Operator (see https://github.com/quarkiverse/quarkus-operator-sdk/blob/main/core/runtime/src/main/java/io/quarkiverse/operatorsdk/runtime/OperatorProducer.java#L37). Therefore, this won't ever be applied at build time, but only at runtime when injecting the Operator.

@metacosm
Copy link
Member

The property is not ignored, but, indeed, it only works for dev mode on purpose (because applying a CRD automatically to a cluster is probably not a good idea when you're not developing your operator). It doesn't do anything if the operator is not running. Applying the CRD without the operator running would actually require to spawn a separate process, which, granted, could be done during the build.

@Sgitario
Copy link
Contributor Author

Ok, so I would add a comment in the property to state that this is only intended to work on DEV mode.

@metacosm
Copy link
Member

Do you think it would make sense to convert this issue into a feature request to support application of the CRD at build time? If not, we should close this issue.

@Sgitario
Copy link
Contributor Author

Do you think it would make sense to convert this issue into a feature request to support application of the CRD at build time? If not, we should close this issue.

From my point of view, the CRD should always be applied/updated when running the application on DEV mode, otherwise is not guaranteed that the CRD is up to date with what the CRD that has been just auto-generated.

So, when users use this property to the Maven command, I'd expect that the CRD is always applied even when I'm not running the application on DEV mode.

In summary, I'd be ok to convert this issue into a feature request.

@metacosm
Copy link
Member

Do you think it would make sense to convert this issue into a feature request to support application of the CRD at build time? If not, we should close this issue.

From my point of view, the CRD should always be applied/updated when running the application on DEV mode, otherwise is not guaranteed that the CRD is up to date with what the CRD that has been just auto-generated.

This is indeed a valid point. Maybe I should just convert the default to true and people who absolutely do not want this feature could turn it off.

So, when users use this property to the Maven command, I'd expect that the CRD is always applied even when I'm not running the application on DEV mode.

In summary, I'd be ok to convert this issue into a feature request.

👍🏼

Sgitario added a commit to Sgitario/quarkus-operator-sdk that referenced this issue Mar 7, 2022
When enabling `quarkus.operator-sdk.crd.apply=true` at build time, we will register the CRD in the Kubernetes cluster where user is logged in. 

Updated documentation and added a note saying that this will always be done when running the application on Dev mode.

Fix quarkiverse#242
metacosm pushed a commit that referenced this issue Mar 11, 2022
#260)

When enabling `quarkus.operator-sdk.crd.apply=true` at build time, we will register the CRD in the Kubernetes cluster where user is logged in. 

Updated documentation and added a note saying that this will always be done when running the application on Dev mode.

Fixes #242
metacosm pushed a commit that referenced this issue Mar 30, 2022
#260)

When enabling `quarkus.operator-sdk.crd.apply=true` at build time, we will register the CRD in the Kubernetes cluster where user is logged in.

Updated documentation and added a note saying that this will always be done when running the application on Dev mode.

Fixes #242
@metacosm
Copy link
Member

metacosm commented Jan 6, 2023

Reverting this change because it doesn't really make sense to apply the CRD to the cluster that's available at build time as opposed to runtime. Also, this causes the CRD to be applied several times at the moment, which is inefficient. Revert commit: e864518

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants