apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: cluster01
  region: us-east-1
nodeGroups:
  - name: anzograph
    labels: {'cambridgesemantics.com/node-purpose': 'anzograph'}
    instanceType: m5.large
    desiredCapacity: 0
    availabilityZones:
    - us-east-1a
    minSize: 0
    maxSize: 5
    volumeSize: 50
    maxPodsPerNode: 10
    iam:
      withAddonPolicies:
        autoScaler: true
        imageBuilder: true
    volumeType: gp2
    privateNetworking: true
    securityGroups:
      withShared: true
      withLocal: true
    ssh:
      allow: true
    taints:
      'cambridgesemantics.com/dedicated': 'anzograph:NoSchedule'
    tags:
      'k8s.io/cluster-autoscaler/node-template/label/cambridgesemantics.com/node-purpose': 'anzograph'
      'k8s.io/cluster-autoscaler/node-template/taint/cambridgesemantics.com/dedicated': 'anzograph:NoSchedule'
      'cambridgesemantics.com/node-purpose': 'anzograph'
    preBootstrapCommands:
    - "mkdir -p /etc/systemd/scripts"
    - "echo -e \"#!/bin/sh\n[[ -w /sys/kernel/mm/transparent_hugepage/enabled ]] &&  echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled || echo 'File for THP setting is not found'\n[[ -w /sys/kernel/mm/transparent_hugepage/defrag ]] && echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag || echo 'File for THP defrag is not found'\necho 'vm.max_map_count=2097152' >> /etc/sysctl.conf\necho 'vm.overcommit_ratio=50' >> /etc/sysctl.conf\nsysctl -p /etc/sysctl.conf\" > /etc/systemd/scripts/tune_node.sh"
    - "chmod 755 /etc/systemd/scripts/tune_node.sh"
    - "echo -e \"[Unit]\nDescription=Tune  Workers\nAfter=kubelet.service\n\n[Service]\nType=oneshot\nExecStart=/etc/systemd/scripts/tune_node.sh\n\n[Install]\nWantedBy=multi-user.target\" > /etc/systemd/system/tune_node.service"
    - "systemctl --system daemon-reload && systemctl enable tune_node.service && systemctl start tune_node.service"
