Smarter AWS EKS Helper
- class smarter.apps.infrastructure.providers.aws.helpers.eks.AWSEks(aws_access_key_id=None, aws_secret_access_key=None, aws_region=None, aws_profile=None, shared_resource_identifier=None, environment=None, environment_domain=None, root_domain=None, debug_mode=False, init_info=None)[source]
Bases:
AWSBaseThe AWS EKS helper: the platform’s cluster,
smarter_settings.subsystem_k8s_cluster_name.The cluster is optional. Without its name, the platform runs, but nothing is deployed to Kubernetes, and the first attempt to reach the cluster logs how to set it.
- cluster_name_is_set()[source]
Return True if
smarter_settings.subsystem_k8s_cluster_nameis set.If it is not, log how to set it, once per process.
- Return type:
- property eks
The boto3 EKS client.
- Raises:
AWSNotReadyError – If AWS is not ready.
- get_cluster_health()[source]
Describe the health of the platform’s EKS cluster,
smarter_settings.subsystem_k8s_cluster_name.It reads the control plane, each managed node group, each add-on with its newest version for the cluster’s Kubernetes version, and EKS’s insights, e.g. the cluster’s readiness for the next Kubernetes version. The node groups, the add-ons and the insights are each read on their own: a part that fails, e.g. because the credentials may not call
eks:ListInsights, is named inClusterHealth.errors, with AWS’s error code, and the other parts are still returned.Side effects: read-only calls to the EKS api:
DescribeCluster,ListNodegroupsandDescribeNodegroup,ListAddons,DescribeAddonandDescribeAddonVersions, andListInsights. Nothing is changed.- Return type:
- Returns:
The cluster’s health.
- Raises:
AWSNotReadyError – If AWS is not ready, or the cluster’s name is not set.
botocore.exceptions.ClientError – If the cluster itself cannot be described.
- get_cluster_resources()[source]
Describe the cloud resources of the platform’s EKS cluster: the cluster, its add-ons and its node groups.
- get_token()[source]
Create a bearer token for the platform’s EKS cluster, as
aws eks get-tokendoes.The token is an STS GetCallerIdentity url, presigned with the session’s credentials and the cluster’s name, which EKS calls to identify the caller. Creating it makes no request, so it takes milliseconds rather than the seconds that the aws cli takes to start.
- Return type:
- Returns:
The token, and when it should no longer be used, as a
time.time().- Raises:
AWSNotReadyError – If AWS is not ready, or the cluster’s name or region is not set.