npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eks-nodegroup-asg-tags-cdk

v1.1.2

Published

To apply tags to the ASG for an EKS nodegroup

Downloads

512

Readme

eks-nodegroup-asg-tags-cdk

To apply tags to the ASG for an EKS nodegroup, in particular for signalling labels and taints to to the cluster autoscaler.

See https://github.com/kubernetes/autoscaler/issues/3780

This custom resource finds the ASG for a given EKS nodegroup and applies tags to the associated ASG. The Kubernetes cluster autoscaler can see tags on the ASG, and can use these to know what instance it will get if it scales up that ASG. This usually is irrelevant, as the cluster autoscaler will look at the existing nodes and assume any new node it creates will be the same. However, this breaks down if a Nodegroup/ASG can scale to zero. In this situations, it depends on whether the running cluster autoscaler has previously seen nodes from that ASG or not, which is not robust, and the cluster may enter a state where a pod is unschedulable, there is an ASG that - if scaled up - would provide a node able to run the pod, but the cluster autoscaler doesn't know that, so won't scale up.

Example

import { NodegroupAsgTags } from 'eks-nodegroup-asg-tags-cdk';

// ...

const myCluster = ...
const myNodegroupProps = {...};
const myNodegroup = myCluster.addNodegroupCapacity(..., myNodegroupProps);

new NodegroupAsgTags(this, 'MyNodegroupTags', {
    cluster: props.cluster,
    nodegroup: myNodegroup,
    nodegroupProps,
    setClusterAutoscalerTagsForNodeLabels: true,
    setClusterAutoscalerTagsForNodeTaints: true,
    tags: {
        'k8s.io/cluster-autoscaler/node-template/autoscaling-options/scaledownunneededtime': '1m0s',
    },
});

Note: using NodegroupAsgTags only tags the ASG. You can confuse the cluster autoscaler by setting a tag claiming the nodes for that ASG behave in one way when really they don't.

Properties

  • cluster (type: eks.ICluster, required): the EKS cluster
  • nodegroup (type: eks.INodegroup, required): the EKS Nodegroup
  • nodegroupProps (type: eks.NodegroupOptions, required if setClusterAutoscalerTagsForNodeLabels or setClusterAutoscalerTagsForNodeTaints is true): if either of the setClusterAutoscalerTags* options is set to true, this is required and the tags that the cluster autoscaler understands are applied from the props passed to the nodegroup. (It's an annoying limit of the CDK that these aren't available from the nodegroup, hence why the nodegroup props need to be passed here)
  • setClusterAutoscalerTagsForNodeLabels (type: boolean, optional): if set, must set nodegroupProps, and then applies tags like k8s.io/cluster-autoscaler/node-template/label/${labelName}: ${labelValue}.
  • setClusterAutoscalerTagsForNodeTaints (type: boolean, optional): if set, must set nodegroupProps, and then applies tags like k8s.io/cluster-autoscaler/node-template/taint/${taintName}: ${taintValue}.
  • tags (type: Record<string, string>, optional): any other tags to set on the ASG.