Skip to content

Add support for renamed nested fields - #721

Open
visit1985 wants to merge 1 commit into
aws-controllers-k8s:mainfrom
visit1985:main
Open

Add support for renamed nested fields#721
visit1985 wants to merge 1 commit into
aws-controllers-k8s:mainfrom
visit1985:main

Conversation

@visit1985

Copy link
Copy Markdown
Contributor

Issue #, if available:

aws-controllers-k8s/community#2173

Description of changes:

In order to support references in WAFv2, it is necessary to rename (add some prefix to) nested IPSetReferenceStatement.ARN and RuleGroupReferenceStatement.ARN fields. This is an attempt to support this in the code-generator.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow
ack-prow Bot requested review from jlbutler and michaelhtm July 12, 2026 19:31
@ack-prow

ack-prow Bot commented Jul 12, 2026

Copy link
Copy Markdown

Hi @visit1985. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ack-prow ack-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 12, 2026
@michaelhtm michaelhtm self-assigned this Jul 16, 2026
@michaelhtm

Copy link
Copy Markdown
Member

Hey @visit1985, Thanks for the contribution!
I'm not sure i understand tho how this change addresses the linked issue.
Can you maybe open a wafv2 PR showing what this would look like?

@visit1985

visit1985 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Hey @visit1985, Thanks for the contribution! I'm not sure i understand tho how this change addresses the linked issue. Can you maybe open a wafv2 PR showing what this would look like?

@michaelhtm, aws-controllers-k8s/community#2173 requires to enable references on WebACLs and RuleGroups RuleGroupReferenceStatement.ARN and IPSetReferenceStatement.ARN.

Reference field names are generated by removing the identifier suffix (ARN) and adding Ref(s) as suffix.

if refNamePrefix == "" {
return names.Names{}, fmt.Errorf(
"reference field name cannot be just an identifier suffix (id/arn/name) — field: %s",
f.Names.Original,
)
}

So, we either rename the ARN field before creating the reference, or we allow ref(s) without a prefix as field name.

This PR fixes additional name conversion issues in nested field code paths that I didn't catch in #692.
e.g. Rules.Statement.IPSetReferenceStatement.ARN to IPSetARN

I'm aware that the rename of the ARN field would be a breaking change in the WAFv2 CRDs. If you prefer to allow ref(s) without a prefix for that specific case, I can open another PR for that. Nevertheless, this PR may be beneficial for other undiscovered edge cases.

Let me know what you think.

(cherry picked from commit bbbd6c4)
@ack-prow

ack-prow Bot commented Aug 6, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: visit1985
Once this PR has been reviewed and has the lgtm label, please ask for approval from michaelhtm. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knottnt

knottnt commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

/test all

@knottnt

knottnt commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Hey @visit1985, Thanks for the contribution! I'm not sure i understand tho how this change addresses the linked issue. Can you maybe open a wafv2 PR showing what this would look like?

@michaelhtm, aws-controllers-k8s/community#2173 requires to enable references on WebACLs and RuleGroups RuleGroupReferenceStatement.ARN and IPSetReferenceStatement.ARN.

Reference field names are generated by removing the identifier suffix (ARN) and adding Ref(s) as suffix.

if refNamePrefix == "" {
return names.Names{}, fmt.Errorf(
"reference field name cannot be just an identifier suffix (id/arn/name) — field: %s",
f.Names.Original,
)
}

So, we either rename the ARN field before creating the reference, or we allow ref(s) without a prefix as field name.

This PR fixes additional name conversion issues in nested field code paths that I didn't catch in #692. e.g. Rules.Statement.IPSetReferenceStatement.ARN to IPSetARN

I'm aware that the rename of the ARN field would be a breaking change in the WAFv2 CRDs. If you prefer to allow ref(s) without a prefix for that specific case, I can open another PR for that. Nevertheless, this PR may be beneficial for other undiscovered edge cases.

Let me know what you think.

@visit1985 I don't think we'd want to rename the existing fields since, as you've noted, that would be a breaking change to the CRDs. Having a bare ref field with no prefix could be confusing. Maybe instead we could update the ReferencesConfig to allow for a custom prefix to supplied. For WAFv2 we could then provide the IPSet and RuleGroupReferenceStatementas custom prefixes.

For this PR, I do agree that the ability to rename nested fields could be useful for future ACK resources.

cc: @michaelhtm

@ack-prow

ack-prow Bot commented Aug 13, 2026

Copy link
Copy Markdown

@visit1985: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
s3-controller-test e3a7389 link true /test s3-controller-test
unit-test e3a7389 link true /test unit-test
dynamodb-controller-test e3a7389 link true /test dynamodb-controller-test

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants