Skip to content

Use server-side apply patch to update the resolved cross-resource references#623

Merged
turkenh merged 1 commit intocrossplane:masterfrom
ulucinar:ssa-simple-api-resolver
Dec 11, 2023
Merged

Use server-side apply patch to update the resolved cross-resource references#623
turkenh merged 1 commit intocrossplane:masterfrom
ulucinar:ssa-simple-api-resolver

Conversation

@ulucinar
Copy link
Copy Markdown
Contributor

@ulucinar ulucinar commented Dec 7, 2023

Description of your changes

This PR proposes to use server-side apply patch operations in managed.APISimpleReferenceResolver when updating the resolved cross-resource references. This will enable us to address the issue reported in crossplane-contrib/provider-upjet-aws#975 by specifying the SSA merge strategy for the object list spec.forProvider.vpcConfig and with the root cause described in detail here.

An example patch document computed while updating the resolved VPC ID for the following manifests:

apiVersion: ec2.aws.upbound.io/v1beta1
kind: VPC
metadata:
  name: sample-vpc-alper-1
  labels:
    app: test
spec:
  initProvider:
    cidrBlock: 172.16.0.0/16
    tags:
      a: b
  forProvider:
    region: us-west-1
    tags:
      Name: DemoVpc

---

apiVersion: ec2.aws.upbound.io/v1beta1
kind: Subnet
metadata:
  name: sample-subnet-alper-1
spec:
  forProvider:
    region: us-west-1
    availabilityZone: us-west-1b
    cidrBlock: 172.16.10.0/24
    vpcIdSelector:
      matchLabels:
        app: test

is:

{
  "apiVersion": "ec2.aws.upbound.io/v1beta1",
  "kind": "Subnet",
  "spec": {
    "forProvider": {
      "vpcId": "vpc-08f590a352d767c2f",
      "vpcIdRef": {
        "name": "sample-vpc-alper-1"
      }
    }
  }
}

And the resulting managed field object is:

{
    "apiVersion": "ec2.aws.upbound.io/v1beta1",
    "fieldsType": "FieldsV1",
    "fieldsV1": {
      "f:spec": {
        "f:forProvider": {
          "f:vpcId": {},
          "f:vpcIdRef": {
            "f:name": {}
          }
        }
      }
    },
    "manager": "managed.crossplane.io/api-simple-reference-resolver",
    "operation": "Apply",
    "time": "2023-12-07T14:51:26Z"
  }

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Tested via a custom build of upbound/provider-aws with the above manifests and also with the configuration packages upbound/configuration-aws-eks and upbound/configuration-aws-network in the context of crossplane-contrib/provider-upjet-aws#975. The AWS family provider packages used in these tests are index.docker.io/ulucinar/provider-aws-{ec2, iam, eks}:v0.45.0-c914fe18a92011992e32630ca4d0dba4a8f36242 and the configuration packages are index.docker.io/ulucinar/configuration-aws-{network, eks}:v0.45.0-c914fe18a92011992e32630ca4d0dba4a8f36242.

Loading
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