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

OCPBUGS-32309: Bump K8s api to 1.27.13 #1950

Merged
merged 22 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
441edd5
build: use -trimpath in non-DBG mode
thockin Nov 15, 2023
7840458
Use DBG=1 for conformance verification
thockin Nov 18, 2023
c37a819
Update CHANGELOG/CHANGELOG-1.27.md for v1.27.12
k8s-release-robot Mar 15, 2024
017248f
Serve watch without resourceVersion from cache and introduce a WatchF…
serathius Mar 14, 2024
beaf10e
Merge pull request #124007 from serathius/consistent-watch-from-etcd-…
k8s-ci-robot Mar 20, 2024
310d3db
hack/tools: bump honnef.co/go/tools to v0.4.6
pohly Mar 6, 2024
bfd9892
fix panic with SIGSEGV in kubeadm certs check-expiration
carlory Apr 1, 2024
942249c
Use the right feature gate when updating uncertain volumes
bertinatto Mar 25, 2024
adf10d3
[CVE-2023-45288] .*: bump x/net to v0.23.0
MadhavJivrajani Apr 4, 2024
e8b9250
Merge pull request #124178 from MadhavJivrajani/bump-x-net-2023-45288…
k8s-ci-robot Apr 4, 2024
127fa02
Merge pull request #124129 from carlory/automated-cherry-pick-of-#124…
k8s-ci-robot Apr 5, 2024
49dcf18
Merge pull request #124142 from bertinatto/automated-cherry-pick-of-#…
k8s-ci-robot Apr 5, 2024
6ec93a8
Merge pull request #123769 from pohly/release-1.27-go-tools-0.4.6
k8s-ci-robot Apr 5, 2024
a934b62
[go] Bump images, dependencies and versions to go 1.21.9 and distrole…
cpanato Apr 5, 2024
8be2458
Merge pull request #124199 from cpanato/update-go-1.27
k8s-ci-robot Apr 5, 2024
1a7ed95
Merge pull request #122679 from bmwiedemann/automated-cherry-pick-of-…
k8s-ci-robot Apr 8, 2024
3f09225
Add envFrom to serviceaccount admission plugin
ritazh Mar 25, 2024
7c861b1
Merge pull request #124325 from ritazh/automated-cherry-pick-of-#1243…
k8s-ci-robot Apr 16, 2024
96b450c
Release commit for Kubernetes v1.27.13
k8s-release-robot Apr 16, 2024
63758cc
Merge tag 'v1.27.13' into bump-1.27.13
jerpeter1 Apr 18, 2024
55f2f35
UPSTREAM: <drop>: manually resolve conflicts
jerpeter1 Apr 18, 2024
960dc45
UPSTREAM: <drop>: hack/update-vendor.sh, make update and update image
jerpeter1 Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.8
1.21.9
307 changes: 210 additions & 97 deletions CHANGELOG/CHANGELOG-1.27.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/build-image/cross/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.27.0-go1.21.8-bullseye.0
v1.27.0-go1.21.9-bullseye.0
4 changes: 2 additions & 2 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ readonly KUBE_RSYNC_PORT="${KUBE_RSYNC_PORT:-}"
readonly KUBE_CONTAINER_RSYNC_PORT=8730

# These are the default versions (image tags) for their respective base images.
readonly __default_distroless_iptables_version=v0.4.6
readonly __default_go_runner_version=v2.3.1-go1.21.8-bullseye.0
readonly __default_distroless_iptables_version=v0.4.7
readonly __default_go_runner_version=v2.3.1-go1.21.9-bullseye.0
readonly __default_setcap_version=bullseye-v1.4.2

# These are the base images for the Docker-wrapped binaries.
Expand Down
8 changes: 4 additions & 4 deletions build/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ dependencies:

# Golang
- name: "golang: upstream version"
version: 1.21.8
version: 1.21.9
refPaths:
- path: .go-version
- path: build/build-image/cross/VERSION
Expand All @@ -118,7 +118,7 @@ dependencies:
# match: minimum_go_version=go([0-9]+\.[0-9]+)

- name: "registry.k8s.io/kube-cross: dependents"
version: v1.27.0-go1.21.8-bullseye.0
version: v1.27.0-go1.21.9-bullseye.0
refPaths:
- path: build/build-image/cross/VERSION

Expand All @@ -140,15 +140,15 @@ dependencies:
match: BASE_IMAGE_VERSION\?=

- name: "registry.k8s.io/distroless-iptables: dependents"
version: v0.4.6
version: v0.4.7
refPaths:
- path: build/common.sh
match: __default_distroless_iptables_version=
- path: test/utils/image/manifest.go
match: configs\[DistrolessIptables\] = Config{list\.BuildImageRegistry, "distroless-iptables", "v([0-9]+)\.([0-9]+)\.([0-9]+)"}

- name: "registry.k8s.io/go-runner: dependents"
version: v2.3.1-go1.21.8-bullseye.0
version: v2.3.1-go1.21.9-bullseye.0
refPaths:
- path: build/common.sh
match: __default_go_runner_version=
Expand Down
4 changes: 2 additions & 2 deletions cmd/kubeadm/app/phases/certs/renewal/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (rm *Manager) CertificateExists(name string) (bool, error) {
return false, errors.Errorf("%s is not a known certificate", name)
}

return handler.readwriter.Exists(), nil
return handler.readwriter.Exists()
}

// GetCertificateExpirationInfo returns certificate expiration info.
Expand Down Expand Up @@ -333,7 +333,7 @@ func (rm *Manager) CAExists(name string) (bool, error) {
return false, errors.Errorf("%s is not a known certificate", name)
}

return handler.readwriter.Exists(), nil
return handler.readwriter.Exists()
}

// GetCAExpirationInfo returns CA expiration info.
Expand Down
17 changes: 10 additions & 7 deletions cmd/kubeadm/app/phases/certs/renewal/readwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
// read or write a certificate stored/embedded in a file
type certificateReadWriter interface {
//Exists return true if the certificate exists
Exists() bool
Exists() (bool, error)

// Read a certificate stored/embedded in a file
Read() (*x509.Certificate, error)
Expand All @@ -61,17 +61,20 @@ func newPKICertificateReadWriter(certificateDir string, baseName string) *pkiCer
}

// Exists checks if a certificate exist
func (rw *pkiCertificateReadWriter) Exists() bool {
func (rw *pkiCertificateReadWriter) Exists() (bool, error) {
certificatePath, _ := pkiutil.PathsForCertAndKey(rw.certificateDir, rw.baseName)
return fileExists(certificatePath)
}

func fileExists(filename string) bool {
func fileExists(filename string) (bool, error) {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
if err != nil {
if os.IsNotExist(err) {
return false, nil
}
return false, err
}
return !info.IsDir()
return !info.IsDir(), nil
}

// Read a certificate from a file the K8s pki managed by kubeadm
Expand Down Expand Up @@ -120,7 +123,7 @@ func newKubeconfigReadWriter(kubernetesDir string, kubeConfigFileName string, ce
}

// Exists checks if a certificate embedded in kubeConfig file exists
func (rw *kubeConfigReadWriter) Exists() bool {
func (rw *kubeConfigReadWriter) Exists() (bool, error) {
return fileExists(rw.kubeConfigFilePath)
}

Expand Down
145 changes: 145 additions & 0 deletions cmd/kubeadm/app/phases/certs/renewal/readwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package renewal
import (
"crypto"
"crypto/x509"
"fmt"
"net"
"os"
"path/filepath"
Expand Down Expand Up @@ -199,3 +200,147 @@ func writeTestKubeconfig(t *testing.T, dir, name string, caCert *x509.Certificat

return cert
}

func TestFileExists(t *testing.T) {
tmpdir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("Couldn't create tmpdir: %v", err)
}
defer func() {
err = os.RemoveAll(tmpdir)
if err != nil {
t.Fatalf("Fail to remove tmpdir: %v", err)
}
}()
tmpfile, err := os.CreateTemp(tmpdir, "")
if err != nil {
t.Fatalf("Couldn't create tmpfile: %v", err)
}
tests := []struct {
name string
filename string
want bool
}{
{
name: "file exist",
filename: tmpfile.Name(),
want: true,
},
{
name: "file does not exist",
filename: "foo",
want: false,
},
{
name: "file path is a dir",
filename: tmpdir,
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got, _ := fileExists(tt.filename); got != tt.want {
t.Errorf("fileExists() = %v, want %v", got, tt.want)
}
})
}
}

func TestPKICertificateReadWriterExists(t *testing.T) {
tmpdir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("Couldn't create tmpdir: %v", err)
}
defer func() {
err = os.RemoveAll(tmpdir)
if err != nil {
t.Fatalf("Fail to remove tmpdir: %v", err)
}
}()
filename := "testfile"
tmpfilepath := filepath.Join(tmpdir, fmt.Sprintf(filename+".crt"))
err = os.WriteFile(tmpfilepath, nil, 0644)
if err != nil {
t.Fatalf("Couldn't write file: %v", err)
}
type fields struct {
baseName string
certificateDir string
}
tests := []struct {
name string
fields fields
want bool
}{
{
name: "cert file exists",
fields: fields{
baseName: filename,
certificateDir: tmpdir,
},
want: true,
},
{
name: "cert file does not exist",
fields: fields{
baseName: "foo",
certificateDir: tmpdir,
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rw := &pkiCertificateReadWriter{
baseName: tt.fields.baseName,
certificateDir: tt.fields.certificateDir,
}
if got, _ := rw.Exists(); got != tt.want {
t.Errorf("pkiCertificateReadWriter.Exists() = %v, want %v", got, tt.want)
}
})
}
}

func TestKubeConfigReadWriterExists(t *testing.T) {
tmpdir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("Couldn't create tmpdir: %v", err)
}
defer func() {
err = os.RemoveAll(tmpdir)
if err != nil {
t.Fatalf("Fail to remove tmpdir: %v", err)
}
}()
tmpfile, err := os.CreateTemp(tmpdir, "")
if err != nil {
t.Fatalf("Couldn't create tmpfile: %v", err)
}
tests := []struct {
name string
kubeConfigFilePath string
want bool
}{
{
name: "file exists",
kubeConfigFilePath: tmpfile.Name(),
want: true,
},
{
name: "file does not exist",
kubeConfigFilePath: "foo",
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rw := &kubeConfigReadWriter{
kubeConfigFilePath: tt.kubeConfigFilePath,
}
if got, _ := rw.Exists(); got != tt.want {
t.Errorf("kubeConfigReadWriter.Exists() = %v, want %v", got, tt.want)
}
})
}
}
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0
go.uber.org/goleak v1.2.1
go.uber.org/zap v1.19.0
golang.org/x/crypto v0.16.0
golang.org/x/net v0.19.0
golang.org/x/crypto v0.21.0
golang.org/x/net v0.23.0
golang.org/x/oauth2 v0.7.0
golang.org/x/sync v0.5.0
golang.org/x/sys v0.15.0
golang.org/x/term v0.15.0
golang.org/x/sys v0.18.0
golang.org/x/term v0.18.0
golang.org/x/time v0.3.0
golang.org/x/tools v0.16.1
google.golang.org/api v0.114.0
Expand Down
9 changes: 6 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1087,11 +1088,13 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
28 changes: 9 additions & 19 deletions hack/lib/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -722,15 +722,14 @@ kube::golang::build_binaries_for_platform() {
done

V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
V=3 kube::log::info "Building binaries with GCFLAGS=${gogcflags} ASMFLAGS=${goasmflags} LDFLAGS=${goldflags}"
V=3 kube::log::info "Building binaries with GCFLAGS=${gogcflags} LDFLAGS=${goldflags}"

local -a build_args
if [[ "${#statics[@]}" != 0 ]]; then
build_args=(
-installsuffix=static
${goflags:+"${goflags[@]}"}
-gcflags="${gogcflags}"
-asmflags="${goasmflags}"
-ldflags="${goldflags}"
-tags="${gotags:-}"
)
Expand All @@ -741,7 +740,6 @@ kube::golang::build_binaries_for_platform() {
build_args=(
${goflags:+"${goflags[@]}"}
-gcflags="${gogcflags}"
-asmflags="${goasmflags}"
-ldflags="${goldflags}"
-tags="${gotags:-}"
)
Expand All @@ -757,7 +755,6 @@ kube::golang::build_binaries_for_platform() {
go test -c \
${goflags:+"${goflags[@]}"} \
-gcflags="${gogcflags}" \
-asmflags="${goasmflags}" \
-ldflags="${goldflags}" \
-tags="${gotags:-}" \
-o "${outfile}" \
Expand Down Expand Up @@ -814,26 +811,19 @@ kube::golang::build_binaries() {
# These are "local" but are visible to and relied on by functions this
# function calls. They are effectively part of the calling API to
# build_binaries_for_platform.
local goflags goldflags goasmflags gogcflags gotags
local goflags goldflags gogcflags gotags

# This is $(pwd) because we use run-in-gopath to build. Once that is
# excised, this can become ${KUBE_ROOT}.
local trimroot # two lines to appease shellcheck SC2155
trimroot=$(pwd)

goasmflags="all=-trimpath=${trimroot}"
goflags=()
gogcflags="${GOGCFLAGS:-}"
goldflags="all=$(kube::version::ldflags) ${GOLDFLAGS:-}"

gogcflags="all=-trimpath=${trimroot} ${GOGCFLAGS:-}"
if [[ "${DBG:-}" == 1 ]]; then
# Debugging - disable optimizations and inlining and trimPath
gogcflags="${GOGCFLAGS:-} all=-N -l"
goasmflags=""
fi

goldflags="all=$(kube::version::ldflags) ${GOLDFLAGS:-}"
if [[ "${DBG:-}" != 1 ]]; then
# Not debugging - disable symbols and DWARF.
gogcflags="${gogcflags} all=-N -l"
else
# Not debugging - disable symbols and DWARF, trim embedded paths
goldflags="${goldflags} -s -w"
goflags+=("-trimpath")
fi

# Extract tags if any specified in GOFLAGS
Expand Down