Open
Description
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