Skip to content

[Feature] ClusterConfig to support for YAML anchors and aliases #8270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
guessi opened this issue Mar 1, 2025 · 2 comments
Open

[Feature] ClusterConfig to support for YAML anchors and aliases #8270

guessi opened this issue Mar 1, 2025 · 2 comments
Labels
kind/feature New feature or request

Comments

@guessi
Copy link
Contributor

guessi commented Mar 1, 2025

What feature/behavior/change do you want?

By current design, eksctl not able to accept ClusterConfig with YAML anchors or aliases. If there have any unsupported entry, it would emit error as follow,

Error: couldn't create node group filter from command line options: loading config file "./clusterConfig.yaml": error unmarshaling JSON: while decoding JSON: json: unknown field "aliases"

Why do you want this feature?

If ClusterConfig could support YAML anchors or aliases, we could turn [1] to [2].

What is the workaround for this feature?

yq -y 'del(.aliases)' ./clusterConfig.yaml | eksctl create nodegroup --dry-run -f  -

Reference YAMLs:

[1] BEFORE

---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: eks-demo
  region: us-east-1

managedNodeGroups:
  - name: generic-1
    minSize: 2
    maxSize: 5
    desiredCapacity: 2
    volumeSize: 30
    volumeType: gp3
    instanceTypes:
    - "t3a.small"
    - "t3.small"
    iam:
      attachPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy

  - name: generic-2
    minSize: 2
    maxSize: 5
    desiredCapacity: 2
    volumeSize: 30
    volumeType: gp3
    instanceTypes:
    - "t3a.small"
    - "t3.small"
    iam:
      attachPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy

[2] AFTER

---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

aliases: # By current design, it would cause template parsing error
  genericAttachPolicyARNs: &genericAttachPolicyARNs
  - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
  - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy

  genericNodeGroupSettings: &genericNodeGroupSettings
    minSize: 2
    maxSize: 5
    desiredCapacity: 2
    volumeSize: 30
    volumeType: gp3
    instanceTypes:
    - "t3a.small"
    - "t3.small"
    enableDetailedMonitoring: true
    privateNetworking: true
    disableIMDSv1: true
    spot: true
    ssh:
      allow: false

metadata:
  name: eks-demo
  region: us-east-1

managedNodeGroups:
  - name: generic-al2
    amiFamily: AmazonLinux2
    <<: *genericNodeGroupSettings
    iam:
      attachPolicyARNs: *genericAttachPolicyARNs

  - name: generic-al2023
    amiFamily: AmazonLinux2023
    <<: *genericNodeGroupSettings
    iam:
      attachPolicyARNs: *genericAttachPolicyARNs
@guessi guessi added the kind/feature New feature or request label Mar 1, 2025
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added stale and removed stale labels Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant