Skip to content

Commit

Permalink
feat: Add check for cluster-autoscaler or karpenter
Browse files Browse the repository at this point in the history
  • Loading branch information
dorukozturk committed Jan 31, 2023
1 parent 3e6d16c commit aee0ab7
Show file tree
Hide file tree
Showing 19 changed files with 14,160 additions and 9 deletions.
Empty file.
25 changes: 25 additions & 0 deletions hardeneks/cluster_wide/cluster_autoscaling/cluster_autoscaler.py
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
12 changes: 3 additions & 9 deletions hardeneks/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ rules:
applications:
- check_metrics_server_is_running
- check_vertical_pod_autoscaler_exists
cluster_autoscaling:
cluster_autoscaler:
- check_any_cluster_autoscaler_exists
namespace_based:
security:
iam:
Expand Down Expand Up @@ -71,13 +74,4 @@ rules:
- schedule_replicas_across_nodes
- run_multiple_replicas
- avoid_running_singleton_pods
# data_plane:
# networking:
# vpc_subnets:
# vpc_cni:
# prefix_mode:
# ipv6:
# security_groups:
# custom_networking:
# load_balancing:

Large diffs are not rendered by default.

Loading

0 comments on commit aee0ab7

Please sign in to comment.