Skip to content
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

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

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

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

guessi opened this issue Mar 1, 2025 · 0 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
    iam:
      attachPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy

  - name: generic-2
    iam:
      attachPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy

  - name: minimal-1
    iam:
      attachPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodeMinimalPolicy

  - name: minimal-2
    iam:
      attachPolicyARNs:
        - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
        - arn:aws:iam::aws:policy/AmazonEKSWorkerNodeMinimalPolicy

[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

  minimalAttachPolicyARNs: &minimalAttachPolicyARNs
  - arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
  - arn:aws:iam::aws:policy/AmazonEKSWorkerNodeMinimalPolicy

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

managedNodeGroups:
  - name: generic-1
    iam:
      attachPolicyARNs: *genericAttachPolicyARNs

  - name: generic-2
    iam:
      attachPolicyARNs: *genericAttachPolicyARNs

  - name: minimal-1
    iam:
      attachPolicyARNs: *minimalAttachPolicyARNs

  - name: minimal-2
    iam:
      attachPolicyARNs: *minimalAttachPolicyARNs
@guessi guessi added the kind/feature New feature or request label Mar 1, 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