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

fix(ec2): fix ipv6 field issues in ec2 group #109

Merged
merged 3 commits into from
Jun 8, 2023

Conversation

haarchri
Copy link
Member

@haarchri haarchri commented Nov 1, 2022

Signed-off-by: Christopher Paul Haar [email protected]

Description of your changes

we tested today upbound/provider-aws and found 2 issues regarding ipv6 fields in aws_instance and aws_network_interface - looks like this issue has open PRs in crossplane-contrib/provider-jet-aws as well

    message: |-
      observe failed: cannot run refresh: refresh failed: Conflicting configuration arguments: "ipv6_addresses": conflicts with ipv6_address_count: File name: main.tf.json
      Conflicting configuration arguments: "ipv6_address_count": conflicts with ipv6_addresses: File name: main.tf.json

crossplane-contrib/provider-jet-aws#227
crossplane-contrib/provider-jet-aws#228

Fixes #

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

apply instance with network interface

@Upbound-CLA
Copy link

Upbound-CLA commented Nov 1, 2022

CLA assistant check
All committers have signed the CLA.

@haarchri
Copy link
Member Author

haarchri commented Nov 1, 2022

/test-examples="examples/ec2/instance.yaml,examples/ec2/networkinterface.yaml"

@muvaf
Copy link
Member

muvaf commented Nov 2, 2022

/test-examples="examples/ec2/instance.yaml,examples/ec2/networkinterface.yaml"

@muvaf
Copy link
Member

muvaf commented Nov 2, 2022

@haarchri Do you see Uptest passing in your local?

@turkenh
Copy link
Contributor

turkenh commented Nov 21, 2022

/test-examples="examples/ec2/instance.yaml"

@turkenh
Copy link
Contributor

turkenh commented Nov 21, 2022

/test-examples="examples/ec2/networkinterface.yaml"

@turkenh
Copy link
Contributor

turkenh commented Nov 21, 2022

Rebased this PR on the latest main and triggered tests individually 🤞

@jeanduplessis
Copy link
Collaborator

/test-examples="examples/ec2/instance.yaml"

@jeanduplessis
Copy link
Collaborator

/test-examples="examples/ec2/networkinterface.yaml"

@jeanduplessis
Copy link
Collaborator

@haarchri would you mind signing the CLA?

@jeanduplessis jeanduplessis added the enhancement New feature or request label Feb 23, 2023
@turkenf
Copy link
Collaborator

turkenf commented Mar 14, 2023

Required status checks have been changed, could you please rebase this PR?

@sergenyalcin
Copy link
Collaborator

@haarchri Could you please rebase this PR? And also for a successful uptest, could you please fix the example manifest of this resource by adding a subnet reference? Thank you :)

@haarchri
Copy link
Member Author

@sergenyalcin yes i will do this

@haarchri haarchri requested a review from ulucinar as a code owner April 27, 2023 18:39
@haarchri
Copy link
Member Author

update the examples:

kubectl get managed
NAME                                        READY   SYNCED   EXTERNAL-NAME              AGE
subnet.ec2.aws.upbound.io/sample-instance   True    True     subnet-09f2b96d10f79e341   5m52s

NAME                                     READY   SYNCED   EXTERNAL-NAME           AGE
vpc.ec2.aws.upbound.io/sample-instance   True    True     vpc-038239817b67cb1e1   5m52s

NAME                                          READY   SYNCED   EXTERNAL-NAME         AGE
instance.ec2.aws.upbound.io/sample-instance   True    True     i-07528490a2525cac9   5m52s

NAME                                                  READY   SYNCED   EXTERNAL-NAME           AGE
networkinterface.ec2.aws.upbound.io/sample-instance   True    True     eni-01c038e72d4a7fcc2   5m52s

@haarchri
Copy link
Member Author

/test-examples="examples/ec2/instance.yaml"

@haarchri
Copy link
Member Author

@sergenyalcin @jeanduplessis done ! test is green - please check again - sorry for late answer

@haarchri haarchri force-pushed the bugfix/ec2-ipv6 branch 2 times, most recently from c62def8 to f4cdb59 Compare April 28, 2023 07:39
Signed-off-by: Christopher Paul Haar <[email protected]>
Signed-off-by: Christopher Paul Haar <[email protected]>
@haarchri
Copy link
Member Author

/test-examples="examples/ec2/instance.yaml"

@@ -173,7 +175,7 @@ func Configure(p *config.Provider) {
}
r.LateInitializer = config.LateInitializer{
IgnoredFields: []string{
"interface_type", "private_ip_list", "private_ips",
"interface_type", "private_ip_list", "private_ips", "ipv6_address_count",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"interface_type", "private_ip_list", "private_ips", "ipv6_address_count",
"interface_type", "private_ip_list", "private_ips", ipv6_addresses, "ipv6_address_count",

I think we usually include both conflicting fields in the IgnoredFields slice.

@ulucinar @sergenyalcin please keep me honest here.

Copy link
Collaborator

@ulucinar ulucinar May 3, 2023

Choose a reason for hiding this comment

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

Yes, agreed. When the native schema declares two configuration arguments as mutually exclusive, we need to ignore them both during late-initialization because we may have set either of them under spec.forProvider and the unset one could be late-initialized at runtime causing a conflict. The argument ipv6_addresses is declared to conflict with the ipv6_address_count and similarly, ipv6_address_count is declared to conflict with with ipv6_addresses.

In this specific case, the relationship is mutual, i.e., ipv6_addresses & ipv6_address_count are mutually exclusive as dictated in the native (Terraform) schema. In theory, this may not always be true (consider a case in which if argument a is set then b gets initialized from a but the reverse is not true, i.e., if b is set, a does not get initialized). I don't know any practical examples of this and I think we had better assume a mutual relationship for late-initialization.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Included ipv6_addresses to IgnoredFields.

@turkenf
Copy link
Collaborator

turkenf commented Jun 7, 2023

/test-examples="examples/ec2/instance.yaml"

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.

Verified with uptest run.

@turkenh turkenh merged commit 27b3569 into crossplane-contrib:main Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants