Skip to content

Commit 72d01d1

Browse files
Merge pull request #2702 from redhat-chai-bot/rebase-v1.34.9
OCPBUGS-91759: Rebase v1.34.9 in release-4.21
2 parents a8c502a + 5e73cca commit 72d01d1

21 files changed

Lines changed: 535 additions & 172 deletions

File tree

.go-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.25.9
1+
1.25.11

CHANGELOG/CHANGELOG-1.34.md

Lines changed: 192 additions & 85 deletions
Large diffs are not rendered by default.

build/build-image/cross/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.34.0-go1.25.9-bullseye.0
1+
v1.34.0-go1.25.11-bullseye.0

build/common.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ readonly KUBE_RSYNC_PORT="${KUBE_RSYNC_PORT:-}"
9797
readonly KUBE_CONTAINER_RSYNC_PORT=8730
9898

9999
# These are the default versions (image tags) for their respective base images.
100-
readonly __default_distroless_iptables_version=v0.8.9
101-
readonly __default_go_runner_version=v2.4.0-go1.25.9-bookworm.0
100+
readonly __default_distroless_iptables_version=v0.8.11
101+
readonly __default_go_runner_version=v2.4.0-go1.25.11-bookworm.0
102102
readonly __default_setcap_version=bookworm-v1.0.6
103103

104104
# These are the base images for the Docker-wrapped binaries.

build/dependencies.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ dependencies:
118118
# should also be updated, but go-runner is much harder to exploit and has
119119
# far less relevancy to go updates for Kubernetes more generally.
120120
- name: "registry.k8s.io/kube-cross: dependents"
121-
version: v1.34.0-go1.25.9-bullseye.0
121+
version: v1.34.0-go1.25.11-bullseye.0
122122
refPaths:
123123
- path: build/build-image/cross/VERSION
124124

