Skip to content

Conversation

@zijun726911
Copy link
Contributor

What type of PR is this?

Which issue does this PR fix:

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

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?:

Will this break upgrades or downgrades. Has updating a running cluster been tested?:

Does this PR introduce any user-facing change?:


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

@solmonk
Copy link
Contributor

solmonk commented Sep 27, 2023

Haven't had a chance to review the doc yet, but please make sure any new doc change is included in mkdocs.yml to add them on the website.

@zijun726911 zijun726911 force-pushed the vpc_association_policy_doc branch from 5f8bfef to aae22e7 Compare September 27, 2023 21:30
@zijun726911 zijun726911 force-pushed the vpc_association_policy_doc branch from aae22e7 to 418f164 Compare September 27, 2023 21:32

| Source | Protocol | Port Range | Comment |
|-----------------------------|-----------------------------------------------------|-------------------------------------------------|-----------------------------------------------------------|
| Kubernetes cluster VPC CIDR | protocols defined in the gateway's listener section | ports defined in the gateway's listener section | Allow inbound traffic from current cluster vpc to gateway |

Choose a reason for hiding this comment

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

Can we add - "or security group reference" - Incase they don't want to use CIDR/IP addresses.

@coveralls
Copy link

coveralls commented Sep 27, 2023

Pull Request Test Coverage Report for Build 6358392373

  • 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 46.026%

Totals Coverage Status
Change from base Build 6355409430: 0.0%
Covered Lines: 3874
Relevant Lines: 8417

💛 - Coveralls


When attaching a policy to a resource, the following restrictions apply:

* A policy can be only attached to `Gateway` resources.
Copy link
Member

Choose a reason for hiding this comment

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

It's typically advised to not use the word "only" when describing limitations.

Alternative wording would be "Policies must be attached to Gateway resources."

When attaching a policy to a resource, the following restrictions apply:

* A policy can be only attached to `Gateway` resources.
* The attached resource should exist in the same namespace as the policy resource.
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

The attached resource must exist in the same namespace as the policy resource ("should" sounds suggestive, rather than mandatory).

The security Group will not take effect if:

* The targetRef `Gateway` does not exist
* AssociateWithVpc field set to false
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

What AssociateWithVpc field?

Also, grammar nitpick: "associateWithVpc is set to false"


**WARNING**

Current VPC Lattice updateServiceNetworkVpcAssociation api have a limitation that it cannot remove all security groups.
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

"The VPC Lattice UpdateServiceNetworkVpcAssociation API cannot be used to remove all security groups."

Current VPC Lattice updateServiceNetworkVpcAssociation api have a limitation that it cannot remove all security groups.
That means, if you have a VpcAssociationPolicy attached to a gateway that already applied security groups, following operations will NOT take effect to remove the security groups:
* Update the VPCAssociationPolicy to empty the security group ids (even though the updated VPCAssociationPolicy can be accepted by the API server)
* Delete the VPCAssociationPolicy (even though the VPCAssociationPolicy can be deleted from k8s successfully)
Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify, if the customer tries these steps, it will NOT work? If so, we should not list them as part of the documentation at all, and instead just give guidance on what they should do.

* Delete the VPCAssociationPolicy (even though the VPCAssociationPolicy can be deleted from k8s successfully)

To remove security groups, instead, you should delete VPC Association and then create a new VPC Association without security group ids by following steps:
1. Update the VPCAssociationPolicy with AssociateWithVpc is false and empty security group ids
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

"Update the VPCAssociationPolicy by setting associateWithVpc to false and with empty security group ids"

1. Update the VPCAssociationPolicy with AssociateWithVpc is false and empty security group ids
2. Update the VPCAssociationPolicy with AssociateWithVpc is true and empty security group ids

Be cautious to set AssociateWithVpc to false. That can break traffic from the current cluster workloads to the gateway.
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

Perhaps this should be a note that simply says "Note: Setting associateWithVpc to false will disable traffic from the current cluster workloads to the gateway."

Be cautious to set AssociateWithVpc to false. That can break traffic from the current cluster workloads to the gateway.


| Field | Description |
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

This table needs a title




| Field | Description |
Copy link
Member

@xWink xWink Sep 28, 2023

Choose a reason for hiding this comment

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

Possibly a Required column would help with clarifying whether a field is optional, and a Type column would make it easier to see what type of property it is, instead of lumping it in with the property name

Copy link
Member

@xWink xWink left a comment

Choose a reason for hiding this comment

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

Great start, just needs some grammar and format cleanup.


### Fields of VpcAssociationPolicy

| Field Name | Required | Description |
Copy link
Member

@xWink xWink Sep 29, 2023

Choose a reason for hiding this comment

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

Would be good to have a Type column for easier reading


