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

Create AccessLogPolicy CRD #420

Merged
merged 7 commits into from
Oct 4, 2023
Merged

Create AccessLogPolicy CRD #420

merged 7 commits into from
Oct 4, 2023

Conversation

xWink
Copy link
Member

@xWink xWink commented Oct 3, 2023

What type of PR is this?

Feature

Which issue does this PR fix:
#200 partially

What does this PR do / Why do we need it:

  • Adds new CRD for AccessLogPolicy, which will be used in new reconcilers to create VPC Lattice Access Log Subscriptions

If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:

Testing done on this change:

N/A

Automation added to e2e:

N/A

Will this PR introduce any new dependencies?:

No

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
New CRD can be applied, but is not used by controller yet.

To apply new CRD, run kubectl apply -f config/crds/bases/application-networking.k8s.aws_accesslogpolicies.yaml

Does this PR introduce any user-facing change?:

No


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

@xWink xWink requested a review from solmonk October 3, 2023 19:52
@coveralls
Copy link

coveralls commented Oct 3, 2023

Pull Request Test Coverage Report for Build 6399132954

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 45.77%

Totals Coverage Status
Change from base Build 6397730726: 0.0%
Covered Lines: 3825
Relevant Lines: 8357

💛 - Coveralls

listKind: AccessLogPolicyList
plural: accesslogpolicies
shortNames:
- tgp
Copy link
Contributor

Choose a reason for hiding this comment

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

need to fix this, btw this field is used for kubectl get tgp, etc as a shorthand

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed next commit, thanks for catching this!


// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api,shortName=tgp
Copy link
Contributor

Choose a reason for hiding this comment

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

shortName=alp

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed next commit, thanks for catching this!

//
// Changes to this value results in replacement of the VPC Lattice Access Log Subscription.
// +optional
DestinationArn *string `json:"protocol,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be json:"destinationarn,omitempty"

do we need add arn format validation logic in the accesslogpolicy_types.go (by +kubebuilder:validation:Pattern=)?

Copy link
Member Author

@xWink xWink Oct 3, 2023

Choose a reason for hiding this comment

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

Set to destinationArn (camelCase) next commit.

Also added the format validation logic so that it matches the pattern used in the VPC Lattice API (Pattern=^arn(:[a-z0-9]+([.-][a-z0-9]+)*){2}(:([a-z0-9]+([.-][a-z0-9]+)*)?){2}:([^/].*)?)

https://docs.aws.amazon.com/vpc-lattice/latest/APIReference/API_CreateAccessLogSubscription.html#vpclattice-CreateAccessLogSubscription-request-destinationArn

Copy link
Contributor

@zijun726911 zijun726911 left a comment

Choose a reason for hiding this comment

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

LGTM, @solmonk @mikhail-aws please take a look if you have a time

@@ -0,0 +1,95 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

why we duplicate crd and template to helm? may be there is a difference that I couldn't spot

Copy link
Member Author

Choose a reason for hiding this comment

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

I noticed this is how we did it with previous CRD additions, such as https://github.com/aws/aws-application-networking-k8s/pull/339/files

@xWink
Copy link
Member Author

xWink commented Oct 4, 2023

Added the status subresource, which was previously missing. This is required as part of the Policy definition in Gateway API https://gateway-api.sigs.k8s.io/geps/gep-713/#on-policy-objects

@xWink xWink merged commit a240065 into aws:main Oct 4, 2023
5 checks passed
@xWink xWink deleted the access-logs-crd branch October 4, 2023 20:04
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.

5 participants