Skip to content

Commit

Permalink
Merge pull request #1088 from jsafrane/bump-1.30
Browse files Browse the repository at this point in the history
Bump to Kubernetes 1.30
  • Loading branch information
k8s-ci-robot authored May 13, 2024
2 parents 0932517 + 4be6c90 commit 9eb0afa
Show file tree
Hide file tree
Showing 288 changed files with 38,588 additions and 8,983 deletions.
16 changes: 11 additions & 5 deletions cmd/csi-snapshotter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ func main() {

// Connect to CSI.
metricsManager := metrics.NewCSIMetricsManager("" /* driverName */)
ctx := context.Background()
csiConn, err := connection.Connect(
ctx,
*csiAddress,
metricsManager,
connection.OnConnectionLoss(connection.ExitOnConnectionLoss()))
Expand All @@ -175,11 +177,11 @@ func main() {
}

// Pass a context with a timeout
ctx, cancel := context.WithTimeout(context.Background(), *csiTimeout)
tctx, cancel := context.WithTimeout(ctx, *csiTimeout)
defer cancel()

// Find driver name
driverName, err := csirpc.GetDriverName(ctx, csiConn)
driverName, err := csirpc.GetDriverName(tctx, csiConn)
if err != nil {
klog.Errorf("error getting CSI driver name: %v", err)
os.Exit(1)
Expand All @@ -202,13 +204,15 @@ func main() {
}

// Check it's ready
if err = csirpc.ProbeForever(csiConn, *csiTimeout); err != nil {
if err = csirpc.ProbeForever(ctx, csiConn, *csiTimeout); err != nil {
klog.Errorf("error waiting for CSI driver to be ready: %v", err)
os.Exit(1)
}

// Find out if the driver supports create/delete snapshot.
supportsCreateSnapshot, err := supportsControllerCreateSnapshot(ctx, csiConn)
tctx, cancel = context.WithTimeout(ctx, *csiTimeout)
defer cancel()
supportsCreateSnapshot, err := supportsControllerCreateSnapshot(tctx, csiConn)
if err != nil {
klog.Errorf("error determining if driver supports create/delete snapshot operations: %v", err)
os.Exit(1)
Expand All @@ -228,7 +232,9 @@ func main() {
snapShotter := snapshotter.NewSnapshotter(csiConn)
var groupSnapshotter group_snapshotter.GroupSnapshotter
if *enableVolumeGroupSnapshots {
supportsCreateVolumeGroupSnapshot, err := supportsGroupControllerCreateVolumeGroupSnapshot(ctx, csiConn)
tctx, cancel = context.WithTimeout(ctx, *csiTimeout)
defer cancel()
supportsCreateVolumeGroupSnapshot, err := supportsGroupControllerCreateVolumeGroupSnapshot(tctx, csiConn)
if err != nil {
klog.Errorf("error determining if driver supports create/delete group snapshot operations: %v", err)
} else if !supportsCreateVolumeGroupSnapshot {
Expand Down
2 changes: 1 addition & 1 deletion cmd/csi-snapshotter/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func createMockServer(t *testing.T) (*gomock.Controller, *driver.MockCSIDriver,

// Create a client connection to it
addr := drv.Address()
csiConn, err := connection.Connect(addr, metricsManager)
csiConn, err := connection.Connect(context.Background(), addr, metricsManager)
if err != nil {
return nil, nil, nil, nil, nil, err
}
Expand Down
22 changes: 10 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
module github.com/kubernetes-csi/external-snapshotter/v7

go 1.22.0

toolchain go1.22.3
go 1.22.3

require (
github.com/container-storage-interface/spec v1.9.0
github.com/evanphx/json-patch v5.9.0+incompatible
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/mock v1.6.0
github.com/google/gofuzz v1.2.0
github.com/kubernetes-csi/csi-lib-utils v0.17.0
github.com/kubernetes-csi/csi-lib-utils v0.18.0
github.com/kubernetes-csi/csi-test/v5 v5.2.0
github.com/kubernetes-csi/external-snapshotter/client/v7 v7.0.0
github.com/prometheus/client_golang v1.19.0
Expand All @@ -22,8 +20,8 @@ require (
k8s.io/api v0.30.0
k8s.io/apimachinery v0.30.0
k8s.io/client-go v0.30.0
k8s.io/component-base v0.29.0
k8s.io/component-helpers v0.29.0
k8s.io/component-base v0.30.0
k8s.io/component-helpers v0.30.0
k8s.io/klog/v2 v2.120.1
)

Expand Down Expand Up @@ -78,14 +76,14 @@ require (

replace github.com/kubernetes-csi/external-snapshotter/client/v7 => ./client

replace k8s.io/api => k8s.io/api v0.29.0
replace k8s.io/api => k8s.io/api v0.30.0

replace k8s.io/apimachinery => k8s.io/apimachinery v0.29.0
replace k8s.io/apimachinery => k8s.io/apimachinery v0.30.0

replace k8s.io/client-go => k8s.io/client-go v0.29.0
replace k8s.io/client-go => k8s.io/client-go v0.30.0

replace k8s.io/code-generator => k8s.io/code-generator v0.29.0
replace k8s.io/code-generator => k8s.io/code-generator v0.30.0

replace k8s.io/component-base => k8s.io/component-base v0.29.0
replace k8s.io/component-base => k8s.io/component-base v0.30.0

replace k8s.io/component-helpers => k8s.io/component-helpers v0.29.0
replace k8s.io/component-helpers => k8s.io/component-helpers v0.30.0
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubernetes-csi/csi-lib-utils v0.17.0 h1:xEpJ3WYgMyyYF6fvcKHh4cDRtknuTkBS9rG8bYoLTCU=
github.com/kubernetes-csi/csi-lib-utils v0.17.0/go.mod h1:2Ba5/aQgUjbpqyC2uCcFwMF3rnPVs5jhZXm8jAzcT9Q=
github.com/kubernetes-csi/csi-lib-utils v0.18.0 h1:Tpt1qLIbmpz5ux1hllut/dEWww2VRxdvSSOF4gGwhnA=
github.com/kubernetes-csi/csi-lib-utils v0.18.0/go.mod h1:FEQIcHcZmXZKWKTg18dJbXCHvgtCjnH7/uM0trmZyhU=
github.com/kubernetes-csi/csi-test/v5 v5.2.0 h1:Z+sdARWC6VrONrxB24clCLCmnqCnZF7dzXtzx8eM35o=
github.com/kubernetes-csi/csi-test/v5 v5.2.0/go.mod h1:o/c5w+NU3RUNE+DbVRhEUTmkQVBGk+tFOB2yPXT8teo=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
Expand All @@ -76,10 +76,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/onsi/ginkgo/v2 v2.13.1 h1:LNGfMbR2OVGBfXjvRZIZ2YCTQdGKtPLvuI1rMCCj3OU=
github.com/onsi/ginkgo/v2 v2.13.1/go.mod h1:XStQ8QcGwLyF4HdfcZB8SFOS/MWCgDuXMSBe6zrvLgM=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY=
github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM=
github.com/onsi/gomega v1.31.0 h1:54UJxxj6cPInHS3a35wm6BK/F9nHYueZ1NVujHDrnXE=
github.com/onsi/gomega v1.31.0/go.mod h1:DW9aCi7U6Yi40wNVAvT6kzFnEVEI5n3DloYBiKiT6zk=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down Expand Up @@ -178,16 +178,16 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.29.0 h1:NiCdQMY1QOp1H8lfRyeEf8eOwV6+0xA6XEE44ohDX2A=
k8s.io/api v0.29.0/go.mod h1:sdVmXoz2Bo/cb77Pxi71IPTSErEW32xa4aXwKH7gfBA=
k8s.io/apimachinery v0.29.0 h1:+ACVktwyicPz0oc6MTMLwa2Pw3ouLAfAon1wPLtG48o=
k8s.io/apimachinery v0.29.0/go.mod h1:eVBxQ/cwiJxH58eK/jd/vAk4mrxmVlnpBH5J2GbMeis=
k8s.io/client-go v0.29.0 h1:KmlDtFcrdUzOYrBhXHgKw5ycWzc3ryPX5mQe0SkG3y8=
k8s.io/client-go v0.29.0/go.mod h1:yLkXH4HKMAywcrD82KMSmfYg2DlE8mepPR4JGSo5n38=
k8s.io/component-base v0.29.0 h1:T7rjd5wvLnPBV1vC4zWd/iWRbV8Mdxs+nGaoaFzGw3s=
k8s.io/component-base v0.29.0/go.mod h1:sADonFTQ9Zc9yFLghpDpmNXEdHyQmFIGbiuZbqAXQ1M=
k8s.io/component-helpers v0.29.0 h1:Y8W70NGeitKxWwhsPo/vEQbQx5VqJV+3xfLpP3V1VxU=
k8s.io/component-helpers v0.29.0/go.mod h1:j2coxVfmzTOXWSE6sta0MTgNSr572Dcx68F6DD+8fWc=
k8s.io/api v0.30.0 h1:siWhRq7cNjy2iHssOB9SCGNCl2spiF1dO3dABqZ8niA=
k8s.io/api v0.30.0/go.mod h1:OPlaYhoHs8EQ1ql0R/TsUgaRPhpKNxIMrKQfWUp8QSE=
k8s.io/apimachinery v0.30.0 h1:qxVPsyDM5XS96NIh9Oj6LavoVFYff/Pon9cZeDIkHHA=
k8s.io/apimachinery v0.30.0/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/client-go v0.30.0 h1:sB1AGGlhY/o7KCyCEQ0bPWzYDL0pwOZO4vAtTSh/gJQ=
k8s.io/client-go v0.30.0/go.mod h1:g7li5O5256qe6TYdAMyX/otJqMhIiGgTapdLchhmOaY=
k8s.io/component-base v0.30.0 h1:cj6bp38g0ainlfYtaOQuRELh5KSYjhKxM+io7AUIk4o=
k8s.io/component-base v0.30.0/go.mod h1:V9x/0ePFNaKeKYA3bOvIbrNoluTSG+fSJKjLdjOoeXQ=
k8s.io/component-helpers v0.30.0 h1:xbJtNCfSM4SB/Tz5JqCKDZv4eT5LVi/AWQ1VOxhmStU=
k8s.io/component-helpers v0.30.0/go.mod h1:68HlSwXIumMKmCx8cZe1PoafQEYh581/sEpxMrkhmX4=
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
Expand Down
2 changes: 1 addition & 1 deletion pkg/snapshotter/snapshotter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func createMockServer(t *testing.T) (*gomock.Controller, *driver.MockCSIDriver,

// Create a client connection to it
addr := drv.Address()
csiConn, err := connection.Connect(addr, metricsManager)
csiConn, err := connection.Connect(context.Background(), addr, metricsManager)
if err != nil {
return nil, nil, nil, nil, nil, err
}
Expand Down
9 changes: 6 additions & 3 deletions release-tools/SIDECAR_RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ naming convention `<hostpath-deployment-version>-on-<kubernetes-version>`.
## Release Process
1. Identify all issues and ongoing PRs that should go into the release, and
drive them to resolution.
1. Update dependencies for sidecars via
[go-modules-update.sh](https://github.com/kubernetes-csi/csi-driver-host-path/blob/HEAD/release-tools/go-modules-update.sh),
and get PRs approved and merged.
1. Update dependencies for sidecars
1. For new minor versions, use
[go-modules-update.sh](https://github.com/kubernetes-csi/csi-release-tools/blob/HEAD/go-modules-update.sh),
1. For CVE fixes on patch versions, use
[go-modules-targeted-update.sh](https://github.com/kubernetes-csi/csi-release-tools/blob/HEAD/go-modules-targeted-update.sh),
Read the instructions at the top of the script.
1. Check that all [canary CI
jobs](https://testgrid.k8s.io/sig-storage-csi-ci) are passing,
and that test coverage is adequate for the changes that are going into the release.
Expand Down
7 changes: 7 additions & 0 deletions release-tools/build.make
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,10 @@ test-spelling:
test-boilerplate:
@ echo; echo "### $@:"
@ ./release-tools/verify-boilerplate.sh "$(pwd)"

# Test klog usage. This test is optional and must be explicitly added to `test` target in the main Makefile:
# test: test-logcheck
.PHONY: test-logcheck
test-logcheck:
@ echo; echo "### $@:"
@ ./release-tools/verify-logcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function gen_patch_relnotes() {
rm out.md || true
rm -rf /tmp/k8s-repo || true
GITHUB_TOKEN="$CSI_RELEASE_TOKEN" \
release-notes --discover=patch-to-latest --branch="$2" \
release-notes --start-rev="$3" --end-rev="$2" --branch="$2" \
--org=kubernetes-csi --repo="$1" \
--required-author="" --markdown-links --output out.md
}
Expand All @@ -57,11 +57,14 @@ for rel in "${releases[@]}"; do
read -r repo version <<< "$rel"

# Parse minor version
minorPattern="(^[[:digit:]]+\.[[:digit:]]+)\."
[[ "$version" =~ $minorPattern ]]
minorPatchPattern="(^[[:digit:]]+\.[[:digit:]]+)\.([[:digit:]]+)"
[[ "$version" =~ $minorPatchPattern ]]
minor="${BASH_REMATCH[1]}"
patch="${BASH_REMATCH[2]}"

echo "$repo" "$version" "$minor"
echo "$repo $version $minor $patch"
prevPatch="$((patch-1))"
prevVer="v$minor.$prevPatch"

pushd "$repo/CHANGELOG"

Expand All @@ -74,7 +77,7 @@ for rel in "${releases[@]}"; do
git checkout --track "upstream/release-$minor" -b "$branch"

# Generate release notes
gen_patch_relnotes "$repo" "release-$minor"
gen_patch_relnotes "$repo" "release-$minor" "$prevVer"
cat > tmp.md <<EOF
# Release notes for v$version
Expand All @@ -84,6 +87,7 @@ EOF

cat out.md >> tmp.md
echo >> tmp.md
rm out.md

file="CHANGELOG-$minor.md"
cat "$file" >> tmp.md
Expand Down
96 changes: 96 additions & 0 deletions release-tools/go-modules-targeted-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash

# Copyright 2023 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Usage: go-modules-targeted-update.sh
#
# Batch update specific dependencies for sidecars.
#
# Required environment variables
# CSI_RELEASE_TOKEN: Github token needed for generating release notes
# GITHUB_USER: Github username to create PRs with
#
# Instructions:
# 1. Login with "gh auth login"
# 2. Copy this script to the Github org directory (one directory above the
# repos)
# 3. Change $modules, $releases and $org if needed.
# 4. Set environment variables
# 5. Run script from the Github org directory
#
# Caveats:
# - This script doesn't handle interface incompatibility of updates.
# You need to resolve interface incompatibility case by case. The
# most frequent case is to update the interface(new parameters,
# name change of the method, etc.)in the sidecar repo and make sure
# the build and test pass.


set -e
set -x

org="kubernetes-csi"

modules=(
"github.com/kubernetes-csi/[email protected]"
)

releases=(
#"external-attacher release-4.4"
#"external-provisioner release-3.6"
#"external-resizer release-1.9"
#"external-snapshotter release-6.3"
#"node-driver-registrar release-2.9"
)

for rel in "${releases[@]}"; do

read -r repo branch <<< "$rel"
if [ "$repo" != "#" ]; then
(
cd "$repo"
git fetch upstream

if [ "$(git rev-parse --verify "module-update-$branch" 2>/dev/null)" ]; then
git checkout master && git branch -D "module-update-$branch"
fi
git checkout -B "module-update-$branch" "upstream/$branch"

for mod in "${modules[@]}"; do
go get "$mod"
done
go mod tidy
go mod vendor

git add --all
git commit -m "Update go modules"
git push origin "module-update-$branch" --force

# Create PR
prbody=$(cat <<EOF
Updated the following go modules:
${modules[@]}
\`\`\`release-note
NONE
\`\`\`
EOF
)
gh pr create --title="[$branch] Update go modules" --body "$prbody" --head "$GITHUB_USER:module-update-$branch" --base "$branch" --repo="$org/$repo"
)
fi
done
2 changes: 1 addition & 1 deletion release-tools/prow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64 amd64; linux ppc64le ppc64le -pp
# which is disabled with GOFLAGS=-mod=vendor).
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"

configvar CSI_PROW_GO_VERSION_BUILD "1.21.5" "Go version for building the component" # depends on component's source code
configvar CSI_PROW_GO_VERSION_BUILD "1.22.3" "Go version for building the component" # depends on component's source code
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below
Expand Down
37 changes: 37 additions & 0 deletions release-tools/verify-logcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

# Copyright 2024 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script uses the logcheck tool to analyze the source code
# for proper usage of klog contextual logging.

set -o errexit
set -o nounset
set -o pipefail

LOGCHECK_VERSION=${1:-0.8.2}

# This will canonicalize the path
CSI_LIB_UTIL_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd -P)

# Create a temporary directory for installing logcheck and
# set up a trap command to remove it when the script exits.
CSI_LIB_UTIL_TEMP=$(mktemp -d 2>/dev/null || mktemp -d -t csi-lib-utils.XXXXXX)
trap 'rm -rf "${CSI_LIB_UTIL_TEMP}"' EXIT

echo "Installing logcheck to temp dir: sigs.k8s.io/logtools/logcheck@v${LOGCHECK_VERSION}"
GOBIN="${CSI_LIB_UTIL_TEMP}" go install "sigs.k8s.io/logtools/logcheck@v${LOGCHECK_VERSION}"
echo "Verifying logcheck: ${CSI_LIB_UTIL_TEMP}/logcheck -check-contextual ${CSI_LIB_UTIL_ROOT}/..."
"${CSI_LIB_UTIL_TEMP}/logcheck" -check-contextual -check-with-helpers "${CSI_LIB_UTIL_ROOT}/..."
Loading

0 comments on commit 9eb0afa

Please sign in to comment.