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

Avoid a StackOverflow and properly fail on cyclic references in CRD generation #3652

Merged
merged 6 commits into from
Dec 24, 2021

Conversation

andreaTP
Copy link
Member

Description

This is an initial improvement for #3651 , it mainly adds the failing test and output some human friendly information.
I'm still eager to discuss a proper solution for the underlying issue.

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?

Copy link
Collaborator

@metacosm metacosm left a comment

Choose a reason for hiding this comment

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

This is a good first step but I think that the issue should be addressed at the sundrio level… What do you think @iocanel ?

@andreaTP
Copy link
Member Author

@metacosm I'm not sure that the underlying issue is in sundrio, Kubernetes API and OpenAPI v3 are not allowing cyclic references but it's extremely common to have those in POJOs.
I think we need to come up with a design decision on how to move forward in this case.

@andreaTP andreaTP marked this pull request as draft December 20, 2021 18:52
@andreaTP
Copy link
Member Author

Moving this PR to Draft since I found more edge cases.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

91.3% 91.3% Coverage
0.0% 0.0% Duplication

@andreaTP andreaTP marked this pull request as ready for review December 21, 2021 19:19
@andreaTP
Copy link
Member Author

@metacosm this should be ready for a final review now.
Tested also locally against the Keycloak model and added to the local tests all the edge cases I found, now is good to go 🙂

Copy link
Collaborator

@metacosm metacosm left a comment

Choose a reason for hiding this comment

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

LGTM

@andreaTP
Copy link
Member Author

cc. @manusa @rohanKanojia this should e ready to merge AFAIU.

@manusa
Copy link
Member

manusa commented Dec 24, 2021

From the code, I understand that the fix consists on detecting cyclic references and throwing a human readable exception with the identification of the problematic field/entity in case on is found.

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!

@manusa manusa added this to the 5.11.1 milestone Dec 24, 2021
@manusa manusa merged commit 191481f into fabric8io:master Dec 24, 2021
@manusa manusa added the changelog missing A line to changelog.md regarding the change is not added label Dec 24, 2021
@manusa manusa removed the changelog missing A line to changelog.md regarding the change is not added label Dec 24, 2021
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

Successfully merging this pull request may close these issues.

5 participants