@@ -166,15 +166,15 @@ dependencies:
166166
match: registry\.k8s\.io\/build-image\/debian-base:[a-zA-Z]+\-v((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)
167167

168168
- name: "registry.k8s.io/distroless-iptables: dependents"
169-
version: v0.8.9
169+
version: v0.8.11
170170
refPaths:
171171
- path: build/common.sh
172172
match: __default_distroless_iptables_version=
173173
- path: test/utils/image/manifest.go
174174
match: configs\[DistrolessIptables\] = Config{list\.BuildImageRegistry, "distroless-iptables", "v([0-9]+)\.([0-9]+)\.([0-9]+)"}
175175

176176
- name: "registry.k8s.io/go-runner: dependents"
177-
version: v2.4.0-go1.25.9-bookworm.0
177+
version: v2.4.0-go1.25.11-bookworm.0
178178
refPaths:
179179
- path: build/common.sh
180180
match: __default_go_runner_version=

cmd/kubeadm/app/cmd/phases/init/certs.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package phases
1818

1919
import (
2020
"fmt"
21+
"os"
2122
"path/filepath"
2223
"strings"
2324

@@ -216,20 +217,25 @@ func runCAPhase(ca *certsphase.KubeadmCert) func(c workflow.RunData) error {
216217

217218
if cert, err := pkiutil.TryLoadCertFromDisk(data.CertificateDir(), ca.BaseName); err == nil {
218219
certsphase.CheckCertificatePeriodValidity(ca.BaseName, cert)
220+
srcCertPath, srcKeyPath := pkiutil.PathsForCertAndKey(data.CertificateDir(), ca.BaseName)
221+
dryRunCertPath, dryRunKeyPath := pkiutil.PathsForCertAndKey(data.CertificateWriteDir(), ca.BaseName)
219222

220223
// If CA Cert existed while dryrun, copy CA Cert to dryrun dir for later use
221224
if data.DryRun() {
222-
err := kubeadmutil.CopyFile(filepath.Join(data.CertificateDir(), kubeadmconstants.CACertName), filepath.Join(data.CertificateWriteDir(), kubeadmconstants.CACertName))
225+
if err := os.MkdirAll(filepath.Dir(dryRunCertPath), os.FileMode(0700)); err != nil {
226+
return errors.Wrapf(err, "failed to create directory %s", filepath.Dir(dryRunCertPath))
227+
}
228+
err := kubeadmutil.CopyFile(srcCertPath, dryRunCertPath)
223229
if err != nil {
224-
return errors.Wrapf(err, "could not copy %s to dry run directory %s", kubeadmconstants.CACertName, data.CertificateWriteDir())
230+
return errors.Wrapf(err, "could not copy %s to dry run directory %s", fmt.Sprintf("%s.crt", ca.BaseName), data.CertificateWriteDir())
225231
}
226232
}
227233
if _, err := pkiutil.TryLoadKeyFromDisk(data.CertificateDir(), ca.BaseName); err == nil {
228234
// If CA Key existed while dryrun, copy CA Key to dryrun dir for later use
229235
if data.DryRun() {
230-
err := kubeadmutil.CopyFile(filepath.Join(data.CertificateDir(), kubeadmconstants.CAKeyName), filepath.Join(data.CertificateWriteDir(), kubeadmconstants.CAKeyName))
236+
err := kubeadmutil.CopyFile(srcKeyPath, dryRunKeyPath)
231237
if err != nil {
232-
return errors.Wrapf(err, "could not copy %s to dry run directory %s", kubeadmconstants.CAKeyName, data.CertificateWriteDir())
238+
return errors.Wrapf(err, "could not copy %s to dry run directory %s", fmt.Sprintf("%s.key", ca.BaseName), data.CertificateWriteDir())
233239
}
234240
}
235241
fmt.Printf("[certs] Using existing %s certificate authority\n", ca.BaseName)

cmd/kubeadm/app/cmd/phases/init/certs_test.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ limitations under the License.
1717
package phases
1818

1919
import (
20+
"os"
21+
"path/filepath"
2022
"testing"
2123

2224
"github.com/spf13/cobra"
2325

2426
kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
2527
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
28+
certsphase "k8s.io/kubernetes/cmd/kubeadm/app/phases/certs"
2629
certstestutil "k8s.io/kubernetes/cmd/kubeadm/app/util/certs"
30+
"k8s.io/kubernetes/cmd/kubeadm/app/util/pkiutil"
2731
pkiutiltesting "k8s.io/kubernetes/cmd/kubeadm/app/util/pkiutil/testing"
2832
testutil "k8s.io/kubernetes/cmd/kubeadm/test"
2933
)
@@ -33,10 +37,19 @@ type testCertsData struct {
3337
cfg *kubeadmapi.InitConfiguration
3438
}
3539

40+
type testDryRunCertsData struct {
41+
testCertsData
42+
certificateDir string
43+
certificateWriteDir string
44+
}
45+
3646
func (t *testCertsData) Cfg() *kubeadmapi.InitConfiguration { return t.cfg }
3747
func (t *testCertsData) ExternalCA() bool { return false }
3848
func (t *testCertsData) CertificateDir() string { return t.cfg.CertificatesDir }
3949
func (t *testCertsData) CertificateWriteDir() string { return t.cfg.CertificatesDir }
50+
func (t *testDryRunCertsData) DryRun() bool { return true }
51+
func (t *testDryRunCertsData) CertificateDir() string { return t.certificateDir }
52+
func (t *testDryRunCertsData) CertificateWriteDir() string { return t.certificateWriteDir }
4053

4154
func TestCreateSparseCerts(t *testing.T) {
4255
for _, test := range certstestutil.GetSparseCertTestCases(t) {
@@ -63,3 +76,45 @@ func TestCreateSparseCerts(t *testing.T) {
6376
})
6477
}
6578
}
79+
80+
func TestRunCAPhaseCopiesExistingCAFilesToDryRunDir(t *testing.T) {
81+
for _, ca := range []*certsphase.KubeadmCert{
82+
certsphase.KubeadmCertRootCA(),
83+
certsphase.KubeadmCertFrontProxyCA(),
84+
certsphase.KubeadmCertEtcdCA(),
85+
} {
86+
t.Run(ca.Name, func(t *testing.T) {
87+
pkiutiltesting.Reset()
88+
89+
sourceDir := t.TempDir()
90+
writeDir := t.TempDir()
91+
caCert, caKey := certstestutil.SetupCertificateAuthority(t)
92+
certPath, _ := pkiutil.PathsForCertAndKey(sourceDir, ca.BaseName)
93+
if err := os.MkdirAll(filepath.Dir(certPath), os.FileMode(0700)); err != nil {
94+
t.Fatalf("failed to create source directory for %s: %v", ca.BaseName, err)
95+
}
96+
if err := pkiutil.WriteCertAndKey(sourceDir, ca.BaseName, caCert, caKey); err != nil {
97+
t.Fatalf("failed to write source CA files for %s: %v", ca.BaseName, err)
98+
}
99+
100+
cfg := testutil.GetDefaultInternalConfig(t)
101+
cfg.CertificatesDir = sourceDir
102+
data := &testDryRunCertsData{
103+
testCertsData: testCertsData{cfg: cfg},
104+
certificateDir: sourceDir,
105+
certificateWriteDir: writeDir,
106+
}
107+
108+
if err := runCAPhase(ca)(data); err != nil {
109+
t.Fatalf("runCAPhase(%s) returned error: %v", ca.Name, err)
110+
}
111+
112+
if _, err := pkiutil.TryLoadCertFromDisk(writeDir, ca.BaseName); err != nil {
113+
t.Fatalf("expected copied cert for %s in dry-run dir: %v", ca.BaseName, err)
114+
}
115+
if _, err := pkiutil.TryLoadKeyFromDisk(writeDir, ca.BaseName); err != nil {
116+
t.Fatalf("expected copied key for %s in dry-run dir: %v", ca.BaseName, err)
117+
}
118+
})
119+
}
120+
}

openshift-hack/images/hyperkube/Dockerfile.rhel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ COPY --from=builder /tmp/build/* /usr/bin/
1414
LABEL io.k8s.display-name="OpenShift Kubernetes Server Commands" \
1515
io.k8s.description="OpenShift is a platform for developing, building, and deploying containerized applications." \
1616
io.openshift.tags="openshift,hyperkube" \
17-
io.openshift.build.versions="kubernetes=1.34.8"
17+
io.openshift.build.versions="kubernetes=1.34.9"

pkg/controller/endpoint/endpoints_controller.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,22 @@ func (e *Controller) addPod(obj interface{}) {
220220

221221
func podToEndpointAddressForService(svc *v1.Service, pod *v1.Pod) (*v1.EndpointAddress, error) {
222222
var endpointIP string
223-
224-
wantIPv6 := svc.Spec.IPFamilies[0] == v1.IPv6Protocol
223+
ipFamily := v1.IPv4Protocol
224+
225+
// IPFamilies is expected to be populated by apiserver defaulting, but
226+
// some services may reach this controller with an empty IPFamilies via
227+
// watch events. Infer the family from ClusterIP or
228+
// pod IP so we never panic on IPFamilies[0].
229+
if len(svc.Spec.IPFamilies) > 0 {
230+
ipFamily = svc.Spec.IPFamilies[0]
231+
} else if len(svc.Spec.ClusterIP) > 0 && svc.Spec.ClusterIP != v1.ClusterIPNone {
232+
if utilnet.IsIPv6String(svc.Spec.ClusterIP) {
233+
ipFamily = v1.IPv6Protocol
234+
}
235+
} else if utilnet.IsIPv6String(pod.Status.PodIP) {
236+
ipFamily = v1.IPv6Protocol
237+
}
238+
wantIPv6 := ipFamily == v1.IPv6Protocol
225239

226240
// Find an IP that matches the family. We parse and restringify the IP in case the
227241
// value on the Pod is in an irregular format.

pkg/controller/endpoint/endpoints_controller_test.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,3 +3167,83 @@ func TestSyncEndpointsAddDeletePorts(t *testing.T) {
31673167
t.Fatalf("incorrect endpoints after deleting first port:\n%s", diff)
31683168
}
31693169
}
3170+
3171+
func TestPodToEndpointAddressForServiceEmptyIPFamilies(t *testing.T) {
3172+
testCases := []struct {
3173+
name string
3174+
clusterIP string
3175+
podIPs []v1.PodIP
3176+
podIP string
3177+
wantErr bool
3178+
wantFamily v1.IPFamily
3179+
}{
3180+
{
3181+
name: "headful IPv4, IPv4 pod",
3182+
clusterIP: "10.0.0.1",
3183+
podIPs: []v1.PodIP{{IP: "10.244.0.1"}},
3184+
wantFamily: v1.IPv4Protocol,
3185+
},
3186+
{
3187+
name: "headful IPv6, IPv6 pod",
3188+
clusterIP: "fd00::1",
3189+
podIPs: []v1.PodIP{{IP: "fd00::10"}},
3190+
wantFamily: v1.IPv6Protocol,
3191+
},
3192+
{
3193+
name: "headful IPv4, no matching pod IP",
3194+
clusterIP: "10.0.0.1",
3195+
podIPs: []v1.PodIP{{IP: "fd00::10"}},
3196+
wantErr: true,
3197+
},
3198+
{
3199+
name: "headless, IPv4 pod",
3200+
clusterIP: v1.ClusterIPNone,
3201+
podIPs: []v1.PodIP{{IP: "10.244.0.1"}},
3202+
podIP: "10.244.0.1",
3203+
wantFamily: v1.IPv4Protocol,
3204+
},
3205+
{
3206+
name: "headless, IPv6 pod",
3207+
clusterIP: v1.ClusterIPNone,
3208+
podIPs: []v1.PodIP{{IP: "fd00::10"}},
3209+
podIP: "fd00::10",
3210+
wantFamily: v1.IPv6Protocol,
3211+
},
3212+
}
3213+
3214+
for _, tc := range testCases {
3215+
t.Run(tc.name, func(t *testing.T) {
3216+
svc := &v1.Service{
3217+
ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "bar"},
3218+
Spec: v1.ServiceSpec{
3219+
// Intentionally leave IPFamilies empty.
3220+
ClusterIP: tc.clusterIP,
3221+
},
3222+
}
3223+
pod := &v1.Pod{
3224+
ObjectMeta: metav1.ObjectMeta{Name: "foo-pod", Namespace: "bar", UID: "uid-1"},
3225+
Spec: v1.PodSpec{NodeName: "node-1"},
3226+
Status: v1.PodStatus{PodIP: tc.podIP, PodIPs: tc.podIPs},
3227+
}
3228+
3229+
addr, err := podToEndpointAddressForService(svc, pod)
3230+
if tc.wantErr {
3231+
if err == nil {
3232+
t.Fatalf("expected error but got addr=%v", addr)
3233+
}
3234+
return
3235+
}
3236+
if err != nil {
3237+
t.Fatalf("unexpected error: %v", err)
3238+
}
3239+
if addr == nil {
3240+
t.Fatal("expected an address but got nil")
3241+
}
3242+
isV6 := utilnet.IsIPv6String(addr.IP)
3243+
wantV6 := tc.wantFamily == v1.IPv6Protocol
3244+
if isV6 != wantV6 {
3245+
t.Errorf("got IP %q (IPv6=%v), want family %v", addr.IP, isV6, tc.wantFamily)
3246+
}
3247+
})
3248+
}
3249+
}

0 commit comments

Comments
 (0)