Skip to main content

A Sceptre resolver to retrieve a kubernetes service load balancer URI

Project description

made-with-python PyPI version 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 that type is 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 

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

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

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 ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sceptre-eks-lb-resolver-0.1.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sceptre_eks_lb_resolver-0.1.3-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file sceptre-eks-lb-resolver-0.1.3.tar.gz.

File metadata

  • Download URL: sceptre-eks-lb-resolver-0.1.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sceptre-eks-lb-resolver-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c2faa53aefb8cbd970aed51cb63dd9e792abf7fb8f6e2ddbdc77170360905709
MD5 543c7face8215f6fc473b4c11a01966f
BLAKE2b-256 e8a1695a79c665d9f7151f236f9545b0b1b743ea5ef8b0977c60e55c5bfaeea8

See more details on using hashes here.

File details

Details for the file sceptre_eks_lb_resolver-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: sceptre_eks_lb_resolver-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for sceptre_eks_lb_resolver-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3beb45484b88e19274f740cd891852cba845cc5c7d788b469642819ada3bb7b2
MD5 1af7ce9610e8b4a99611470fc6c00ca0
BLAKE2b-256 7414004c32d7b3e5d763556297b0ed89a5e5159dd57f88ebace20a234adb2d5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page