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

Add example for AWS feature: Security Groups for Pods #1429

Merged
merged 6 commits into from
Oct 10, 2024

Conversation

flostadler
Copy link
Contributor

This adds an example (and acceptance test) for the AWS feature: Security Groups for Pods.

The configuration is derived from this AWS example: https://docs.aws.amazon.com/eks/latest/userguide/security-groups-pods-deployment.html

@flostadler flostadler requested review from t0yv0, corymhall and a team October 8, 2024 20:16
@flostadler flostadler self-assigned this Oct 8, 2024
Copy link

github-actions bot commented Oct 8, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@flostadler flostadler added the needs-release/major Marking a PR to compute the next major version label Oct 8, 2024
@flostadler flostadler force-pushed the flostadler/sgs-for-pods-example branch from 1b663de to 19656ca Compare October 8, 2024 21:49
},
}, { provider: kube, dependsOn: [nginx, callerSgp] });

function configureClusterAccess(name: string, cluster: eks.Cluster, sg: aws.ec2.SecurityGroup) {
Copy link
Member

Choose a reason for hiding this comment

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

Should this live in a helper file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's an important part of this example (allowing the pods to reach things like coredns). Putting it into another file would hide that aspect IMO

Copy link
Member

Choose a reason for hiding this comment

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

Hmm ok. I'm surprised it works while written at the bottom of the file but I guess that's how Node works.

},
}, { provider: kube });

// Create a job that is not allowed to curl the nginx service. The job will fail if it can reach the service.
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a counter-example to test something instead of a best-practice example of how to GTD, or am I misunderstanding? Does it belong under ./examples?

Copy link
Contributor Author

@flostadler flostadler Oct 9, 2024

Choose a reason for hiding this comment

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

I'd say showing how traffic can be restricted is an important part of a firewall example.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, yeah I concede the point. A few comments to that end then perhaps? Maybe in the readme? I still get confused by mixing tests and examples in one.

const callerSg = new aws.ec2.SecurityGroup("caller", {
vpcId: eksVpc.vpcId,
});
// Allow all traffic between the cluster and the caller SecurityGroup
Copy link
Member

Choose a reason for hiding this comment

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

Consider consistent spacing. My eye not trained on TypeScript style but should this have an empty line before //?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh, that was by accident. Somehow format on save was turned off

@@ -0,0 +1,3 @@
# EKS Pod Security Groups

Demonstrates how to configure your Pulumi EKS Cluster to use Pod Security Groups.
Copy link
Member

Choose a reason for hiding this comment

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

It could be cute to include a mermaid diagram that shows what talks to what in this example, but it may be a lot of work. Wonder if AI can do a quick pass at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! I added one

@flostadler flostadler merged commit 45ce9dc into release-3.x.x Oct 10, 2024
34 checks passed
@flostadler flostadler deleted the flostadler/sgs-for-pods-example branch October 10, 2024 09:58
flostadler added a commit that referenced this pull request Oct 17, 2024
This adds an example (and acceptance test) for the AWS feature: Security
Groups for Pods.

The configuration is derived from this AWS example:
https://docs.aws.amazon.com/eks/latest/userguide/security-groups-pods-deployment.html
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.0.0-beta.2.

flostadler added a commit that referenced this pull request Oct 17, 2024
This adds an example (and acceptance test) for the AWS feature: Security
Groups for Pods.

The configuration is derived from this AWS example:
https://docs.aws.amazon.com/eks/latest/userguide/security-groups-pods-deployment.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-release/major Marking a PR to compute the next major version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants