Skip to main content

Github

Halloumi EKS for the CDK

EKS library for the Halloumi modules of the AWS CDK

Installation

pip install hcdk_eks

Usage

Halloumi EKS can be used as a basis to deploy EKS clusters with managed Nodegroups on AWS using the CDK.

Passing your own VPC

Example

Within a sample stack, the following example code should be present for minimum functionality.

self.eks_cluster_public_subnet_name = 'eks_public'
self.eks_cluster_private_subnet_name = 'eks_private'
self.eks_cluster_name = 'EksCluster'
self.eks_stack_name = 'eks-cluster-stack'

# prerequisites for EKS
self.vpc = ec2.Vpc(
    self, 'Vpc',
    cidr='10.0.0.0/16',
    max_azs=99,  # use all available AZs,
    subnet_configuration=[
        {
            'cidrMask': 26,
            'name': self.eks_cluster_public_subnet_name,
            'subnetType': ec2.SubnetType.PUBLIC
        },
        {
            'cidrMask': 24,
            'name': self.eks_cluster_private_subnet_name,
            'subnetType': ec2.SubnetType.PRIVATE
        }
    ]
)

# Add necessary tags to subnets for the EKS Cluster
private_eks_subnets = self.vpc.select_subnets(
    subnet_name=self.eks_cluster_private_subnet_name
).subnets
for subnet in private_eks_subnets:
    core.Tag.add(
        subnet,
        key=f'kubernetes.io/cluster/{self.eks_cluster_name}',
        value='shared'
    )
    core.Tag.add(
        subnet,
        key=f'kubernetes.io/role/internal-elb',
        value='1'
    )

# Add necessary tags to subnets for the EKS Cluster
public_eks_subnets = self.vpc.select_subnets(
    subnet_name=self.eks_cluster_public_subnet_name
).subnets
for subnet in public_eks_subnets:
    core.Tag.add(
        subnet,
        key=f'kubernetes.io/cluster/{self.eks_cluster_name}',
        value='shared'
    )
    core.Tag.add(
        subnet,
        key=f'kubernetes.io/role/elb',
        value='1'
    )

EKS Cluster

Example

from hcdk_eks import HalloumiEksCluster

app = core.App()

sample_stack = SampleAppStack(app, "sample-app")

__config_eks_cluster = {
    'stack_name': sample_stack.eks_stack_name,
    'eks_cluster_public_subnet_name': sample_stack.eks_cluster_public_subnet_name,
    'eks_cluster_private_subnet_name': sample_stack.eks_cluster_private_subnet_name,
    'eks_cluster_name': sample_stack.eks_cluster_name,
    'kubernetes_version': '1.14',
    'nodegroups': {
        'nodegroup1': {
            'instance_types': [
                't3.large'
            ]
        },
        'nodegroup2': {
            'instance_types': [
                't3.xlarge'
            ]
        }
    }
}

eks_stack = cfn.NestedStack(
    sample_stack, 'eks-stack'
)

HalloumiEksCluster(
    scope=eks_stack,
    vpc=sample_stack.vpc,
    config=__config_eks_cluster
)

app.synth()

Using the VPC from the module

Example

from hcdk_eks import HalloumiEksCluster

app = core.App()
sample_stack = SampleAppStack(app, "sample-app")

__config_eks_cluster = {
    'nodegroups': {
        'nodegroup1': {
            'instance_types': [
                't3.large'
            ]
        },
        'nodegroup2': {
            'instance_types': [
                't3.xlarge'
            ]
        }
    }
}

# EKS Cluster Stack
eks_cluster_stack = cfn.NestedStack(
    sample_stack, 'eks-cluster-stack'
)

eks_cluster = HalloumiEksCluster(
    scope=eks_cluster_stack,
    config=__config_eks_cluster
)

synth = app.synth()

Metadata

Release files for hcdk-eks 0.0.2

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

Source distribution (sdist)

Source distribution for hcdk-eks 0.0.2
File Size Uploaded Provenance Actions
hcdk_eks-0.0.2.tar.gz 4.4 kB Without provenance Details for hcdk_eks-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hcdk-eks 0.0.2
File Interpreter ABI Platform Actions
hcdk_eks-0.0.2-py3-none-any.whl Python 3 none any Details for hcdk_eks-0.0.2-py3-none-any.whl

Total release size: 12.4 kB

Release files / hcdk_eks-0.0.2.tar.gz

Download URL hcdk_eks-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9353c5a7fefb4f1093d6aabdaab1ef850a5b40cbbe74ca042d6076d6ac5ac9bc
BLAKE2b-256 checksum
How to use checksums
4b645929c49d364816b1b113dbd67424eef0556323d5a3a87ebb1c94a2125705
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / hcdk_eks-0.0.2-py3-none-any.whl

Download URL hcdk_eks-0.0.2-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbb971c20a12eb87bbb527634de258e070ce1891b7cc3b8f7df0e803f6403b3f
BLAKE2b-256 checksum
How to use checksums
928d02d26fcca81452cd169507d415bd5bd8401afcdc4180e922b308b2753858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Security for hcdk-eks 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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