| Field Name | Type | Required | Description |
|--------------------|-----------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `targetRef` | *[PolicyTargetReference](https://gateway-api.sigs.k8s.io/geps/gep-713/#policy-targetref-api)* | Yes | TargetRef points to the kubernetes `Gateway` resource that will have this policy attached. This field is following the guidelines of Kubernetes Gateway API policy attachment. |
Copy link
Member

Choose a reason for hiding this comment

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

"This field is following the guidelines of Kubernetes Gateway API policy attachment." can be shortened to "Follows the guidelines of Kubernetes Gateway API policy attachment", but do we need this sentence if we already link to it in the hyperlink on PolicyTargetReference, or is this a different guideline? If it is a different guideline, we should hyperlink to it

|--------------------|-----------------------------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `targetRef` | *[PolicyTargetReference](https://gateway-api.sigs.k8s.io/geps/gep-713/#policy-targetref-api)* | Yes | TargetRef points to the kubernetes `Gateway` resource that will have this policy attached. This field is following the guidelines of Kubernetes Gateway API policy attachment. |
| `associateWithVpc` | *bool* | No | Indicates whether the targetRef Gateway is associated with the current k8s cluster VPC. By default, the Gateway API controller sets this to true if it's not defined in VpcAssociationPolicy. |
| `securityGroupIds` | *string[]* | No | Defines security groups applied to the gateway (ServiceNetworkVpcAssociation), it controls the inbound traffic from current cluster workloads to the gateway listeners. Please check the [VPC lattice doc](https://docs.aws.amazon.com/vpc-lattice/latest/ug/security-groups.html) for more detail of this field. |
Copy link
Member

Choose a reason for hiding this comment

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

VPC Lattice (capitalize the L)

* Policies must be attached to *Gateway* resource.
* The attached resource must exist in the same namespace as the policy resource.

The security Group will not take effect if:
Copy link
Member

@xWink xWink Sep 29, 2023

Choose a reason for hiding this comment

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

security group (lowercase S, keep capitalization consistent)

The security Group will not take effect if:

* The targetRef `Gateway` does not exist
* AssociateWithVpc field set to false
Copy link
Member

Choose a reason for hiding this comment

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

The associateWithVpc field is set to false

**WARNING**

The VPC Lattice `UpdateServiceNetworkVpcAssociation` API cannot be used to remove all security groups.
That means, if you have a VpcAssociationPolicy attached to a gateway that already applied security groups, update the VPCAssociationPolicy with empty security group ids or delete the whole VPCAssociationPolicy will NOT remove the security groups from this gateway.
Copy link
Member

Choose a reason for hiding this comment

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

VpcAssociationPolicy should be capitalized consistently (there are a bunch of places here and below where it's written as VPCAssociationPolicy)

**WARNING**

The VPC Lattice `UpdateServiceNetworkVpcAssociation` API cannot be used to remove all security groups.
That means, if you have a VpcAssociationPolicy attached to a gateway that already applied security groups, update the VPCAssociationPolicy with empty security group ids or delete the whole VPCAssociationPolicy will NOT remove the security groups from this gateway.
Copy link
Member

Choose a reason for hiding this comment

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

"That means" is redundant. Can replace sentence with "If you have a VpcAssociationPolicy attached to a gateway that already has security groups applied, updating the VpcAssociationPolicy with empty security group ids or deleting the VpcAssociationPolicy will NOT remove the security groups from the gateway."

1. Update the VPCAssociationPolicy by setting associateWithVpc to false and empty security group ids
2. Update the VPCAssociationPolicy by setting associateWithVpc to true and empty security group ids

Be cautious to set AssociateWithVpc to false. It will disable traffic from the current cluster workloads to the gateway.
Copy link
Member

Choose a reason for hiding this comment

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

"Note: Setting associateWithVpc to false will disable traffic from the current cluster workloads to the gateway"


## Example Configuration

This example shows how to configure a Gateway with associateWithVpc set to true and apply security group sg-1234567890 and sg-0987654321
Copy link
Member

Choose a reason for hiding this comment

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

Let's stay consistent with capitalization of words like "gateway". I see it always lowercase above.

Also, let's wrap fields as inline code (i.e. associateWithVpc).

Copy link
Member

@xWink xWink left a comment

Choose a reason for hiding this comment

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

Few more changes and it'll be spotless :)

@zijun726911 zijun726911 force-pushed the vpc_association_policy_doc branch from 84fddff to 5dee6a3 Compare September 29, 2023 23:41
@zijun726911 zijun726911 force-pushed the vpc_association_policy_doc branch from 5dee6a3 to 0fe3258 Compare September 29, 2023 23:44
@zijun726911
Copy link
Contributor Author

@xWink Thanks for your detailed comments! I think I should have addressed all of them, please review again when you have a time, thank you!


### Fields of VpcAssociationPolicy

| Field Name | Type | | Required | Description |
Copy link
Member

Choose a reason for hiding this comment

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

Seems to be an extra | character here, breaking the table


The security group will not take effect if:

* The targetRef `gateway` does not exist.
Copy link
Member

Choose a reason for hiding this comment

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

targetRef is the field that should be inline code, not gateway


| Field Name | Type | Required | Description |
|--------------------|-----------------------------------------------------------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `targetRef` | *[PolicyTargetReference](https://gateway-api.sigs.k8s.io/geps/gep-713/#policy-targetref-api)* | Yes | TargetRef points to the kubernetes `Gateway` resource that will have this policy attached. It follows the guidelines of Kubernetes Gateway API policy attachment |
Copy link
Member

Choose a reason for hiding this comment

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

This sentence could flow better like so:

Points to the Kubernetes Gateway resource that will have this policy attached, following the guidelines of [Kubernetes Gateway API policy attachment](link-to-guidelines).

Copy link
Member

@xWink xWink left a comment

Choose a reason for hiding this comment

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

One more fix and a couple of nitpicks!

Copy link
Member

@xWink xWink left a comment

Choose a reason for hiding this comment

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

Stunning!

@zijun726911 zijun726911 merged commit 3e156e8 into aws:main Oct 3, 2023
@zijun726911 zijun726911 deleted the vpc_association_policy_doc branch October 3, 2023 19:53
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