UPD: added check for EKS
This commit is contained in:
parent
2767995979
commit
50ff6bdd36
@ -85,7 +85,7 @@ for r in regions:
|
||||
outTable.append([r, aid, i[0].get("InstanceId"), i[0].get("MetadataOptions").get("HttpTokens") ])
|
||||
printResult(outTable, "Region, AccountID, InstanceId, IDMSv2")
|
||||
|
||||
printSubTitle("[Performance Efficiency] Use of previous generation instance type - "
|
||||
printSubTitle("[Sustainability] Use of previous generation instance type - "
|
||||
"Consider using current generation instances")
|
||||
outTable = []
|
||||
for r in regions:
|
||||
@ -316,7 +316,7 @@ for i in jmespath.search("Buckets[*].Name", response):
|
||||
printResult(outTable, "AccountID, BucketName")
|
||||
|
||||
printTitle("ElastiCache review")
|
||||
printSubTitle("[Cost Optimization] ElastiCache instances on x64 platform - Consider Graviton instances "
|
||||
printSubTitle("[Sustainability] ElastiCache instances on x64 platform - Consider Graviton instances "
|
||||
"such as t4g/r7g to optimize your infrastructure investment.")
|
||||
outTable = []
|
||||
|
||||
@ -421,6 +421,40 @@ for r in regions:
|
||||
printResult(outTable, "Region, AccountID, VpnConnection, TunnelCount")
|
||||
|
||||
|
||||
printTitle("Eks service review")
|
||||
printSubTitle("[Sustainability] Eks node running on AmazonLinux2 (AL2) - Consider using AmazonLinux2023. "
|
||||
"AL2's end of life date is 2025-06-30. AmazonLinux2023 runs on newer kernel and libraries, "
|
||||
"which offers better performance and security.")
|
||||
outTable = []
|
||||
|
||||
for r in regions:
|
||||
client = boto3.client('eks', region_name=r)
|
||||
response = client.list_clusters()
|
||||
for cluster in response.get("clusters"):
|
||||
ngsResp = client.list_nodegroups(clusterName=cluster)
|
||||
for ng in ngsResp.get("nodegroups"):
|
||||
ngResp = client.describe_nodegroup(
|
||||
clusterName=cluster,
|
||||
nodegroupName=ng
|
||||
)
|
||||
if re.search("^AL2_", ngResp.get("nodegroup").get("amiType")):
|
||||
outTable.append([r, aid, cluster, ng, ngResp.get("nodegroup").get("amiType")])
|
||||
printResult(outTable, "Region, AccountID, Cluster, NodeGroup, AmiType")
|
||||
|
||||
printSubTitle("[Sustainability] Eks control plane version outdated - Consider using upgrading Eks cluster. "
|
||||
"Reference https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html for a list "
|
||||
"of current versions. Reference https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html "
|
||||
"for upgrade instructions.")
|
||||
outTable = []
|
||||
|
||||
for r in regions:
|
||||
client = boto3.client('eks', region_name=r)
|
||||
response = client.list_clusters()
|
||||
for cluster in response.get("clusters"):
|
||||
clusterResp = client.describe_cluster(name=cluster)
|
||||
if len(jmespath.search("cluster.health.issues[?code==`UnsupportedVersion`]", clusterResp)) > 0:
|
||||
outTable.append([r, aid, cluster, clusterResp.get("cluster").get("version")])
|
||||
printResult(outTable, "Region, AccountID, Cluster, Version")
|
||||
|
||||
|
||||
# TODO
|
||||
|
Loading…
Reference in New Issue
Block a user