Skip to content
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

generate-jobs: handle generate section key #34366

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 50 additions & 1 deletion config/jobs/kubernetes/sig-node/dra-canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ presubmits:
preset-k8s-ssh: "true"
annotations:
testgrid-dashboards: sig-node-dynamic-resource-allocation, sig-node-presubmits, sig-node-containerd
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd 1.7
testgrid-alert-email: [email protected], [email protected]
decorate: true
decoration_config:
Expand Down Expand Up @@ -303,3 +303,52 @@ presubmits:
requests:
cpu: 2
memory: 6Gi

- name: pull-kubernetes-node-e2e-containerd-2-0-dra-canary
cluster: k8s-infra-prow-build
skip_branches:
- release-\d+\.\d+ # per-release image
always_run: false
optional: true
skip_report: false
labels:
preset-service-account: "true"
preset-k8s-ssh: "true"
annotations:
testgrid-dashboards: sig-node-dynamic-resource-allocation, sig-node-presubmits, sig-node-containerd
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd 2.0
testgrid-alert-email: [email protected], [email protected]
decorate: true
decoration_config:
timeout: 90m
path_alias: k8s.io/kubernetes
extra_refs:
- org: kubernetes
repo: test-infra
base_ref: master
path_alias: k8s.io/test-infra
spec:
containers:
- image: gcr.io/k8s-staging-test-infra/kubekins-e2e:v20250212-16f67660c2-master
command:
- runner.sh
args:
- kubetest2
- noop
- --test=node
- --
- --repo-root=.
- --gcp-zone=us-west1-b
- --parallelism=1
- '--label-filter=Feature: containsAny DynamicResourceAllocation && Feature: isSubsetOf { Beta, DynamicResourceAllocation } && !Flaky && !Slow'
- --timeout=60m
- --skip-regex= # Override kubetest2 default in https://github.com/kubernetes-sigs/kubetest2/blob/9f385d26316f5256755bb8fe333970aa5759ec7f/pkg/testers/node/node.go#L92
- '--test-args=--feature-gates="DynamicResourceAllocation=true" --service-feature-gates="DynamicResourceAllocation=true" --runtime-config=api/beta=true --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock --container-runtime-process-name=/usr/local/bin/containerd --container-runtime-pid-file= --kubelet-flags="--cgroup-driver=systemd --cgroups-per-qos=true --cgroup-root=/ --runtime-cgroups=/system.slice/containerd.service --kubelet-cgroups=/system.slice/kubelet.service" --extra-log="{\"name\": \"containerd.log\", \"journalctl\": [\"-u\", \"containerd\"]}"'
- --image-config-file=/home/prow/go/src/k8s.io/test-infra/jobs/e2e_node/containerd/containerd-release-2.0/image-config.yaml
resources:
limits:
cpu: 2
memory: 6Gi
requests:
cpu: 2
memory: 6Gi
2 changes: 1 addition & 1 deletion config/jobs/kubernetes/sig-node/dra-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ periodics:
preset-k8s-ssh: "true"
annotations:
testgrid-dashboards: sig-node-dynamic-resource-allocation, sig-node-containerd, sig-release-master-informing
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd 1.7
testgrid-alert-email: [email protected], [email protected]
fork-per-release: "true"
fork-per-release-periodic-interval: 24h
Expand Down
2 changes: 1 addition & 1 deletion config/jobs/kubernetes/sig-node/dra-presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ presubmits:
preset-k8s-ssh: "true"
annotations:
testgrid-dashboards: sig-node-dynamic-resource-allocation, sig-node-presubmits, sig-node-containerd
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd
description: Runs E2E node tests for Dynamic Resource Allocation beta features with containerd 1.7
testgrid-alert-email: [email protected], [email protected]
fork-per-release: "true"
decorate: true
Expand Down
9 changes: 8 additions & 1 deletion config/jobs/kubernetes/sig-node/dra.generate.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,12 @@ inject_ssh_public_key = true
# This job runs the same tests as ci-node-e2e-crio-dra with Containerd 1.7 runtime
[node-e2e-containerd-1-7-dra]
job_type = node
description = Runs E2E node tests for Dynamic Resource Allocation beta features with containerd
description = Runs E2E node tests for Dynamic Resource Allocation beta features with containerd 1.7
image_config_file = /home/prow/go/src/k8s.io/test-infra/jobs/e2e_node/dra/image-config-containerd-1.7.yaml

# This job runs the same tests as ci-node-e2e-crio-dra with Containerd 2.0 runtime
[node-e2e-containerd-2-0-dra]
generate = canary
job_type = node
description = Runs E2E node tests for Dynamic Resource Allocation beta features with containerd 2.0
image_config_file = /home/prow/go/src/k8s.io/test-infra/jobs/e2e_node/containerd/containerd-release-2.0/image-config.yaml
24 changes: 21 additions & 3 deletions hack/generate-jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ def generate_one(path: pathlib.Path, verify: bool) -> typing.List[str]:
Generate job configuration files from one template.
Return list of errors.
"""
config = configparser.ConfigParser()
config = configparser.ConfigParser(inline_comment_prefixes=["#"])
config.read_file(path.open())

template_name = config.get("DEFAULT", "template")
template_path = path.parent / template_name
errors = []
with template_path.open() as inp:
template = jinja2.Template(inp.read(), lstrip_blocks=True)
pairs = config.get("DEFAULT", "files").split(",")
for name, job in (pair.split(":") for pair in pairs):
jobs = dict(
item.split(":") for item in config.get("DEFAULT", "files").split(",")
)
for name, job in jobs.items():
tmp = tempfile.NamedTemporaryFile(
"w",
prefix=f"{template_name}.",
Expand All @@ -71,6 +73,22 @@ def generate_one(path: pathlib.Path, verify: bool) -> typing.List[str]:
f"Instead, modify {template_name} and run `make generate-jobs`.\n"
)
for section in config.sections():
# generate job types if they're mentioned in
# the `generate` section key or if the key is not set
gen = config[section].get("generate")
if gen is not None:
gen_jobs = gen.split(",")
# validate job types mentioned in the `generate` section key
for gen_job in gen_jobs:
if gen_job and gen_job not in jobs:
errors.append(
f"Can't generate {name} job {section}: "
f"unknown job type: {gen_job}"
)
# skip job types not mentioned in the `generate` section key
if name not in gen_jobs:
continue

tmp.write(
template.render(
config[section],
Expand Down