-
Notifications
You must be signed in to change notification settings - Fork 52
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
Access Log Policy Controller #424
Conversation
…oute reconciler info logs, remove use of struct embedding in logs
Before, we handle |
We opted to handle AccessLogPolicy as its own standalone resource in the Kubernetes setting because it's its own standalone resource in the VPC Lattice setting. Since Access Log Subscription has its own lifecycle, so should Access Log Policy. This simplifies handling some of the create/delete/update cases vs. only adding event handling to existing controllers, which would increase their complexities substantially. |
group: gateway.networking.k8s.io | ||
kind: Gateway | ||
name: my-hotel | ||
destinationArn: "arn:aws:s3:::my-bucket" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a general question on the feature. How are we planning on reporting back the actual log paths? From what I recall, logs are based on unique resource ids, not names. How will folks using the controller know which logs apply to which k8s resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure I follow, so please correct me if I'm going down the wrong path here. When a user creates a Gateway or Route, that resource is associated to 1 VPC Lattice Service Network or Service. When they create an AccessLogPolicy with a targetRef of a Gateway or Route, it's the equivalent of creating a VPC Lattice Access Log Subscription for the corresponding ServiceNetwork or Service.
So if I create Gateway my-hotel
, which in VPC Lattice is Service Network sn-12345678901234567
, and then create an AccessLogPolicy which refers to Gateway my-hotel
, then it will create an AccessLogSubscription with resourceIdentifier sn-12345678901234567
, and any access logs flowing through that Service Network will wind up in the log destination I specified in the AccessLogPolicy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. So the path in S3 would look like [1]:
[bucket]/[prefix]/AWSLogs/[accountId]/VpcLattice/AccessLogs/[region]/[YYYY/MM/DD]/[resource-id]/[accountId]_VpcLatticeAccessLogs_[region]_[resource-id]_YYYYMMDDTHHmmZ_[hash].json.gz
Let's assume I have a number of gateways I'm managing - how will I know the Lattice resource ID for each? For example, do we patch the gateway with the Lattice service network ID? I see it as a message here: https://github.com/aws/aws-application-networking-k8s/blob/main/controllers/gateway_controller.go#L279. Ideally, I would be able to find out the ID by doing something like kubectl get gateway
.
Similarly, it may be difficult to map from a k8s route to a log line, or from a log line back to the k8s objects, since these log entries also use unique IDs rather than k8s-based names. Maybe for now just enabling the logs is enough, then customers can use the Lattice API out of band to determine the ID. Longer term we should look a improving this experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch the status(or annotation) of gateway
and k8sService
resource with lattice resource id and Patch AccessLogPolicy with als id seems a good approach to make mapping cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this would absolutely improve clarity for users. I'll look into making this an annotation for ALP (don't think status is the right place for this kind of data), and will add it as a followup once the Create workflow is done. We can also create an issue to add this behaviour to other resources, like Gateway and Route.
Are there any remaining concerns regarding this PR that need addressing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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:
Output of
kubectl describe alp test-policy
after creation:Output after updating the destinationArn
If an issue # is not available please add repro steps and logs from aws-gateway-controller showing the issue:
Testing done on this change:
Automation added to e2e:
Will this PR introduce any new dependencies?:
No
Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No
Does this PR introduce any user-facing change?:
Not yet, since use of the AccessLogPolicy doesn't achieve anything
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.