Skip to main content

PyPI PyPI - Wheel CI/CD PyPI - Downloads PyPI pyversions PyPI license

sceptre-eks-lb-resolver

Sceptre custom resolver you can use to dynamically read AWS EKS Load Balancer URI into your Sceptre config.

It reads services inside your Kubernetes cluster with type LoadBalancer and returns its External DNS/URI.

Installation

$> pip install sceptre-eks-lb-resolver

Usage

Simply call the resolver inside your Sceptre configuration files:

template_path: mystack.yaml

parameters:
  ProjectName: "My k8s API"
  LoadBalancerURI: !eks_lb_uri -n backend -s data_api 

Will resolve to something like:

LoadBalancerURI: "XXXXXXXXXXX.us-east-1.elb.amazonaws.com"

You can use your Sceptre variables as arguments for the resolver:

  ...
  LoadBalancerURI: !eks_lb_uri -n {{ var.namespace }} -s {{ var.service }}

So with that in place, when you run sceptre launch --yes dev/us-east-1, it will call the resolver and assign the k8s load balancer URI to the Sceptre variable LoadBalancerURI at runtime.

Make sure to guarantee that you are properly authenticated within AWS

Syntax

Resolver expects two arguments: -n | --namespace and -s | --service-name. The --namespace argument is optional. It assumes kubeernetes default namespace as its default value.

All available ways of using this resolver are as follows:

  LBArn: !eks_lb_uri --namespace {{ var.namespace }} --service-name {{ var.service }}
  LBArn: !eks_lb_uri -n {{ var.namespace }} -s {{ var.service }}
  LBArn: !eks_lb_uri -s {{ var.service }}  # Assumes default namespace
  LBArn: !eks_lb_uri -s "my_api_service_name"
  LBArn: !eks_lb_uri -n backend -s data_api

How does it works?

The resolver is called by Sceptre in order to retrieve remote k8s cluster services. The EKS Load Balancer Resolver uses kubernetes python client to connect on the remote cluster and retrieve data of the given service name from a given namespace.

The K8s Load Balancer URI resolver simply tries to get the Load Balancer DNS as if you run:

$> kubectl --namespace backend get service api-service
NAME               TYPE           CLUSTER-IP       EXTERNAL-IP                               PORT(S)         AGE
api-service        LoadBalancer   10.0.42.123      XXXXXXXXXXX.us-east-1.elb.amazonaws.com   443:32214/TCP   12h40m

The resolver goes after the XXXXXXXXXXX.us-east-1.elb.amazonaws.com value. When succeeds, it loads in place this value in your Sceptre template.

Notes

Be aware that the shell which sceptre will be called MUST be authenticated on AWS and your kubeconfig properly updated to point to your AWS EKS remote cluster.

You can refer to the following links for either AWS and Kubernetes authentication:

Contributing

Fork, change, make test, make check, Pull Request. I will review the code and if Github Actions pipeline succeeds: congratulations! We are going to merge ;)

Release files for sceptre-eks-lb-resolver 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sceptre-eks-lb-resolver 0.2.1
File Size Uploaded
sceptre-eks-lb-resolver-0.2.1.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sceptre-eks-lb-resolver 0.2.1
File Interpreter ABI Platform
sceptre_eks_lb_resolver-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / sceptre-eks-lb-resolver-0.2.1.tar.gz

Download URL sceptre-eks-lb-resolver-0.2.1.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c816f362ec3d427f0906ea30f44a7a8bb9bfd355e60ee564d64c1f563123630f
BLAKE2b-256 checksum
How to use checksums
286c54fe70743b138ab178c2a3ac2adb4fb4483a4c707d5b2fdf69ac4d6b0da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.0

Release files / sceptre_eks_lb_resolver-0.2.1-py3-none-any.whl

Download URL sceptre_eks_lb_resolver-0.2.1-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2f38e0866ba356fc9edf2a73b1dd58c01804e7ab26e58358fe7bc1bed08702c
BLAKE2b-256 checksum
How to use checksums
d838d29def709a04bef78710a883043d6255cb56d43c7b60c890bab3c5d37475
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.0

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page