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 x-kubernetes-preserve-unknown-fields handling #225

Conversation

FrancoisPoinsot
Copy link

skip setting "additionalProperties: false" when x-kubernetes-preserve-unknown-fields == true

This should implement the behavior of https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#controlling-pruning

fixes #224

FrancoisPoinsot added a commit to cognitedata/CRDs-catalog that referenced this pull request Jul 31, 2023
specifically using this version of the kubeconform script:
yannh/kubeconform#225
@FrancoisPoinsot
Copy link
Author

Hey @yannh
Is that PR a thing you would be interested in?

@yannh
Copy link
Owner

yannh commented Nov 6, 2023

Hi @FrancoisPoinsot ! So the issue if I understand it correctly, is that the behavior set by --strict can be overriden in-schema for certain fields, with x-kubernetes-preserve-unknown-fields being set to true or false?

@FrancoisPoinsot
Copy link
Author

correct

@yannh
Copy link
Owner

yannh commented Nov 18, 2023

Hi @FrancoisPoinsot , sorry for the delayed response - any chance to add a test to ensure this works and doesn't break in the future? Otherwise it looks good to me.

@FrancoisPoinsot
Copy link
Author

I will be honest, I am not super familiar with python
I will try to see what I can do
But if you already have some idea in mind, don't hesitate to add a commit to that PR.

skip setting "additionalProperties: false"  when x-kubernetes-preserve-unknown-fields == true
@FrancoisPoinsot
Copy link
Author

FrancoisPoinsot commented Nov 22, 2023

I see 2 suites of test.

One at the root, called with

make docker-build-static
make docker-acceptance

The other under /scripts.

The first one has more scenario but only the second one is called from github action.

Which one should I extend?

edit: Forget that, I see the test for openapi2jsonschema.py is the one under /scripts

@FrancoisPoinsot
Copy link
Author

Added a couple of test.
1 in /scripts to check the generated schema remains the same.
1 at the root to check an emissary Mapping. This is one of the custom resources I had trouble with originaly.

@yannh , does that look alright to you?

@FrancoisPoinsot
Copy link
Author

@yannh should I close that PR?

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.

missing exception for x-kubernetes-preserve-unknown-fields
2 participants