Skip to content

Commit

Permalink
[WIP] Create bottlerocket instance group in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rifelpet committed Nov 14, 2021
1 parent 8add83a commit f121d7c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/e2e/kubetest2-kops/deployer/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func (d *deployer) featureFlags() string {
ff := []string{
"+SpecOverrideFlag",
"+AlphaAllowGCE",
"+Bottlerocket",
}
val := strings.Join(ff, ",")
for _, env := range d.Env {
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/kubetest2-kops/deployer/dumplogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func (d *deployer) dumpClusterInfo() error {
}

resourceTypes := []string{"csinodes", "csidrivers", "storageclasses", "persistentvolumes",
"mutatingwebhookconfigurations", "validatingwebhookconfigurations"}
"mutatingwebhookconfigurations", "validatingwebhookconfigurations", "customresourcedefinitions",
"iamidentitymappings", "clusterroles", "clusterrolebindings", "certificatesigningrequests"}
if err := os.MkdirAll(path.Join(d.ArtifactsDir, "cluster-info"), 0755); err != nil {
return err
}
Expand Down Expand Up @@ -139,7 +140,7 @@ func (d *deployer) dumpClusterInfo() error {
return fmt.Errorf("failed to get namespaces: %s", err)
}

namespacedResourceTypes := []string{"configmaps", "endpoints", "endpointslices", "leases", "persistentvolumeclaims"}
namespacedResourceTypes := []string{"configmaps", "endpoints", "endpointslices", "leases", "persistentvolumeclaims", "roles", "rolebindings", "serviceaccounts"}
for _, namespace := range namespaces {
namespace = strings.TrimSpace(namespace)
if err := os.MkdirAll(path.Join(d.ArtifactsDir, "cluster-info", namespace), 0755); err != nil {
Expand Down
22 changes: 21 additions & 1 deletion tests/e2e/kubetest2-kops/deployer/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
"--kubernetes-version", d.KubernetesVersion,
"--ssh-public-key", d.SSHPublicKeyPath,
"--override", "cluster.spec.nodePortAccess=0.0.0.0/0",
"--override", "spec.authentication.aws.backendMode=CRD",
}
if yes {
args = append(args, "--yes")
Expand All @@ -132,7 +133,8 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
args = appendIfUnset(args, "--node-count", "4")
args = appendIfUnset(args, "--node-volume-size", "48")
args = appendIfUnset(args, "--override", adminAccess)
args = appendIfUnset(args, "--zones", strings.Join(zones, ","))
args = appendIfUnset(args, "--zones", "us-east-1a")
args = appendIfUnset(args, "--node-image", "092701018921/bottlerocket-aws-k8s-1.21-x86_64-v1.4.0-42360701")

switch d.CloudProvider {
case "aws":
Expand Down Expand Up @@ -163,6 +165,24 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
return err
}

{
args := []string{
d.KopsBinaryPath, "set", "instancegroup",
"--name", d.ClusterName,
"nodes-us-east-1a",
"spec.imageFamily.bottlerocket=",
}
klog.Info(strings.Join(args, " "))
cmd := exec.Command(args[0], args[1:]...)
cmd.SetEnv(d.env()...)

exec.InheritOutput(cmd)
err := cmd.Run()
if err != nil {
return err
}
}

if d.terraform != nil {
if err := d.terraform.InitApply(); err != nil {
return err
Expand Down

0 comments on commit f121d7c

Please sign in to comment.