terraform-aws-eks icon indicating copy to clipboard operation
terraform-aws-eks copied to clipboard

Cannot pass a label to eks_managed_node_group

Open gagbo opened this issue 1 year ago • 0 comments

Description

It might be a duplicate of #2976

My eks_managed_node_group is :

    infra = {
      name           = "infrastructure"
      instance_types = ["t3.medium"]
      min_size       = 1
      desired_size   = 1
      max_size       = 1
      ami_type = "AL2023_x86_64_STANDARD"
      labels = {
        "fp.io/node-type" = "infrastructure"
      }
      tags = {
        "FP.Environment" = "demo"
      }
    }

But when I check the associated node in kubernetes using describe I don’t see my label

Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/instance-type=t3.medium
                    beta.kubernetes.io/os=linux
                    eks.amazonaws.com/capacityType=ON_DEMAND
                    eks.amazonaws.com/nodegroup=infrastructure-2024[...]0002
                    eks.amazonaws.com/nodegroup-image=ami-0d021dbc3a8319a1a
                    eks.amazonaws.com/sourceLaunchTemplateId=lt-0f0b8aabc774e4d54
                    eks.amazonaws.com/sourceLaunchTemplateVersion=1
                    failure-domain.beta.kubernetes.io/region=eu-central-1
                    failure-domain.beta.kubernetes.io/zone=eu-central-1a
                    k8s.io/cloud-provider-aws=66ec3[...]7c5879
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=ip-10-0-1-6.eu-central-1.compute.internal
                    kubernetes.io/os=linux
                    node.kubernetes.io/instance-type=t3.medium
                    topology.ebs.csi.aws.com/zone=eu-central-1a
                    topology.k8s.aws/zone-id=euc1-az2
                    topology.kubernetes.io/region=eu-central-1
                    topology.kubernetes.io/zone=eu-central-1a

If your request is for a new feature, please use the Feature request template.

  • [x] âś‹ I have searched the open/closed issues and my issue is kind of listed: #2976 but is stale

⚠️ Note

I will edit to try to fit this node group in one of the examples, but given #2976 I suppose there’s something obvious I missed in the documentation?

Versions

  • Module version [Required]: 20.14.0

  • Terraform version:

Terraform v1.8.5
on darwin_arm64
  • Provider version(s):
+ provider registry.terraform.io/hashicorp/aws v5.54.1
+ provider registry.terraform.io/hashicorp/cloudinit v2.3.4
+ provider registry.terraform.io/hashicorp/helm v2.14.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.31.0
+ provider registry.terraform.io/hashicorp/local v2.5.1
+ provider registry.terraform.io/hashicorp/null v3.2.2
+ provider registry.terraform.io/hashicorp/random v3.6.2
+ provider registry.terraform.io/hashicorp/time v0.11.2
+ provider registry.terraform.io/hashicorp/tls v4.0.5

Reproduction Code

Just replacing the label from GithubOrg to "fp.io/node-type" in the eks example for AL2023 should be enough

Steps to reproduce the behavior:

Init and apply an aws_eks_cluster with an eks_managed_node_groups value containing:

    infra = {
      name           = "infrastructure"
      instance_types = ["t3.medium"]
      min_size       = 1
      desired_size   = 1
      max_size       = 1
      ami_type = "AL2023_x86_64_STANDARD"
      labels = {
        "fp.io/node-type" = "infrastructure"
      }
      tags = {
        "FP.Environment" = "demo"
      }
    }

Expected behavior

Have the label fp.io/node-type on all nodes in the node group

Actual behavior

The label does not appear

Terminal Output Screenshot(s)

See above the list of labels in kubectl describe node after the apply

Additional context

There’s a mention in the documentation about being compatible with EKS API, but I couldn’t find this documentation anywhere. And I suppose I should not need to mess with the bootstrap scripts/user data to add a label, so I suppose I missed something

gagbo avatar Jun 27 '24 08:06 gagbo