-
Notifications
You must be signed in to change notification settings - Fork 132
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
Convert all singleton lists in the MR APIs to embedded objects #1332
Conversation
/test-examples="examples/opensearchserverless/v1beta1/securityconfig.yaml" |
I wonder if it might make for a more consistent user experience if we set all of the updated versions to v1beta3, skipping v1beta2 for the resources that didn't have a breaking schema change in terraform provider 5.x. What do you think? |
I'd prefer Kubernetes API conventions here. I feel like skipping versions would be another source of confusion for the users. Even if we attempt to synchronize versions with this PR, we will still need to bump individual versions for the API changes specific to individual resources. which will again unsync their versions. |
from the main channel. Signed-off-by: Alper Rifat Ulucinar <[email protected]>
…raform converters Signed-off-by: Alper Rifat Ulucinar <[email protected]>
…tions for singleton lists as they are being converted to embedded objects. Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
…conversion for the samlOptions field as its schema is already a single nested block. - saml_options is thus already generated as an embedded object and not a singleton list. Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
to the JSON schema. Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
a8b7288
to
2a2c7af
Compare
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
2a2c7af
to
d349a4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @ulucinar, LGTM.
We are adding the missing example manifest (which is also the reason the |
Description of your changes
Depends on: crossplane/upjet#387, crossplane/upjet#400, crossplane/upjet#402, crossplane/upjet#411
Terraform configuration blocks, even if they have a MaxItems constraint of 1, are (almost) always generated as lists. We
now generate the lists with a MaxItems constraint of 1 as embedded objects in our MR APIs.
This also helps when updating or patching via SSA the (previously list) objects. The merging strategy implemented by SSA requires configuration for associative lists and converting the singleton lists into embedded objects removes the configuration need.
The provider generates the converted embedded objects in the new
v1beta2
version if the current API version isv1beta1
and in thev1beta3
version if the current version isv1beta2
and registers upjet's identity converter and the singleton list converters to be invoked, in chain, by the CRD API conversion webhooks. This implies that the current versions stay intact, and old clients not aware of the new APIs should continue functioning as before (backwards-compatibility). Any clients willing to use the embedded objects-based APIs should be updated to use the new (v1beta2
orv1beta3
as appropriate) versions of the CRD APIs.If a resource contains no singleton lists in its API, then no new version for it is generated.
I have:
make reviewable
to ensure this PR is ready for review.Addedbackport release-x.y
labels to auto-backport this PR if necessary.config.Resource.References[*].Type
withconfig.Resource.References[*].TerraformName
: Addressed in Use config.Reference.TerraformName instead of config.Reference.Type #1310MaxItems = 1
constraint: Implemented viatraverser.maxItemsSync
in Add config.Resource.RemoveSingletonListConversion crossplane/upjet#411How has this code been tested
Validated in #1334 via uptest runs.