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

Add CRD generator #2776

Merged
merged 93 commits into from
Feb 10, 2021
Merged

Add CRD generator #2776

merged 93 commits into from
Feb 10, 2021

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Feb 2, 2021

Description

Allows to generate CRDs from CustomResource annotations.
Supersedes on #2758
Fixes #2757
Fixes #2759

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@centos-ci
Copy link

Can one of the admins verify this patch?

@metacosm metacosm mentioned this pull request Feb 2, 2021
11 tasks
@metacosm metacosm force-pushed the dekorate-crd-generator branch 3 times, most recently from fa79601 to 34184af Compare February 2, 2021 19:56
@iocanel iocanel self-requested a review February 3, 2021 07:38
Copy link
Member

@iocanel iocanel left a 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.

crd-generator/pom.xml Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
crd-generator/pom.xml Outdated 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()));
}
Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Member

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.

@rohanKanojia
Copy link
Member

Is there any example of how to use this Crd generator? Maybe we can add a README to the module documenting sample usage?

@metacosm
Copy link
Collaborator Author

metacosm commented Feb 8, 2021

Is there any example of how to use this Crd generator? Maybe we can add a README to the module documenting sample usage?

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.

Copy link
Member

@manusa manusa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx!

@sonarcloud
Copy link

sonarcloud bot commented Feb 9, 2021

@manusa manusa merged commit 94a4263 into master Feb 10, 2021
@manusa manusa deleted the dekorate-crd-generator branch February 10, 2021 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants