-
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
CRD generation fails with StackOverflow in case of cyclic references #3651
Comments
Additional considerations:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: keycloakrealms.keycloak.org
spec:
group: keycloak.org
names:
kind: KeycloakRealm
plural: keycloakrealms
shortNames:
- kc
singular: keycloakrealm
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
properties:
spec:
properties:
realm:
properties:
example:
properties:
reference:
x-kubernetes-preserve-unknown-fields: true
type: object
type: object
reference:
properties:
example:
x-kubernetes-preserve-unknown-fields: true
type: object
type: object
type: object
type: object
status:
type: object
type: object
served: true
storage: true
subresources:
status: {} |
another alternative might be to create "virtual" references: as soon as we detect a cycle we convert the property to a "Ref" type (e.g. backed by a plain This is a technical proposal for implementing, in this context, a standard pattern for breaking cycles ( example ). Despite this being a technically appealing solution, I do see a few downsides on this proposal:
|
The current path forward is to explore adding an annotation that enable users to specify an alternative CRD implementation instead of using the one automatically derived from the Java object. cc. @metacosm |
Describe the bug
Using the CRD generation preview module and having cyclic references in the POJOs breaks the generator.
Discovered trying to produce a CRD from the Keycloak Real Representation:
https://github.com/andreaTP/repro_crd_gen_stackoverflow/blob/e398e95c265c9bd2fe992e517b6b554382ae863b/src/main/java/org/keycloak/operator/crds/KeycloakRealmSpec.java#L23
Fabric8 Kubernetes Client version
5.10.1@latest
Steps to reproduce
Expected behavior
In order of preference:
Runtime
other (please specify in additional context)
Kubernetes API Server version
other (please specify in additional context)
Environment
Linux, macOS
Fabric8 Kubernetes Client Logs
and keeps bouncing in the last two lines:
full reference: https://github.com/andreaTP/repro_crd_gen_stackoverflow/blob/main/out.log
The text was updated successfully, but these errors were encountered: