Skip to content

Commit 7d217f4

Browse files
committed
Squashed 'release-tools/' changes from a1e1127..6616a6b
kubernetes-csi/csi-release-tools@6616a6b Merge kubernetes-csi/csi-release-tools#146 from pohly/kubernetes-1.21 kubernetes-csi/csi-release-tools@510fb0f prow.sh: support Kubernetes 1.21 kubernetes-csi/csi-release-tools@c63c61b prow.sh: add CSI_PROW_DEPLOYMENT_SUFFIX kubernetes-csi/csi-release-tools@51ac11c Merge kubernetes-csi/csi-release-tools#144 from pohly/pull-jobs kubernetes-csi/csi-release-tools@dd54c92 pull-test.sh: test importing csi-release-tools into other repo kubernetes-csi/csi-release-tools@7d2643a Merge kubernetes-csi/csi-release-tools#143 from pohly/path-setup kubernetes-csi/csi-release-tools@6880b0c prow.sh: avoid creating paths unless really running tests kubernetes-csi/csi-release-tools@bc0504a Merge kubernetes-csi/csi-release-tools#140 from jsafrane/remove-unused-k8s-libs kubernetes-csi/csi-release-tools@5b1de1a go-get-kubernetes.sh: remove unused k8s libs kubernetes-csi/csi-release-tools@49b4269 Merge kubernetes-csi/csi-release-tools#120 from pohly/add-kubernetes-release kubernetes-csi/csi-release-tools@f7e7ee4 docs: steps for adding testing against new Kubernetes release git-subtree-dir: release-tools git-subtree-split: 6616a6b5294b6df39cfce37f4fce7cdce0a77583
1 parent d16cbf5 commit 7d217f4

File tree

4 files changed

+113
-18
lines changed

4 files changed

+113
-18
lines changed

SIDECAR_RELEASE_PROCESS.md

+44
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,47 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
104104
CSI hostpath driver with the new sidecars in the [CSI repo](https://github.com/kubernetes-csi/csi-driver-host-path/tree/master/deploy)
105105
and [k/k
106106
in-tree](https://github.com/kubernetes/kubernetes/tree/master/test/e2e/testing-manifests/storage-csi/hostpath/hostpath)
107+
108+
## Adding support for a new Kubernetes release
109+
110+
1. Add the new release to `k8s_versions` in
111+
https://github.com/kubernetes/test-infra/blob/090dec5dd535d5f61b7ba52e671a810f5fc13dfd/config/jobs/kubernetes-csi/gen-jobs.sh#L25
112+
to enable generating a job for it. Set `experimental_k8s_version`
113+
in
114+
https://github.com/kubernetes/test-infra/blob/090dec5dd535d5f61b7ba52e671a810f5fc13dfd/config/jobs/kubernetes-csi/gen-jobs.sh#L40
115+
to ensure that the new jobs aren't run for PRs unless explicitly
116+
requested. Generate and submit the new jobs.
117+
1. Create a test PR to try out the new job in some repo with `/test
118+
pull-kubernetes-csi-<repo>-<x.y>-on-kubernetes-<x.y>` where x.y
119+
matches the Kubernetes release. Alternatively, run .prow.sh in that
120+
repo locally with `CSI_PROW_KUBERNETES_VERSION=x.y.z`.
121+
1. Optional: update to a [new
122+
release](https://github.com/kubernetes-sigs/kind/tags) of kind with
123+
pre-built images for the new Kubernetes release. This is optional
124+
if the current version of kind is able to build images for the new
125+
Kubernetes release. However, jobs require less resources when they
126+
don't need to build those images from the Kubernetes source code.
127+
This change needs to be tried out in a PR against a component
128+
first, then get submitted against csi-release-tools.
129+
1. Optional: propagate the updated csi-release-tools to all components
130+
with the script from
131+
https://github.com/kubernetes-csi/csi-release-tools/issues/7#issuecomment-707025402
132+
1. Once it is likely to work in all components, unset
133+
`experimental_k8s_version` and submit the updated jobs.
134+
1. Once all sidecars for the new Kubernetes release are released,
135+
either bump the version number of the images in the existing
136+
[csi-driver-host-path
137+
deployments](https://github.com/kubernetes-csi/csi-driver-host-path/tree/master/deploy)
138+
and/or create a new deployment, depending on what Kubernetes
139+
release an updated sidecar is compatible with. If no new deployment
140+
is needed, then add a symlink to document that there intentionally
141+
isn't a separate deployment. This symlink is not needed for Prow
142+
testing because that will use "kubernetes-latest" as fallback.
143+
Update that link when creating a new deployment.
144+
1. Create a new csi-driver-host-path release.
145+
1. Bump `CSI_PROW_DRIVER_VERSION` in prow.sh to that new release and
146+
(eventually) roll that change out to all repos by updating
147+
`release-tools` in them. This is used when testing manually. The
148+
Prow jobs override that value, so also update
149+
`hostpath_driver_version` in
150+
https://github.com/kubernetes/test-infra/blob/91b04e6af3a40a9bcff25aa030850a4721e2dd2b/config/jobs/kubernetes-csi/gen-jobs.sh#L46-L47

go-get-kubernetes.sh

+6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ mods=$( (set -x; curl --silent --show-error --fail "https://raw.githubuserconten
5555
sed -n 's|.*k8s.io/\(.*\) => ./staging/src/k8s.io/.*|k8s.io/\1|p'
5656
) || die "failed to determine Kubernetes staging modules"
5757
for mod in $mods; do
58+
if ! (env GO111MODULE=on go mod graph) | grep "$mod@" > /dev/null; then
59+
echo "Kubernetes module $mod is not used, skipping"
60+
# Remove the module from go.mod "replace" that was added by an older version of this script.
61+
(set -x; env GO111MODULE=on go mod edit "-dropreplace=$mod") || die "'go mod edit' failed"
62+
continue
63+
fi
5864
# The presence of a potentially incomplete go.mod file affects this command,
5965
# so move elsewhere.
6066
modinfo=$(set -x; cd /; env GO111MODULE=on go mod download -json "$mod@kubernetes-${k8s}") ||

prow.sh

+31-18
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ kind_version_default () {
136136
case "${CSI_PROW_KUBERNETES_VERSION}" in
137137
latest|master)
138138
echo main;;
139+
1.21*|release-1.21)
140+
# TODO: replace this special case once the next KinD release supports 1.21.
141+
echo main;;
139142
*)
140143
echo v0.10.0;;
141144
esac
@@ -159,11 +162,6 @@ kindest/node:v1.14.10@sha256:3fbed72bcac108055e46e7b4091eb6858ad628ec51bf693c21f
159162
# Use kind node-image --type=bazel by default, but allow to disable that.
160163
configvar CSI_PROW_USE_BAZEL true "use Bazel during 'kind node-image' invocation"
161164

162-
# Work directory. It has to allow running executables, therefore /tmp
163-
# is avoided. Cleaning up after the script is intentionally left to
164-
# the caller.
165-
configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csiprow.XXXXXXXXXX")" "work directory"
166-
167165
# By default, this script tests sidecars with the CSI hostpath driver,
168166
# using the install_csi_driver function. That function depends on
169167
# a deployment script that it searches for in several places:
@@ -190,8 +188,8 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
190188
# CSI_PROW_DEPLOYMENT variable can be set in the
191189
# .prow.sh of each component when there are breaking changes
192190
# that require using a non-default deployment. The default
193-
# is a deployment named "kubernetes-x.yy" (if available),
194-
# otherwise "kubernetes-latest".
191+
# is a deployment named "kubernetes-x.yy${CSI_PROW_DEPLOYMENT_SUFFIX}" (if available),
192+
# otherwise "kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX}".
195193
# "none" disables the deployment of the hostpath driver.
196194
#
197195
# When no deploy script is found (nothing in `deploy` directory,
@@ -203,6 +201,7 @@ configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csip
203201
configvar CSI_PROW_DRIVER_VERSION "v1.3.0" "CSI driver version"
204202
configvar CSI_PROW_DRIVER_REPO https://github.com/kubernetes-csi/csi-driver-host-path "CSI driver repo"
205203
configvar CSI_PROW_DEPLOYMENT "" "deployment"
204+
configvar CSI_PROW_DEPLOYMENT_SUFFIX "" "additional suffix in kubernetes-x.yy[suffix].yaml files"
206205

207206
# The install_csi_driver function may work also for other CSI drivers,
208207
# as long as they follow the conventions of the CSI hostpath driver.
@@ -361,10 +360,23 @@ configvar CSI_SNAPSHOTTER_VERSION "$(default_csi_snapshotter_version)" "external
361360
# to all the K8s versions we test against
362361
configvar CSI_PROW_E2E_SKIP 'Disruptive|different\s+node' "tests that need to be skipped"
363362

364-
# This is the directory for additional result files. Usually set by Prow, but
365-
# if not (for example, when invoking manually) it defaults to the work directory.
366-
configvar ARTIFACTS "${CSI_PROW_WORK}/artifacts" "artifacts"
367-
mkdir -p "${ARTIFACTS}"
363+
# This creates directories that are required for testing.
364+
ensure_paths () {
365+
# Work directory. It has to allow running executables, therefore /tmp
366+
# is avoided. Cleaning up after the script is intentionally left to
367+
# the caller.
368+
configvar CSI_PROW_WORK "$(mkdir -p "$GOPATH/pkg" && mktemp -d "$GOPATH/pkg/csiprow.XXXXXXXXXX")" "work directory"
369+
370+
# This is the directory for additional result files. Usually set by Prow, but
371+
# if not (for example, when invoking manually) it defaults to the work directory.
372+
configvar ARTIFACTS "${CSI_PROW_WORK}/artifacts" "artifacts"
373+
mkdir -p "${ARTIFACTS}"
374+
375+
# For additional tools.
376+
CSI_PROW_BIN="${CSI_PROW_WORK}/bin"
377+
mkdir -p "${CSI_PROW_BIN}"
378+
PATH="${CSI_PROW_BIN}:$PATH"
379+
}
368380

369381
run () {
370382
echo "$(date) $(go version | sed -e 's/.*version \(go[^ ]*\).*/\1/') $(if [ "$(pwd)" != "${REPO_DIR}" ]; then pwd; fi)\$" "$@" >&2
@@ -384,11 +396,6 @@ die () {
384396
exit 1
385397
}
386398

387-
# For additional tools.
388-
CSI_PROW_BIN="${CSI_PROW_WORK}/bin"
389-
mkdir -p "${CSI_PROW_BIN}"
390-
PATH="${CSI_PROW_BIN}:$PATH"
391-
392399
# Ensure that PATH has the desired version of the Go tools, then run command given as argument.
393400
# Empty parameter uses the already installed Go. In Prow, that version is kept up-to-date by
394401
# bumping the container image regularly.
@@ -647,9 +654,9 @@ find_deployment () {
647654

648655
# Ignore: See if you can use ${variable//search/replace} instead.
649656
# shellcheck disable=SC2001
650-
file="$dir/kubernetes-$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')/deploy.sh"
657+
file="$dir/kubernetes-$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
651658
if ! [ -e "$file" ]; then
652-
file="$dir/kubernetes-latest/deploy.sh"
659+
file="$dir/kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
653660
if ! [ -e "$file" ]; then
654661
return 1
655662
fi
@@ -1098,6 +1105,9 @@ main () {
10981105
local images ret
10991106
ret=0
11001107
1108+
# Set up work directory.
1109+
ensure_paths
1110+
11011111
images=
11021112
if ${CSI_PROW_BUILD_JOB}; then
11031113
# A successful build is required for testing.
@@ -1259,6 +1269,9 @@ gcr_cloud_build () {
12591269
# Required for "docker buildx build --push".
12601270
gcloud auth configure-docker
12611271
1272+
# Might not be needed here, but call it just in case.
1273+
ensure_paths
1274+
12621275
if find . -name Dockerfile | grep -v ^./vendor | xargs --no-run-if-empty cat | grep -q ^RUN; then
12631276
# Needed for "RUN" steps on non-linux/amd64 platforms.
12641277
# See https://github.com/multiarch/qemu-user-static#getting-started

pull-test.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#! /bin/sh
2+
3+
# Copyright 2021 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script is called by pull Prow jobs for the csi-release-tools
18+
# repo to ensure that the changes in the PR work when imported into
19+
# some other repo.
20+
21+
set -ex
22+
23+
# It must be called inside the updated csi-release-tools repo.
24+
CSI_RELEASE_TOOLS_DIR="$(pwd)"
25+
26+
# Update the other repo.
27+
cd "$PULL_TEST_REPO_DIR"
28+
git subtree pull --squash --prefix=release-tools "$CSI_RELEASE_TOOLS_DIR" master
29+
git log -n2
30+
31+
# Now fall through to testing.
32+
exec ./.prow.sh

0 commit comments

Comments
 (0)