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 check for EKS Pod Identity associations count #46

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions aws_quota/check/eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def get_all_eks_clusters(session: boto3.Session) -> typing.List[str]:
def get_node_groups(session: boto3.Session, cluster_name) -> typing.List[str]:
return get_paginated_results(session, "eks", "list_nodegroups", "nodegroups", {'clusterName': cluster_name})

@cachetools.cached(cache=cachetools.TTLCache(100, 60))
def get_eks_pod_identities(session: boto3.Session, cluster_name) -> typing.List[str]:
return get_paginated_results(session, "eks", "list_pod_identity_associations", "associations", {'clusterName': cluster_name})

class ClusterCountCheck(QuotaCheck):
key = "eks_count"
scope = QuotaScope.REGION
Expand Down Expand Up @@ -80,3 +84,21 @@ def current(self):
count += 1

return count


class EKSPodIdentityAssociationsPerCluster(InstanceQuotaCheck):
key = "eks_pod_identity_associations_per_cluster_count"
service_code = 'eks'
# not supported by service quota at the moment
# # https://docs.aws.amazon.com/eks/latest/userguide/service-quotas.html#sq-text
quota_limit_override = 1000
description = "The maximum number of EKS Pod Identity Associations per cluster."
instance_id = 'Cluster ID'

@staticmethod
def get_all_identifiers(session: boto3.Session) -> typing.List[str]:
return get_all_eks_clusters(session)

@property
def current(self):
return len(get_eks_pod_identities(self.boto_session, self.instance_id))
Loading