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

CRD registration of properties with default value set to null #1350

Open
devdattakulkarni opened this issue Aug 29, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@devdattakulkarni
Copy link
Contributor

devdattakulkarni commented Aug 29, 2024

In odoo helm chart, there is the following section in values.yaml

updateStrategy:
type: RollingUpdate
rollingUpdate: null

When Odoo CRD is created with this helm chart, the rollingUpdate field is being ignored. The OpenAPI Spec that is registered for this CRD does not seem to contain the rollingUpdate field.

@devdattakulkarni devdattakulkarni added the bug Something isn't working label Aug 29, 2024
@devdattakulkarni
Copy link
Contributor Author

devdattakulkarni commented Dec 10, 2024

The code update for this will be in the registercrd method, specifically in the flatten method:
https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L666

In the flatten method implementation (https://github.com/cloud-ark/kubeplus/blob/master/deploy/kubeconfiggenerator.py#L478),

Kubernetes supports OpenAPI Spec v3.0 (https://kubernetes.io/docs/concepts/overview/kubernetes-api/).
In OpenAPI Spec 3.0, nullable values are defined using nullable property, like below:

type: string
nullable: true
See https://stackoverflow.com/questions/48111459/how-to-define-a-property-that-can-be-string-or-null-in-openapi-swagger

Given this, we need to add following code in flatten method:

if value == "null":
prop_dict = {'type': 'string', 'nullable': true}
types_dict[key] = prop_dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant