408 changes: 0 additions & 408 deletions pkg/nodebootstrap/legacy/maxpods.go

This file was deleted.

74 changes: 0 additions & 74 deletions pkg/nodebootstrap/legacy/maxpods_generate.go

This file was deleted.

107 changes: 0 additions & 107 deletions pkg/nodebootstrap/legacy/reserved.go

This file was deleted.

1,532 changes: 0 additions & 1,532 deletions pkg/nodebootstrap/legacy/reserved_data.go

This file was deleted.

102 changes: 0 additions & 102 deletions pkg/nodebootstrap/legacy/reserved_generate.go

This file was deleted.

81 changes: 0 additions & 81 deletions pkg/nodebootstrap/legacy/reserved_test.go

This file was deleted.

46 changes: 0 additions & 46 deletions pkg/nodebootstrap/legacy/scripts/bootstrap.legacy.al2.sh

This file was deleted.

74 changes: 0 additions & 74 deletions pkg/nodebootstrap/legacy/scripts/bootstrap.legacy.ubuntu.sh

This file was deleted.

125 changes: 0 additions & 125 deletions pkg/nodebootstrap/legacy/ubuntu.go

This file was deleted.

175 changes: 0 additions & 175 deletions pkg/nodebootstrap/legacy/userdata.go

This file was deleted.

195 changes: 0 additions & 195 deletions pkg/nodebootstrap/legacy/userdata_test.go

This file was deleted.

12 changes: 6 additions & 6 deletions pkg/nodebootstrap/ubuntu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ NODE_TAINTS=`, "\n")))
Expect(err).NotTo(HaveOccurred())

cloudCfg := decode(userData)
Expect(cloudCfg.WriteFiles[2].Path).To(Equal("/var/lib/cloud/scripts/eksctl/bootstrap.helper.sh"))
Expect(cloudCfg.WriteFiles[2].Permissions).To(Equal("0755"))
Expect(cloudCfg.WriteFiles[3].Path).To(Equal("/var/lib/cloud/scripts/eksctl/bootstrap.helper.sh"))
Expect(cloudCfg.WriteFiles[3].Permissions).To(Equal("0755"))
})

It("adds the ubuntu boot script to the userdata", func() {
Expect(err).NotTo(HaveOccurred())

cloudCfg := decode(userData)
Expect(cloudCfg.WriteFiles[3].Path).To(Equal("/var/lib/cloud/scripts/eksctl/bootstrap.ubuntu.sh"))
Expect(cloudCfg.WriteFiles[3].Permissions).To(Equal("0755"))
Expect(cloudCfg.WriteFiles[2].Path).To(Equal("/var/lib/cloud/scripts/eksctl/bootstrap.ubuntu.sh"))
Expect(cloudCfg.WriteFiles[2].Permissions).To(Equal("0755"))
})
})

Expand Down Expand Up @@ -192,8 +192,8 @@ NODE_TAINTS=`, "\n")))
Expect(err).NotTo(HaveOccurred())

cloudCfg := decode(userData)
Expect(cloudCfg.Commands).To(HaveLen(1))
Expect(cloudCfg.WriteFiles).To(HaveLen(0))
Expect(cloudCfg.Commands).To(HaveLen(2))
Expect(cloudCfg.WriteFiles).To(HaveLen(3))
})
})
})
37 changes: 13 additions & 24 deletions pkg/nodebootstrap/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strconv"
"strings"

"github.com/kris-nova/logger"
"github.com/pkg/errors"

"github.com/weaveworks/eksctl/pkg/nodebootstrap/assets"
Expand All @@ -18,7 +17,6 @@ import (

api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
"github.com/weaveworks/eksctl/pkg/cloudconfig"
"github.com/weaveworks/eksctl/pkg/nodebootstrap/legacy"
)

