forked from aws-samples/hardeneks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add check for cluster-autoscaler or karpenter
- Loading branch information
1 parent
3e6d16c
commit aee0ab7
Showing
19 changed files
with
14,160 additions
and
9 deletions.
There are no files selected for viewing
Empty file.
25 changes: 25 additions & 0 deletions
25
hardeneks/cluster_wide/cluster_autoscaling/cluster_autoscaler.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from kubernetes import client | ||
from rich.panel import Panel | ||
|
||
from hardeneks import console | ||
from ...resources import Resources | ||
|
||
|
||
def check_any_cluster_autoscaler_exists(resources: Resources): | ||
|
||
deployments = [ | ||
i.metadata.name | ||
for i in client.AppsV1Api().list_deployment_for_all_namespaces().items | ||
] | ||
|
||
if not ("cluster-autoscaler" in deployments or "karpenter" in deployments): | ||
console.print( | ||
Panel( | ||
"[red]Cluster Autoscaler or Karpeneter is not deployed.", | ||
subtitle="[link=https://aws.github.io/aws-eks-best-practices/cluster-autoscaling/]Click to see the guide[/link]", | ||
) | ||
) | ||
console.print() | ||
return False | ||
else: | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2,170 changes: 2,170 additions & 0 deletions
2,170
.../data/check_any_cluster_autoscaler_exists/cluster/cluster_role_bindings_api_response.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.