question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix EKS NodeGroup Parameter Definitions

See original GitHub issue

When defining a NodeGroup (EKS) these two parameters need to be updated:

Labels and Tags

In eks.py it should be modified to fit:

class Nodegroup(AWSObject):
    resource_type = "AWS::EKS::Nodegroup"

    props = {
        'AmiType': (basestring, False),
        'ClusterName': (basestring, True),
        'DiskSize': (double, False),
        'ForceUpdateEnabled': (boolean, False),
        'InstanceTypes': ([basestring], False),
        'Labels': (dict, False),
        'NodegroupName': (basestring, False),
        'NodeRole': (basestring, True),
        'ReleaseVersion': (basestring, False),
        'RemoteAccess': (RemoteAccess, False),
        'ScalingConfig': (ScalingConfig, False),
        'Subnets': ([basestring], False),
        'Tags': (dict, False),
        'Version': (basestring, False),
    }

The change is: Labels = basestring -> dict Tags = Tags -> dict

I was unable to deploy with the previous settings because I kept getting errors from cloudformation. After the change I was able to deploy correctly.

Here is an example of the deploy:

template.add_resource(Nodegroup(
        "NodeGroup",
        AmiType=Ref("AmiType"),
        ...
        ...
        Labels=json.loads(sceptre_user_data.get("Labels")) or Ref("AWS::NoValue"),
        Tags={ 
           "MyKey": "MyValue",
           "MySecondKey": "MySecond Value"
        }
))

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
markpeekcommented, Jan 31, 2020

@PatMyron heh…don’t get me started about Tags… 😃 Here’s the thing, the Tags() helper was added given the verbosity of the original tags with Key/Value keys. Lately CloudFormation has seen Tags being of type Json without using those keys. I’m wondering if this has changed recently or was originally missed. For both those types the likely fix is to allow “dict” and the existing type for backwards compatibility. Perhaps something like:

diff --git a/troposphere/eks.py b/troposphere/eks.py
index bc64a55..66c7c7a 100644
--- a/troposphere/eks.py
+++ b/troposphere/eks.py
@@ -72,13 +72,13 @@ class Nodegroup(AWSObject):
         'DiskSize': (double, False),
         'ForceUpdateEnabled': (boolean, False),
         'InstanceTypes': ([basestring], False),
-        'Labels': (basestring, False),
+        'Labels': ((basestring, dict), False),
         'NodegroupName': (basestring, False),
         'NodeRole': (basestring, True),
         'ReleaseVersion': (basestring, False),
         'RemoteAccess': (RemoteAccess, False),
         'ScalingConfig': (ScalingConfig, False),
         'Subnets': ([basestring], False),
-        'Tags': (Tags, False),
+        'Tags': ((Tags, dict), False),
         'Version': (basestring, False),
     }

Although the Tags likely only work one way.

1reaction
mromaszewiczcommented, Feb 11, 2020

Both “Labels” and “Tags” should simply be a dict, the alternate basestring and Tags representations simply don’t work in AWS.

I’ve made that substitution in a local fork, and it works great. I don’t think you need to worry about troposphere backward compatibility since the string and Tags representations never worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve node group errors in an EKS cluster - AWS
How do I resolve managed node group errors in an Amazon EKS cluster? ... see Create a new launch template using parameters you...
Read more >
EKS Managed Nodegroups - eksctl
An EKS managed node group is an autoscaling group and associated EC2 instances that are managed by AWS for an Amazon EKS cluster....
Read more >
amazon-eks-user-guide/create-managed-node-group.md at ...
Creating a managed node group. This topic describes how you can launch Amazon EKS managed node groups of nodes that register with your...
Read more >
create-nodegroup — AWS CLI 2.9.8 Command Reference - eks
Creates a managed node group for an Amazon EKS cluster. You can only create a node group for your cluster that is equal...
Read more >
aws_eks_node_group | Resources | hashicorp/aws
Manages an EKS Node Group, which can provision and optionally update an Auto ... AMI for a given EKS version by querying an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found