Skip to content

Commit

Permalink
feat(kubetest2): Add support for Bottlerocket
Browse files Browse the repository at this point in the history
  • Loading branch information
vigh-m committed Jan 13, 2025
1 parent e022ac3 commit bdb931e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
9 changes: 5 additions & 4 deletions internal/deployers/eksapi/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ var (
)

type UserDataTemplateData struct {
Name string
CertificateAuthority string
CIDR string
APIServerEndpoint string
Name string
CertificateAuthority string
CIDR string
APIServerEndpoint string
DeviceOwnershipFromSecurityContext string
}

var (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cluster-name" = "{{.Name}}"
"api-server" = "{{.APIServerEndpoint}}"
"cluster-certificate" = "{{.CertificateAuthority}}"
device-ownership-from-security-context = {{.DeviceOwnershipFromSecurityContext}}

[settings.host-containers.admin]
"enabled" = true
11 changes: 7 additions & 4 deletions internal/deployers/eksapi/userdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

func generateUserData(format string, cluster *Cluster) (string, bool, error) {
userDataIsMimePart := true
deviceOwnershipFromSecurityContext := "false"
var t *template.Template
switch format {
case "bootstrap.sh":
Expand All @@ -20,15 +21,17 @@ func generateUserData(format string, cluster *Cluster) (string, bool, error) {
case "bottlerocket":
t = templates.UserDataBottlerocket
userDataIsMimePart = false
deviceOwnershipFromSecurityContext = "true"
default:
return "", false, fmt.Errorf("uknown user data format: '%s'", format)
}
buf := bytes.Buffer{}
if err := t.Execute(&buf, templates.UserDataTemplateData{
APIServerEndpoint: cluster.endpoint,
CertificateAuthority: cluster.certificateAuthorityData,
CIDR: cluster.cidr,
Name: cluster.name,
APIServerEndpoint: cluster.endpoint,
CertificateAuthority: cluster.certificateAuthorityData,
CIDR: cluster.cidr,
Name: cluster.name,
DeviceOwnershipFromSecurityContext: deviceOwnershipFromSecurityContext,
}); err != nil {
return "", false, err
}
Expand Down
4 changes: 4 additions & 0 deletions test/cases/neuron/manifests/multi-node-test-neuron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ spec:
replicas: {{.WorkerNodeCount}}
template:
spec:
securityContext:
runAsUser: 1000
runAsGroup: 2000
fsGroup: 3000
containers:
- image: {{.NeuronTestImage}}
ports:
Expand Down
4 changes: 4 additions & 0 deletions test/cases/neuron/manifests/single-node-test-neuronx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ spec:
memory: 1Gi
aws.amazon.com/neuron: "1"
restartPolicy: Never
securityContext:
runAsUser: 1000
runAsGroup: 2000
fsGroup: 3000
backoffLimit: 4

0 comments on commit bdb931e

Please sign in to comment.