Skip to content

Commit 6e4b84d

Browse files
committed
enable test handler for containerd runtime
1 parent 419b93b commit 6e4b84d

File tree

12 files changed

+37
-12
lines changed

12 files changed

+37
-12
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ gcs-publish-ci: gsutil version-dist-ci
266266
@echo "== Uploading kops =="
267267
gsutil -h "Cache-Control:private, max-age=0, no-transform" -m cp -n -r ${UPLOAD}/kops/* ${GCS_LOCATION}
268268
echo "VERSION: ${VERSION}"
269-
echo "${GCS_URL}/${VERSION}" > ${UPLOAD}/${LATEST_FILE}
269+
echo "${GCS_URL}${VERSION}" > ${UPLOAD}/${LATEST_FILE}
270270
gsutil -h "Cache-Control:private, max-age=0, no-transform" cp ${UPLOAD}/${LATEST_FILE} ${GCS_LOCATION}
271271

272272
.PHONY: gen-cli-docs

k8s/crds/kops.k8s.io_clusters.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,10 @@ spec:
921921
description: State directory for execution state files (default
922922
"/run/containerd").
923923
type: string
924+
testHandlerEnabled:
925+
description: TestHandlerEnabled enables a runtime called test-handler,
926+
specific to k/k e2e tests
927+
type: boolean
924928
version:
925929
description: Version used to pick the containerd package.
926930
type: string

k8s/crds/kops.k8s.io_instancegroups.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ spec:
225225
description: State directory for execution state files (default
226226
"/run/containerd").
227227
type: string
228+
testHandlerEnabled:
229+
description: TestHandlerEnabled enables a runtime called test-handler,
230+
specific to k/k e2e tests
231+
type: boolean
228232
version:
229233
description: Version used to pick the containerd package.
230234
type: string

nodeup/pkg/model/containerd.go

+3
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ func (b *ContainerdBuilder) buildContainerdConfig() (string, error) {
492492
if containerd.SeLinuxEnabled {
493493
config.SetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "enable_selinux"}, true)
494494
}
495+
if containerd.TestHandlerEnabled {
496+
config.SetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "containerd", "runtimes", "test-handler", "runtime_type"}, "io.containerd.runc.v2")
497+
}
495498
if b.NodeupConfig.KubeletConfig.PodInfraContainerImage != "" {
496499
config.SetPath([]string{"plugins", "io.containerd.grpc.v1.cri", "sandbox_image"}, b.NodeupConfig.KubeletConfig.PodInfraContainerImage)
497500
}

pkg/apis/kops/containerdconfig.go

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ type ContainerdConfig struct {
5151
SeLinuxEnabled bool `json:"selinuxEnabled,omitempty"`
5252
// NRI configures the Node Resource Interface.
5353
NRI *NRIConfig `json:"nri,omitempty"`
54+
// TestHandlerEnabled enables a runtime called test-handler, specific to k/k e2e tests
55+
TestHandlerEnabled bool `json:"testHandlerEnabled,omitempty"`
5456
}
5557

5658
type NRIConfig struct {

pkg/apis/kops/v1alpha2/containerdconfig.go

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type ContainerdConfig struct {
4646
SeLinuxEnabled bool `json:"selinuxEnabled,omitempty"`
4747
// NRI configures the Node Resource Interface.
4848
NRI *NRIConfig `json:"nri,omitempty"`
49+
// TestHandlerEnabled enables a runtime called test-handler, specific to k/k e2e tests
50+
TestHandlerEnabled bool `json:"testHandlerEnabled,omitempty"`
4951
}
5052

5153
type NRIConfig struct {

pkg/apis/kops/v1alpha2/zz_generated.conversion.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/kops/v1alpha3/containerdconfig.go

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type ContainerdConfig struct {
4646
SeLinuxEnabled bool `json:"selinuxEnabled,omitempty"`
4747
// NRI configures the Node Resource Interface.
4848
NRI *NRIConfig `json:"nri,omitempty"`
49+
// TestHandlerEnabled enables a runtime called test-handler, specific to k/k e2e tests
50+
TestHandlerEnabled bool `json:"testHandlerEnabled,omitempty"`
4951
}
5052

5153
type NRIConfig struct {

pkg/apis/kops/v1alpha3/zz_generated.conversion.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/e2e/kubetest2-kops/deployer/common.go

-10
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ import (
2020
"errors"
2121
"fmt"
2222
"os"
23-
"path"
2423
"path/filepath"
2524
"strings"
2625
"time"
2726

2827
"k8s.io/klog/v2"
2928
"k8s.io/kops/tests/e2e/kubetest2-kops/gce"
30-
"k8s.io/kops/tests/e2e/pkg/kops"
3129
"k8s.io/kops/tests/e2e/pkg/target"
3230
"k8s.io/kops/tests/e2e/pkg/util"
3331
"sigs.k8s.io/kubetest2/pkg/boskos"
@@ -51,14 +49,6 @@ func (d *deployer) initialize() error {
5149
return fmt.Errorf("init failed to check up flags: %v", err)
5250
}
5351
}
54-
if d.KopsVersionMarker != "" {
55-
d.KopsBinaryPath = path.Join(d.commonOptions.RunDir(), "kops")
56-
baseURL, err := kops.DownloadKops(d.KopsVersionMarker, d.KopsBinaryPath)
57-
if err != nil {
58-
return fmt.Errorf("init failed to download kops from url: %v", err)
59-
}
60-
d.KopsBaseURL = baseURL
61-
}
6252

6353
switch d.CloudProvider {
6454
case "aws":

tests/e2e/kubetest2-kops/deployer/up.go

+13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"errors"
2121
"fmt"
2222
osexec "os/exec"
23+
"path"
2324
"strings"
2425
"time"
2526

@@ -41,6 +42,17 @@ func (d *deployer) Up() error {
4142
return err
4243
}
4344

45+
// kops is fetched when --up is called instead of init to support a scenario where k/k is being built
46+
// and a kops build is not ready yet
47+
if d.KopsVersionMarker != "" {
48+
d.KopsBinaryPath = path.Join(d.commonOptions.RunDir(), "kops")
49+
baseURL, err := kops.DownloadKops(d.KopsVersionMarker, d.KopsBinaryPath)
50+
if err != nil {
51+
return fmt.Errorf("init failed to download kops from url: %v", err)
52+
}
53+
d.KopsBaseURL = baseURL
54+
}
55+
4456
if d.terraform == nil {
4557
klog.Info("Cleaning up any leaked resources from previous cluster")
4658
// Intentionally ignore errors:
@@ -118,6 +130,7 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
118130
"--kubernetes-version", d.KubernetesVersion,
119131
"--ssh-public-key", d.SSHPublicKeyPath,
120132
"--set", "cluster.spec.nodePortAccess=0.0.0.0/0",
133+
"--set", "spec.containerd.testHandlerEnabled=true",
121134
}
122135
if yes {
123136
args = append(args, "--yes")

tests/e2e/scenarios/build/run-test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ make test-e2e-install
2323

2424
cd "${GOPATH}"/src/k8s.io/kubernetes
2525

26+
# this job assumes pull-kops-e2e-k8s-aws-calico is always ran on presubmits
2627
kubetest2 kops -v=6 \
2728
--up --down --build --build-kubernetes=true --target-build-arch=linux/amd64 \
2829
--cloud-provider=gce --admin-access=0.0.0.0/0 \
29-
--kops-version-marker=https://storage.googleapis.com/kops-ci/bin/latest-ci.txt \
30+
--kops-version-marker=https://storage.googleapis.com/k8s-staging-kops/pulls/pull-kops-e2e-k8s-aws-calico/pull-"${PULL_PULL_SHA}"/latest-ci.txt \
3031
--create-args "--networking=kubenet --set=spec.nodeProblemDetector.enabled=true" \
3132
--test=kops \
3233
-- \

0 commit comments

Comments
 (0)