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

Overriding an initProvider list in forProvider after the resource is created may cause an update loop #303

Open
mergenci opened this issue Nov 27, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@mergenci
Copy link
Member

mergenci commented Nov 27, 2023

What happened?

This is a known issue of Upjet v1.0.0. An infinite update loop occurs when the following conditions hold at the same time:

  1. The resource is created with an initProvider field of type schema.TypeList, such as private_ip_list,
  2. After the resource is created, the field is overridden in forProvider,
  3. Overriding value has different length than overridden value.

The problem stems from the fact that length keys are deleted from diffs of initProvider-exclusive fields. Details are explained in comments.

I have developed a work-in-progress potential solution, which has neither been tested in depth nor reviewed.

How can we reproduce it?

We will create a VPC Network Interface to reproduce the issue. Because the resource depends on a VPC Subnet, which in-turn depends on a VPC, we will first create those.

  1. Create VPC and Subnet resources by applying the following configuration (Note: These resources can be monitored from VPC Console and Subnet Console):
apiVersion: ec2.aws.upbound.io/v1beta1
kind: VPC
metadata:
  name: test-upjet-issue-303-vpc
spec:
  forProvider:
    region: us-west-1
    cidrBlock: 172.16.0.0/16
    tags:
      Name: test-upjet-issue-303-vpc

---

apiVersion: ec2.aws.upbound.io/v1beta1
kind: Subnet
metadata:
  name: test-upjet-issue-303-subnet
spec:
  forProvider:
    region: us-west-1
    availabilityZone: us-west-1b
    cidrBlock: 172.16.10.0/24
    vpcIdRef:
      name: test-upjet-issue-303-vpc
  1. Create Network Interface by applying the following configuration (Note: Network Interface Console is under EC2 Console):
apiVersion: ec2.aws.upbound.io/v1beta1
kind: NetworkInterface
metadata:
  name: test-upjet-issue-303-networkinterface
spec:
  initProvider:
    privateIpListEnabled: True
    privateIpList:
      - "172.16.10.100"
      - "172.16.10.101"
      - "172.16.10.102"
  forProvider:
    region: us-west-1
    subnetIdRef:
      name: test-upjet-issue-303-subnet
  1. Modify the resource by applying the following configuration:
apiVersion: ec2.aws.upbound.io/v1beta1
kind: NetworkInterface
metadata:
  name: test-upjet-issue-303-networkinterface
spec:
  initProvider:
    privateIpListEnabled: True
    privateIpList:
      - "172.16.10.100"
      - "172.16.10.101"
      - "172.16.10.102"
  forProvider:
    region: us-west-1
    privateIpList:
      - "172.16.10.103"
      - "172.16.10.104"
    subnetIdRef:
      name: test-upjet-issue-303-subnet
  1. Check out provider logs to see the update loop. You can apply the configuration in Step 2 above, to stop the update loop.

Related Issues

#298 (duplicate of crossplane-contrib/provider-upjet-aws#946), #295, #299

@mergenci mergenci added the bug Something isn't working label Nov 27, 2023
@jeanduplessis jeanduplessis added this to the 1.2 milestone Feb 3, 2024
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

2 participants