-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
ubuntu.go
37 lines (30 loc) · 870 Bytes
/
ubuntu.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
package nodebootstrap
import (
"github.com/kris-nova/logger"
"github.com/pkg/errors"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
"github.com/weaveworks/eksctl/pkg/nodebootstrap/assets"
)
const (
ubuntuBootScript = "bootstrap.ubuntu.sh"
)
type Ubuntu struct {
clusterConfig *api.ClusterConfig
np api.NodePool
clusterDNS string
}
func NewUbuntuBootstrapper(clusterConfig *api.ClusterConfig, np api.NodePool, clusterDNS string) *Ubuntu {
return &Ubuntu{
clusterConfig: clusterConfig,
np: np,
clusterDNS: clusterDNS,
}
}
func (b *Ubuntu) UserData() (string, error) {
body, err := linuxConfig(b.clusterConfig, ubuntuBootScript, assets.BootstrapUbuntuSh, b.clusterDNS, b.np)
if err != nil {
return "", errors.Wrap(err, "encoding user data")
}
logger.Debug("user-data = %s", body)
return body, nil
}