Skip to content

Testing: Support k3d/k3s/rancher in deployer/e2e tests #8784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9ef9ea6
Support k3d in deployer/e2e tests
naemono Aug 1, 2025
355e243
optionally install k3d
naemono Aug 1, 2025
43edf03
Use the right machine type on ci.
naemono Aug 1, 2025
dfb6b33
Fix the pipeline templating.
naemono Aug 1, 2025
7c620c4
Fix more things.
naemono Aug 1, 2025
71e7d1f
test force k3d install
naemono Aug 8, 2025
c3a1d2f
don't run k3d DID
naemono Aug 8, 2025
42b21aa
Fix k3d
naemono Aug 8, 2025
5947ebb
make cluster + e2e run in one step.
naemono Aug 11, 2025
30af68f
Handle storageclass properly
naemono Aug 11, 2025
d2f4fc3
Add some debugging
naemono Aug 18, 2025
76fa9c6
more detailed debugging
naemono Aug 18, 2025
7645b8e
Debugging cgroupsv2
naemono Aug 19, 2025
6679a2a
Run k3s config checker
naemono Aug 19, 2025
937c381
execute a find on cgroups cpu dir.
naemono Aug 19, 2025
bb3be2a
more debugging
naemono Aug 19, 2025
5127bb3
One more try
naemono Aug 19, 2025
010d074
try find on root.
naemono Aug 19, 2025
0508b00
Change family
naemono Aug 19, 2025
1951bfd
try difference base machine type.
naemono Aug 19, 2025
34703ae
diff machine that supports ssd disk type.
naemono Aug 20, 2025
e5a6c1c
add step to get cgroup info from ES
naemono Aug 20, 2025
96a3f63
change order of steps
naemono Aug 20, 2025
d7000d1
remove debugging.
naemono Aug 20, 2025
6de0902
fix linter
naemono Aug 20, 2025
b2e0c99
only print cgroup data once
naemono Aug 20, 2025
273fa06
clearly show when file doesn't exist
naemono Aug 20, 2025
8e11813
newlines
naemono Aug 20, 2025
45ec958
More debugging data.
naemono Aug 20, 2025
3301f8d
don't return on err
naemono Aug 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .buildkite/e2e/pipeline-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ const (
EnvVarOperatorImage = "OPERATOR_IMAGE"
EnvVarE2EImage = "E2E_IMG"

KindAgentsMachineType = "n1-standard-16"
KindAgentsMachineType = "n2d-standard-16"
)

