-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add CRD generator #2776
Add CRD generator #2776
Conversation
Can one of the admins verify this patch? |
6b6bf5a
to
fed61ca
Compare
fa79601
to
34184af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request is too big to give a thorough view, but since it's an actual copy of what we had in decorate.
I'd say let's give it a +1 to get it merged and maybe have it as part of 5.1.0. and we'll keep on building on top of that.
6ca3f5a
to
0b8fca4
Compare
276bff1
to
3f453b8
Compare
3f453b8
to
a3fe2f4
Compare
a85d797
to
316bfa4
Compare
- Updated Kubernetes Model to v1.20.2 - Remove kubernetes-model-settings as v1alpha1 PodPreset API got removed in Kubernetes 1.20.x - Remove client.settings() DSL and related classes from KubernetesClient interface - Added v1 models for scheduling, certificates, eventing and admission
source/target when user is on jdk1..
316bfa4
to
cc6ef89
Compare
...ent/src/main/java/io/fabric8/kubernetes/client/dsl/base/CustomResourceDefinitionContext.java
Show resolved
Hide resolved
crd-generator/src/main/java/io/fabric8/crd/generator/apt/CustomResourceAnnotationProcessor.java
Show resolved
Hide resolved
crd-generator/src/main/java/io/fabric8/crd/generator/apt/CustomResourceAnnotationProcessor.java
Show resolved
Hide resolved
builder.accept(visitor.withKind(resourceKind.get()).withMetadata(objectMeta.get())); | ||
} else if (objectMeta.map(m -> m.getName()).filter(s -> s.equals(name)).isPresent()) { | ||
builder.accept(visitor.withKind(resourceKind.get()).withMetadata(objectMeta.get())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Umm, why are we executing the same code in both blocks?
Please check code smells reported by sonar and address whatever seem relevant to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! As far as I'm aware I ported that code as-is from Dekorate. Any idea why, @iocanel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason, most probably it never occurred to me that that they were identical.
Since the logic here is: if kind is null or matching do <stuff>
I guess that it would make sense to collapse both parts into a single if.
Is there any example of how to use this Crd generator? Maybe we can add a README to the module documenting sample usage? |
crd-generator/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java
Show resolved
Hide resolved
Good idea. There's actually nothing to do apart from including the module in the POM of your CR-containing project and the CRD will be automatically generated when you build your project. I will add a README. |
crd-generator/src/main/java/io/fabric8/crd/generator/utils/Strings.java
Outdated
Show resolved
Hide resolved
crd-generator/src/main/java/io/fabric8/crd/generator/utils/Strings.java
Outdated
Show resolved
Hide resolved
1c255a4
to
8127c34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx!
SonarCloud Quality Gate failed. |
Description
Allows to generate CRDs from CustomResource annotations.
Supersedes on #2758
Fixes #2757
Fixes #2759
Type of change
test, version modification, documentation, etc.)
Checklist