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

[Backport provider-aws-release-1.9] Expose conversion option to inject key/values in the conversion to list #468

Conversation

turkenh
Copy link
Member

@turkenh turkenh commented Feb 7, 2025

Note

Backport of #465 to provider-aws-release-1.9.

Description of your changes

We have observed some issue with the EKS Cluster resource where when we apply the manifest and let it to resolve references to spec.forProvider.vpcConfig.securityGroupIds, we noticed the following error in the status:

  - lastTransitionTime: "2025-02-06T07:28:46Z"
    message: 'cannot patch the managed resource via server-side apply: Cluster.eks.aws.upbound.io
      "some-eks-cluster" is invalid: [spec.forProvider.vpcConfig: Invalid
      value: "null": spec.forProvider.vpcConfig in body must be of type array: "null",
      <nil>: Invalid value: "null": some validation rules were not checked because
      the object was invalid; correct the existing errors to complete validation]'
    reason: ReconcileError
    status: "False"
    type: Synced

Our assumption (which is validated by observing this changes fixes the problem) is as follows:

Server Side Apply uses merge strategies to make decisions during merging changes by various owners/managers. In EKS Cluster object, for vpcConfig field, we mark +listType as map and //+listMapKey as index. During conversion between v1beta1 to v1beta2, we convert the that field from array to object, losing the index field since it is not in the schema. This is fine in most cases since in v1beta1 of the object schema index defaults to "0" , even though you don’t provide it.

However, with Server Side Apply, apparently some on the fly conversions happening when different managers using different api versions and losing index field causing unexpected merging results and drop of the whole spec.forProvider.vpcConfig object.

I have:

  • Read and followed Upjet's [contribution process].
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Unit tests and a custom build for provider-aw-eks with this change.

Here is the reproducer for the original issue: https://github.com/turkenh/upjet-pr-465-reproducer

@turkenh turkenh changed the base branch from main to provider-aws-release-1.9 February 7, 2025 08:23
Copy link
Member

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @turkenh LGTM!

@sergenyalcin sergenyalcin merged commit 1677191 into crossplane:provider-aws-release-1.9 Feb 7, 2025
7 checks passed
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.

2 participants