Skip to content

Add support for WebACL CRD #7

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

Closed

Conversation

TiberiuGC
Copy link
Contributor

Issue #, if available: aws-controllers-k8s/community#1300

Description of changes:

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

Copy link

ack-prow bot commented Aug 8, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ack-prow ack-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 8, 2024
Copy link

ack-prow bot commented Aug 8, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: TiberiuGC
Once this PR has been reviewed and has the lgtm label, please assign a-hilaly for approval by writing /assign @a-hilaly in a comment. For more information see the Kubernetes Code Review Process.

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

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

@ack-prow ack-prow bot requested a review from a-hilaly August 8, 2024 11:17
@TiberiuGC
Copy link
Contributor Author

/test all

ack-prow bot pushed a commit to aws-controllers-k8s/code-generator that referenced this pull request Aug 14, 2024
Issue #, if available: prerequisite for WAFv2 [RuleGroup](aws-controllers-k8s/wafv2-controller#6) and [WebACL](aws-controllers-k8s/wafv2-controller#7) CRDs

Description of changes:

Some WAFv2 API fields have empty json specs `{}`, e.g. https://docs.aws.amazon.com/waf/latest/APIReference/API_AllQueryArguments.html

For these type of fields, codegen currently errors out because it infers their gotypes as e.g. 
`AllQueryArguments *AllQueryArguments`

but does not generate a `type AllQueryArguments struct` since the struct itself is empty, and not picked up by `newFieldRecurse` function.

The solution proposed in this PR is to allow users to define `marker-shapes`, which instruct codegen to overwrite the type of these empty structs as `[]byte`, both when generating the APIs and when setting up the SDK. 

e.g. [generator.yaml](https://github.com/aws-controllers-k8s/wafv2-controller/blob/bb682409da8f96c5035783602b9d948c8cc8e21f/apis/v1alpha1/generator.yaml#L15-L24) for WAFv2, and inline:

```
empty_shapes:
- All
- Method
- UriPath
- QueryString
- AllQueryArguments
- RateLimitIP
- RateLimitForwardedIP
- RateLimitHTTPMethod
- NoneAction
```

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

ack-prow bot commented Aug 30, 2024

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

Test name Commit Details Required Rerun command
wafv2-verify-attribution 525bc1a link true /test wafv2-verify-attribution

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@TiberiuGC TiberiuGC closed this Sep 5, 2024
@TiberiuGC TiberiuGC deleted the resource/web-acl branch September 5, 2024 14:33
ack-prow bot pushed a commit that referenced this pull request Sep 10, 2024
Issue #, if available:

Description of changes:
- on top of, and to be reviewed after #7
- nested statements are allowed in yaml files via strings e.g.
```
      statement:
        andStatement: |
          statements:
            - labelMatchStatement:
                scope: "RULE_SET"
                key: "aws:UserAgent"
                value: "Mozilla"
            - ipSetReferenceStatement:
                arn: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
```

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant