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

Yaml fails to load/dump CRD contains x-kubernetes-int-or-string in V1JSONSchemaProps #1796

Closed
chingyi-lin opened this issue Jul 23, 2021 · 3 comments · Fixed by #1804
Closed
Assignees

Comments

@chingyi-lin
Copy link

Describe the bug

If the CRD yaml contains x-kubernetes-int-or-string, then Yaml fails to load the manifest as V1CustomResourceDefinition object. Replacing x-kubernetes-int-or-string with xKubernetesIntOrString will make Yaml be able to load it successfully. Besides, with Yaml.dump on V1CustomResourceDefinition object, the returned yaml string gets xKubernetesIntOrString instead. If one uses the string as the patch request body, the api server will reject it as the spec is invalid.

** Client Version **
11.0.0 (issue persisted in 11.0.2 and 13.0.0)

** Kubernetes Version **
1.18.16

** Java Version **
Java 8

To Reproduce
Steps to reproduce the behavior:

  1. Copy the felixconfigurations.crd.projectcalico.org crd manifest obtained from https://docs.projectcalico.org/archive/v3.19/manifests/tigera-operator.yaml as a string.
  2. Use Yaml.loadAll("the crd manifest string") or Yaml.loadAs("the crd manifest string", V1CustomResourceDefinition.class)to load it.
  3. Observe the error
Cannot create property=spec for JavaBean=class V1CustomResourceDefinition {
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
...
Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 'x-kubernetes-int-or-string' on class: io.kubernetes.client.openapi.models.V1JSONSchemaProps
	at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:159)

Expected behavior

  • The CRD yaml is being loaded successfully.
  • Yaml properly dump V1CustomResourceDefinition back to string.

KubeConfig
N/A

Server (please complete the following information):

  • OS: Amazon Linux 2
  • Environment [e.g. container]
  • Cloud: EKS

Additional context
N/A

@brendandburns
Copy link
Contributor

Thanks for the detail bug descripton, we will investigate this.

@yue9944882
Copy link
Member

/assign

thank you for the clue!

@chingyi-lin
Copy link
Author

Glad to see a fix is merged! I'll validate it once it's released. thank you!

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 a pull request may close this issue.

3 participants