Skip to content

Commit 019d748

Browse files
author
Jake
committed
use go:embed in nodebootstrap
1 parent 1538791 commit 019d748

19 files changed

+89
-558
lines changed

pkg/nodebootstrap/al2.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/kris-nova/logger"
55
"github.com/pkg/errors"
66
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
7+
"github.com/weaveworks/eksctl/pkg/nodebootstrap/assets"
78
)
89

910
const (
@@ -23,13 +24,13 @@ func NewAL2Bootstrapper(clusterConfig *api.ClusterConfig, ng *api.NodeGroup) *Am
2324
}
2425

2526
func (b *AmazonLinux2) UserData() (string, error) {
26-
var scripts []string
27+
var scripts []script
2728

2829
if api.IsEnabled(b.ng.EFAEnabled) {
29-
scripts = append(scripts, "efa.al2.sh")
30+
scripts = append(scripts, script{name: "efa.al2.sh", contents: assets.EfaAl2Sh})
3031
}
3132

32-
body, err := linuxConfig(b.clusterConfig, al2BootScript, b.ng, scripts...)
33+
body, err := linuxConfig(b.clusterConfig, al2BootScript, assets.BootstrapAl2Sh, b.ng, scripts...)
3334
if err != nil {
3435
return "", errors.Wrap(err, "encoding user data")
3536
}

pkg/nodebootstrap/assets/assets.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package assets
2+
3+
import (
4+
// Import go:embed
5+
_ "embed"
6+
)
7+
8+
//EksctlAl2Conf holds the eksctl.al2.conf contents
9+
//go:embed scripts/10-eksctl.al2.conf
10+
var EksctlAl2Conf string
11+
12+
//BootstrapAl2Sh holds the bootstrap.al2.sh contents
13+
//go:embed scripts/bootstrap.al2.sh
14+
var BootstrapAl2Sh string
15+
16+
//BootstrapHelperSh holds the bootstrap.helper.sh contents
17+
//go:embed scripts/bootstrap.helper.sh
18+
var BootstrapHelperSh string
19+
20+
//BootstrapUbuntuSh holds the bootstrap.ubuntu.sh contents
21+
//go:embed scripts/bootstrap.ubuntu.sh
22+
var BootstrapUbuntuSh string
23+
24+
//EfaAl2Sh holds the efa.al2.sh contents
25+
//go:embed scripts/efa.al2.sh
26+
var EfaAl2Sh string
27+
28+
//EfaManagedBoothook holds the efa.managed.boothook contents
29+
//go:embed scripts/efa.managed.boothook
30+
var EfaManagedBoothook string
31+
32+
//InstallSsmAl2Sh holds the install-ssm.al2.sh contents
33+
//go:embed scripts/install-ssm.al2.sh
34+
var InstallSsmAl2Sh string
35+
36+
//KubeletYaml holds the kubelet.yaml contents
37+
//go:embed scripts/kubelet.yaml
38+
var KubeletYaml string

0 commit comments

Comments
 (0)