Azure / PSRule.Rules.Azure

Rules to validate Azure resources and infrastructure as code (IaC) using PSRule.
https://azure.github.io/PSRule.Rules.Azure/
MIT License
383 stars 83 forks source link

Use kube-audit-admin instead of kube-audit #2450

Closed BernieWhite closed 1 month ago

BernieWhite commented 11 months ago

Existing rule

None

Suggested rule

Create a new rule Azure.AKS.AuditAdmin to flag when the kube-audit log is collected with diagnostic settings.

When kube-audit is enabled, this can significantly increase cost for monitoring AKS clusters.

Instead enable collection for kube-audit-admin, which excludes the get and list audit events, but includes changes.

Pillar

Cost Optimization

Additional context

Related to #2249

BenjaminEngeset commented 1 month ago

Hi @BernieWhite.

How did PSRule treat extension resource types pre and in-flight?

Pre it is defined as an own resource, but when exporting it's under resources as a child resource?

BernieWhite commented 1 month ago

@BenjaminEngeset

The code for visiting resource types for exporting in-flight child and extension resources is here: https://github.com/Azure/PSRule.Rules.Azure/blob/main/src/PSRule.Rules.Azure/Pipeline/Export/ResourceExportVisitor.cs

BenjaminEngeset commented 1 month ago

Thanks, @BernieWhite, that was truly helpful.

I will create the rule.