const (
Expand Down Expand Up @@ -50,20 +48,10 @@ func NewBootstrapper(clusterConfig *api.ClusterConfig, ng *api.NodeGroup) (Boots
}
switch ng.AMIFamily {
case api.NodeImageFamilyUbuntu2004, api.NodeImageFamilyUbuntu1804:
// TODO remove
if ng.CustomAMI {
logger.Warning("Custom AMI detected for nodegroup %s, using legacy nodebootstrap mechanism. Please refer to https://github.com/weaveworks/eksctl/issues/3563 for upcoming breaking changes", ng.Name)
return legacy.NewUbuntuBootstrapper(clusterConfig, ng), nil
}
return NewUbuntuBootstrapper(clusterConfig, ng), nil
case api.NodeImageFamilyBottlerocket:
return NewBottlerocketBootstrapper(clusterConfig, ng), nil
case api.NodeImageFamilyAmazonLinux2:
// TODO remove
if ng.CustomAMI {
logger.Warning("Custom AMI detected for nodegroup %s, using legacy nodebootstrap mechanism. Please refer to https://github.com/weaveworks/eksctl/issues/3563 for upcoming breaking changes", ng.Name)
return legacy.NewAL2Bootstrapper(clusterConfig, ng), nil
}
return NewAL2Bootstrapper(clusterConfig, ng), nil
default:
return nil, errors.Errorf("unrecognized AMI family %q for creating bootstrapper", ng.AMIFamily)
Expand Down Expand Up @@ -116,19 +104,20 @@ func linuxConfig(clusterConfig *api.ClusterConfig, bootScriptName, bootScriptCon
if ng.OverrideBootstrapCommand != nil {
config.AddShellCommand(*ng.OverrideBootstrapCommand)
} else {
scripts = append(scripts, script{name: commonLinuxBootScript, contents: assets.BootstrapHelperSh}, script{name: bootScriptName, contents: bootScriptContent})
var kubeletExtraConf *api.InlineDocument
if unmanaged, ok := np.(*api.NodeGroup); ok {
kubeletExtraConf = unmanaged.KubeletExtraConfig
}
kubeletConf, err := makeKubeletExtraConf(kubeletExtraConf)
if err != nil {
return "", err
}
files = append(files, kubeletConf)
envFile := makeBootstrapEnv(clusterConfig, np)
files = append(files, envFile)
scripts = append(scripts, script{name: bootScriptName, contents: bootScriptContent})
}
scripts = append(scripts, script{name: commonLinuxBootScript, contents: assets.BootstrapHelperSh})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add in the bootstrap helper to get some of the environment properties to override scripts which can source the helper. This is so that we can help people migrate and ease the pain of transition.

var kubeletExtraConf *api.InlineDocument
if unmanaged, ok := np.(*api.NodeGroup); ok {
kubeletExtraConf = unmanaged.KubeletExtraConfig
}
kubeletConf, err := makeKubeletExtraConf(kubeletExtraConf)
if err != nil {
return "", err
}
files = append(files, kubeletConf)
envFile := makeBootstrapEnv(clusterConfig, np)
files = append(files, envFile)

if err := addFilesAndScripts(config, files, scripts); err != nil {
return "", err
Expand Down
46 changes: 46 additions & 0 deletions userdocs/src/usage/nodegroup-override-announcement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Nodegroup Bootstrap Override For Custom AMIs

This change was announced in the issue [Breaking: overrideBootstrapCommand soon...](https://github.com/weaveworks/eksctl/issues/3563).
Now, it has come to pass in [this](https://github.com/weaveworks/eksctl/pull/4968) PR. Please read the attached issue carefully about
why we decided to move away from supporting custom AMIs without bootstrap scripts or with partial bootstrap scripts.

We still provide a helper! Migrating hopefully is not that painful. `eksctl` still provides a script, which when sourced,
will export a couple of helpful environment properties and settings. This script is located [here](https://github.com/weaveworks/eksctl/blob/70a289d62e3c82e6177930cf2469c2572c82e104/pkg/nodebootstrap/assets/scripts/bootstrap.helper.sh).

The following environment properties will be at your disposal:

```bash
API_SERVER_URL
B64_CLUSTER_CA
INSTANCE_ID
INSTANCE_LIFECYCLE
CLUSTER_DNS
NODE_TAINTS
MAX_PODS
NODE_LABELS
CLUSTER_NAME
CONTAINER_RUNTIME # default is docker
KUBELET_EXTRA_ARGS # for details, look at the script
```

The minimum that needs to be used when overriding so `eksctl` doesn't fail, is labels! `eksctl` relies on a specific set of
labels to be on the node, so it can find them. When defining the override, please provide this **bare minimum** override
command:

```yaml
overrideBootstrapCommand: |
#!/bin/bash
source /var/lib/cloud/scripts/eksctl/bootstrap.helper.sh
# Note "--node-labels=${NODE_LABELS}" needs the above helper sourced to work, otherwise will have to be defined manually.
/etc/eks/bootstrap.sh test-override-11 --container-runtime containerd --kubelet-extra-args "--node-labels=${NODE_LABELS}"
```
Note the _`--node-labels`_ setting. If this is not defined, the node will join the cluster, but `eksctl` will ultimately
time out on the last step when it's waiting for the nodes to be `Ready`. It's doing a Kubernetes lookup for nodes that
have the label `alpha.eksctl.io/nodegroup-name=<cluster-name>`. This is only true for unmanaged nodegroups. For managed
it's using a different label.

If, at all, it's possible to switch to managed nodegroups to avoid this overhead, the time has come now to do that. Makes
all the overriding a lot easier.
1 change: 1 addition & 0 deletions userdocs/theme/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{% block announce %}
eksctl now creates managed nodegroups when a config file isn't specified. <a class="md-button md-button--primary" href="/usage/managed-nodegroups-announcement">Read more</a>
eksctl now requires supplying an `overrideBootstrapCommand` for unmanaged nodegroups when using a custom AMI. <a class="md-button md-button--primary" href="/usage/nodegroup-override-announcement">Read more</a>
{% endblock %}

{% set extracopyright %}
Expand Down