var (
//go:embed pipeline.tpl.yaml
pipelineTemplate string

// providersInDocker are k8s providers that require the deployer to run in Docker
providersInDocker = []string{"kind", "aks", "ocp"}
providersInDocker = []string{"kind", "aks", "ocp", "k3d"}
// providersNoCleanup are k8s providers that do not require the cluster to be deleted after use
providersNoCleanup = []string{"kind"}
providersNoCleanup = []string{"kind", "k3d"}
// providers are k8s providers for which it is not possible to retrieve the kube config after cluster creation
providersNoRemoteConfig = []string{"kind"}
providersNoRemoteConfig = []string{"kind", "k3d"}

semverRE = regexp.MustCompile(`\d*\.\d*\.\d*(-\w*)?`)
chars = []rune("abcdefghijklmnopqrstuvwxyz")
Expand Down
17 changes: 12 additions & 5 deletions .buildkite/e2e/pipeline-gen/pipeline.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ steps:

commands:
- .buildkite/scripts/test/set-deployer-config.sh

{{- if $test.Dind }}
- make -C .buildkite TARGET="run-deployer" ci
{{- else }}
Expand All @@ -29,9 +28,9 @@ steps:
agents:
{{- if $test.Dind }}
provider: "gcp"
image: "family/core-ubuntu-2004"
{{- if eq $test.Provider "kind" }}
machineType: "{{ .KindAgentsMachineType }}"
image: "family/core-ubuntu-2204"
{{- if or (eq $test.Provider "kind") (eq $test.Provider "k3d") }}
machineType: "{{ $.KindAgentsMachineType }}"
{{- end }}
{{- else }}
image: docker.elastic.co/ci-agent-images/cloud-k8s-operator/buildkite-agent:c39fad65
Expand Down Expand Up @@ -71,6 +70,10 @@ steps:
{{- $deployerCommand = "set-kubeconfig" }}
{{- end }}

# Check k3s configuration
- wget https://github.com/k3s-io/k3s/releases/download/v1.33.3%2Bk3s1/k3s && chmod +x k3s
- ./k3s check-config

{{- if $test.Dind }}
- make -C .buildkite TARGET="{{ $deployerCommand }} e2e-run" ci
{{- else }}
Expand All @@ -81,7 +84,7 @@ steps:
{{- if $test.Dind }}
provider: "gcp"
image: "family/core-ubuntu-2004"
{{- if eq $test.Provider "kind" }}
{{- if or (eq $test.Provider "kind") (eq $test.Provider "k3d") }}
machineType: "{{ $.KindAgentsMachineType }}"
diskSizeGb: 150
{{- end }}
Expand Down Expand Up @@ -119,7 +122,11 @@ steps:
soft_fail: true
commands:
- .buildkite/scripts/test/set-deployer-config.sh
{{- if eq $test.Provider "k3d" }}
- "wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.8.3 bash"
{{- end }}
{{- if not $test.Dind }}
- "wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.8.3 bash"
- make run-deployer
agents:
image: docker.elastic.co/ci-agent-images/cloud-k8s-operator/buildkite-agent:c39fad65
Expand Down
7 changes: 6 additions & 1 deletion .buildkite/e2e/release-branch-matrix.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

- label: stack
fixed:
E2E_PROVIDER: gke
Expand Down Expand Up @@ -41,6 +40,12 @@
- DEPLOYER_KIND_NODE_IMAGE: kindest/node:v1.33.1@sha256:050072256b9a903bd914c0b2866828150cb229cea0efe5892e2b644d5dd3b34f
DEPLOYER_KIND_IP_FAMILY: ipv6

- label: k3d
fixed:
E2E_PROVIDER: k3d
mixed:
- DEPLOYER_K3D_NODE_IMAGE: "rancher/k3s:v1.33.3+k3s1"

- label: gke
fixed:
E2E_PROVIDER: gke
Expand Down
9 changes: 7 additions & 2 deletions .buildkite/scripts/test/set-deployer-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ROOT="$WD/../../.."

w() { echo "$@" >> "$ROOT/deployer-config.yml"; }

write_deployer_config() {
write_deployer_config() {
:> "$ROOT/deployer-config.yml"

w "id: ${E2E_PROVIDER}-ci"
Expand All @@ -36,7 +36,7 @@ write_deployer_config() {
w " operation: ${DEPLOYER_OPERATION:-create}"
w " clusterName: ${CLUSTER_NAME}"

# k8s version for ocp, kind
# k8s version for ocp, kind
if [[ "${DEPLOYER_CLIENT_VERSION:-}" != "" ]]; then
w ' clientVersion: "'"${DEPLOYER_CLIENT_VERSION}"'"'
fi
Expand All @@ -58,6 +58,11 @@ write_deployer_config() {
w " nodeImage: ${DEPLOYER_KIND_NODE_IMAGE}"
w " ipFamily: ${DEPLOYER_KIND_IP_FAMILY:-ipv4}"
fi

if [[ "${DEPLOYER_K3D_NODE_IMAGE:-}" ]]; then
w " k3d:"
w " nodeImage: ${DEPLOYER_K3D_NODE_IMAGE}"
fi
}

write_deployer_config
2 changes: 2 additions & 0 deletions hack/deployer/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ func CreateCommand() *cobra.Command {
cfgData = fmt.Sprintf(runner.DefaultEKSRunConfigTemplate, user, vaultAddr, token)
case runner.KindDriverID:
cfgData = fmt.Sprintf(runner.DefaultKindRunConfigTemplate, user)
case runner.K3dDriverID:
cfgData = fmt.Sprintf(runner.DefaultK3dRunConfigTemplate, user)
default:
return fmt.Errorf("unknown provider %s", provider)
}
Expand Down
Loading