-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
al2.go
39 lines (31 loc) · 836 Bytes
/
al2.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package nodebootstrap
import (
"github.com/kris-nova/logger"
"github.com/pkg/errors"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
)
const (
al2BootScript = "bootstrap.al2.sh"
)
type AmazonLinux2 struct {
clusterConfig *api.ClusterConfig
ng *api.NodeGroup
}
func NewAL2Bootstrapper(clusterConfig *api.ClusterConfig, ng *api.NodeGroup) *AmazonLinux2 {
return &AmazonLinux2{
clusterConfig: clusterConfig,
ng: ng,
}
}
func (b *AmazonLinux2) UserData() (string, error) {
var scripts []string
if api.IsEnabled(b.ng.EFAEnabled) {
scripts = append(scripts, "efa.al2.sh")
}
body, err := linuxConfig(b.clusterConfig, al2BootScript, b.ng, scripts...)
if err != nil {
return "", errors.Wrap(err, "encoding user data")
}
logger.Debug("user-data = %s", body)
return body, nil
}