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

Convert all singleton lists in the MR APIs to embedded objects #1332

Merged
merged 10 commits into from
Jun 13, 2024

Conversation

ulucinar
Copy link
Collaborator

@ulucinar ulucinar commented May 29, 2024

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 is v1beta1 and in the v1beta3 version if the current version is v1beta2 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 or v1beta3 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:

How has this code been tested

Validated in #1334 via uptest runs.

@ulucinar
Copy link
Collaborator Author

/test-examples="examples/opensearchserverless/v1beta1/securityconfig.yaml"

@mbbush
Copy link
Collaborator

mbbush commented May 31, 2024

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?

@ulucinar
Copy link
Collaborator Author

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]>
…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]>
@ulucinar ulucinar force-pushed the embed-singleton branch 2 times, most recently from a8b7288 to 2a2c7af Compare June 12, 2024 18:31
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Copy link
Collaborator

@turkenf turkenf left a 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.

@ulucinar
Copy link
Collaborator Author

We are adding the missing example manifest (which is also the reason the check-examples job is failing for this PR) in #1334...

@ulucinar ulucinar merged commit 74f9b28 into crossplane-contrib:main Jun 13, 2024
10 of 11 checks passed
@ulucinar ulucinar deleted the embed-singleton branch June 13, 2024 10:57
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.

3 participants