Skip to content
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
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.24.9
1.24.6
212 changes: 54 additions & 158 deletions CHANGELOG/CHANGELOG-1.34.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.34.0-go1.24.9-bullseye.0
v1.34.0-go1.24.6-bullseye.0
6 changes: 3 additions & 3 deletions build/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ 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.7.11
readonly __default_go_runner_version=v2.4.0-go1.24.9-bookworm.0
readonly __default_setcap_version=bookworm-v1.0.6
readonly __default_distroless_iptables_version=v0.7.8
readonly __default_go_runner_version=v2.4.0-go1.24.6-bookworm.0
readonly __default_setcap_version=bookworm-v1.0.4

# These are the base images for the Docker-wrapped binaries.
readonly KUBE_GORUNNER_IMAGE="${KUBE_GORUNNER_IMAGE:-$KUBE_BASE_IMAGE_REGISTRY/go-runner:$__default_go_runner_version}"
Expand Down
18 changes: 11 additions & 7 deletions build/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies:

# etcd
- name: "etcd"
version: 3.6.5
version: 3.6.4
refPaths:
- path: cluster/gce/manifests/etcd.manifest
match: etcd_docker_tag|etcd_version
Expand All @@ -74,6 +74,10 @@ dependencies:
match: DefaultEtcdVersion =
- path: hack/lib/etcd.sh
match: ETCD_VERSION=
- path: staging/src/k8s.io/sample-apiserver/artifacts/example/deployment.yaml
match: gcr.io/etcd-development/etcd
- path: test/utils/image/manifest.go
match: configs\[Etcd\] = Config{list\.GcEtcdRegistry, "etcd", "\d+\.\d+.\d+(-(alpha|beta|rc).\d+)?(-\d+)?"}

- name: "etcd-image"
version: 3.6.4
Expand Down Expand Up @@ -113,7 +117,7 @@ dependencies:
# Golang
# TODO: this should really be eliminated and controlled by .go-version
- name: "golang: upstream version"
version: 1.24.9
version: 1.24.6
refPaths:
- path: .go-version
- path: build/build-image/cross/VERSION
Expand All @@ -134,13 +138,13 @@ dependencies:
match: minimum_go_version=go([0-9]+\.[0-9]+)

- name: "registry.k8s.io/kube-cross: dependents"
version: v1.34.0-go1.24.9-bullseye.0
version: v1.34.0-go1.24.6-bullseye.0
refPaths:
- path: build/build-image/cross/VERSION

# Base images
- name: "registry.k8s.io/debian-base: dependents"
version: bookworm-v1.0.6
version: bookworm-v1.0.4
refPaths:
- path: cluster/images/etcd/Makefile
match: BASEIMAGE\?\=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-]+)*))?)
Expand Down Expand Up @@ -170,15 +174,15 @@ dependencies:
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-]+)*))?)

- name: "registry.k8s.io/distroless-iptables: dependents"
version: v0.7.11
version: v0.7.8
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.4.0-go1.24.9-bookworm.0
version: v2.4.0-go1.24.6-bookworm.0
refPaths:
- path: build/common.sh
match: __default_go_runner_version=
Expand Down Expand Up @@ -236,7 +240,7 @@ dependencies:
match: configs\[Pause\] = Config{list\.GcRegistry, "pause", "\d+\.\d+(.\d+)?"}

- name: "registry.k8s.io/build-image/setcap: dependents"
version: bookworm-v1.0.6
version: bookworm-v1.0.4
refPaths:
- path: build/common.sh
match: __default_setcap_version=
Expand Down
2 changes: 1 addition & 1 deletion cluster/addons/addon-manager/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TEMP_DIR:=$(shell mktemp -d)
VERSION=v9.1.8
KUBECTL_VERSION?=v1.32.2

BASEIMAGE=registry.k8s.io/build-image/debian-base-$(ARCH):bookworm-v1.0.6
BASEIMAGE=registry.k8s.io/build-image/debian-base-$(ARCH):bookworm-v1.0.4

SUDO=$(if $(filter 0,$(shell id -u)),,sudo)

Expand Down
4 changes: 2 additions & 2 deletions cluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,13 @@ EOF
;;
server)
echo "Generate server certificates..."
echo '{"CN":"'"${member_ip}"'","hosts":[],"key":{"algo":"ecdsa","size":256}}' \
echo '{"CN":"'"${member_ip}"'","hosts":[""],"key":{"algo":"ecdsa","size":256}}' \
| ${CFSSL_BIN} gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server -hostname="${member_ip},127.0.0.1" - \
| ${CFSSLJSON_BIN} -bare "${prefix}"
;;
peer)
echo "Generate peer certificates..."
echo '{"CN":"'"${member_ip}"'","hosts":[],"key":{"algo":"ecdsa","size":256}}' \
echo '{"CN":"'"${member_ip}"'","hosts":[""],"key":{"algo":"ecdsa","size":256}}' \
| ${CFSSL_BIN} gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=peer -hostname="${member_ip},127.0.0.1" - \
| ${CFSSLJSON_BIN} -bare "${prefix}"
;;
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fi
# By default, the latest image from the image family will be used unless an
# explicit image will be set.
GCI_VERSION=${KUBE_GCI_VERSION:-}
IMAGE_FAMILY=${KUBE_IMAGE_FAMILY:-cos-121-lts}
IMAGE_FAMILY=${KUBE_IMAGE_FAMILY:-cos-109-lts}
export MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-}
export MASTER_IMAGE_FAMILY=${KUBE_GCE_MASTER_IMAGE_FAMILY:-${IMAGE_FAMILY}}
export MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-cos-cloud}
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/config-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ALLOWED_NOTREADY_NODES=${ALLOWED_NOTREADY_NODES:-$(($(get-num-nodes) / 100))}
# By default, the latest image from the image family will be used unless an
# explicit image will be set.
GCI_VERSION=${KUBE_GCI_VERSION:-}
IMAGE_FAMILY=${KUBE_IMAGE_FAMILY:-cos-121-lts}
IMAGE_FAMILY=${KUBE_IMAGE_FAMILY:-cos-109-lts}
export MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-}
export MASTER_IMAGE_FAMILY=${KUBE_GCE_MASTER_IMAGE_FAMILY:-${IMAGE_FAMILY}}
export MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-cos-cloud}
Expand Down
12 changes: 4 additions & 8 deletions cluster/gce/gci/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1963,14 +1963,10 @@ def resolve(host):
fi
sed -i -e "s@{{ *etcd_protocol *}}@$etcd_protocol@g" "${temp_file}"
sed -i -e "s@{{ *etcd_apiserver_protocol *}}@$etcd_apiserver_protocol@g" "${temp_file}"

etcd_creds_and_extra_args="${etcd_creds} ${etcd_apiserver_creds} ${etcd_extra_args}"
etcd_creds_and_extra_args=$(echo "$etcd_creds_and_extra_args" | awk '{for (i=1;i<=NF;i++) printf "\"%s\"%s", $i, (i<NF?", ":"") }')
etcdctl_certs=$(echo "$etcdctl_certs" | awk '{for (i=1; i<=NF; i++) printf "\"%s\",", $i }')

sed -i -e "s@{{ *etcd_creds_and_extra_args *}}@$etcd_creds_and_extra_args@g" "${temp_file}"

sed -i -e "s@{{ *etcd_creds *}}@$etcd_creds@g" "${temp_file}"
sed -i -e "s@{{ *etcdctl_certs *}}@$etcdctl_certs@g" "${temp_file}"
sed -i -e "s@{{ *etcd_apiserver_creds *}}@$etcd_apiserver_creds@g" "${temp_file}"
sed -i -e "s@{{ *etcd_extra_args *}}@$etcd_extra_args@g" "${temp_file}"
if [[ -n "${ETCD_VERSION:-}" ]]; then
sed -i -e "s@{{ *pillar\.get('etcd_version', '\(.*\)') *}}@${ETCD_VERSION}@g" "${temp_file}"
else
Expand Down Expand Up @@ -3204,7 +3200,7 @@ spec:
- name: vol
containers:
- name: pv-recycler
image: registry.k8s.io/build-image/debian-base:bookworm-v1.0.6
image: registry.k8s.io/build-image/debian-base:bookworm-v1.0.4
command:
- /bin/sh
args:
Expand Down
36 changes: 15 additions & 21 deletions cluster/gce/manifests/etcd.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,23 @@
{
"name": "etcd-container",
{{security_context}}
"image": "{{ pillar.get('etcd_docker_repository', 'registry.k8s.io/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.6.5-0') }}",
"image": "{{ pillar.get('etcd_docker_repository', 'registry.k8s.io/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.6.4-0') }}",
"resources": {
"requests": {
"cpu": {{ cpulimit }}
}
},
"command": [
"/usr/local/bin/etcd",
"--name=etcd-{{ hostname }}",
"--listen-peer-urls={{ etcd_protocol }}://{{ host_ip }}:{{ server_port }}",
"--initial-advertise-peer-urls={{ etcd_protocol }}://{{ hostname }}:{{ server_port }}",
"--advertise-client-urls={{ etcd_apiserver_protocol }}://127.0.0.1:{{ port }}",
"--listen-client-urls={{ etcd_apiserver_protocol }}://{{ listen_client_ip }}:{{ port }}",
"{{ quota_bytes }}",
"--data-dir=/var/etcd/data{{ suffix }}",
"--initial-cluster-state={{ cluster_state }}",
"--initial-cluster={{ etcd_cluster }}",
"--log-outputs=/var/log/etcd{{ suffix }}.log",
{{ etcd_creds_and_extra_args }}
],
"/bin/sh",
"-c",
"if [ -e /usr/local/bin/migrate-if-needed.sh ]; then /usr/local/bin/migrate-if-needed.sh 1>>/var/log/etcd{{ suffix }}.log 2>&1; fi; exec /usr/local/bin/etcd --name etcd-{{ hostname }} --listen-peer-urls {{ etcd_protocol }}://{{ host_ip }}:{{ server_port }} --initial-advertise-peer-urls {{ etcd_protocol }}://{{ hostname }}:{{ server_port }} --advertise-client-urls {{ etcd_apiserver_protocol }}://127.0.0.1:{{ port }} --listen-client-urls {{ etcd_apiserver_protocol }}://{{ listen_client_ip }}:{{ port }} {{ quota_bytes }} --data-dir /var/etcd/data{{ suffix }} --initial-cluster-state {{ cluster_state }} --initial-cluster {{ etcd_cluster }} {{ etcd_creds }} {{ etcd_apiserver_creds }} {{ etcd_extra_args }} 1>>/var/log/etcd{{ suffix }}.log 2>&1"
],
"env": [
{ "name": "TARGET_STORAGE",
"value": "{{ pillar.get('storage_backend', 'etcd3') }}"
},
{ "name": "TARGET_VERSION",
"value": "{{ pillar.get('etcd_version', '3.6.5') }}"
"value": "{{ pillar.get('etcd_version', '3.6.4') }}"
},
{
"name": "DO_NOT_MOVE_BINARIES",
Expand All @@ -61,6 +52,12 @@
{ "name": "INITIAL_ADVERTISE_PEER_URLS",
"value": "{{ etcd_protocol }}://{{ hostname }}:{{ server_port }}"
},
{ "name": "ETCD_CREDS",
"value": "{{ etcd_creds }}"
},
{ "name": "ETCD_APISERVER_CREDS",
"value": "{{ etcd_apiserver_creds }}"
},
{ "name": "ETCD_SNAPSHOT_COUNT",
"value": "10000"
},
Expand All @@ -75,12 +72,9 @@
"livenessProbe": {
"exec": {
"command": [
"/usr/local/bin/etcdctl",
"--endpoints=127.0.0.1:{{ port }}",
"--command-timeout=15s",
{{ etcdctl_certs }}
"endpoint",
"health"
"/bin/sh",
"-c",
"set -x; exec /usr/local/bin/etcdctl --endpoints=127.0.0.1:{{ port }} {{ etcdctl_certs }} --command-timeout=15s endpoint health"
]
},
"initialDelaySeconds": {{ liveness_probe_initial_delay }},
Expand Down
4 changes: 2 additions & 2 deletions cluster/gce/upgrade-aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export KUBE_GCE_ENABLE_IP_ALIASES=true
export SECONDARY_RANGE_NAME="pods-default"
export STORAGE_BACKEND="etcd3"
export STORAGE_MEDIA_TYPE="application/vnd.kubernetes.protobuf"
export ETCD_IMAGE=3.6.5-0
export ETCD_VERSION=3.6.5
export ETCD_IMAGE=3.6.4-0
export ETCD_VERSION=3.6.4

# Upgrade master with updated kube envs
"${KUBE_ROOT}/cluster/gce/upgrade.sh" -M -l
Expand Down
12 changes: 6 additions & 6 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ function generate-certs {
# make the config for the signer
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","client auth"]}}}' > "ca-config.json"
# create the kubelet client cert with the correct groups
echo '{"CN":"kubelet","names":[{"O":"system:nodes"}],"hosts":[],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare kubelet
echo '{"CN":"kubelet","names":[{"O":"system:nodes"}],"hosts":[""],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare kubelet
mv "kubelet-key.pem" "pki/private/kubelet.key"
mv "kubelet.pem" "pki/issued/kubelet.crt"
rm -f "kubelet.csr"
Expand Down Expand Up @@ -1900,7 +1900,7 @@ function generate-aggregator-certs {
# make the config for the signer
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","client auth"]}}}' > "ca-config.json"
# create the aggregator client cert with the correct groups
echo '{"CN":"aggregator","hosts":[],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare proxy-client
echo '{"CN":"aggregator","hosts":[""],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare proxy-client
mv "proxy-client-key.pem" "pki/private/proxy-client.key"
mv "proxy-client.pem" "pki/issued/proxy-client.crt"
rm -f "proxy-client.csr"
Expand Down Expand Up @@ -1961,7 +1961,7 @@ function generate-konnectivity-server-certs {
# make the config for the signer
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","client auth"]}}}' > "ca-config.json"
# create the konnectivity server cert with the correct groups
echo '{"CN":"konnectivity-server","hosts":[],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare konnectivity-server
echo '{"CN":"konnectivity-server","hosts":[""],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare konnectivity-server
rm -f "konnectivity-server.csr"

# Make the agent <-> konnectivity server side certificates.
Expand All @@ -1977,7 +1977,7 @@ function generate-konnectivity-server-certs {
# make the config for the signer
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","agent auth"]}}}' > "ca-config.json"
# create the konnectivity server cert with the correct groups
echo '{"CN":"koonectivity-server","hosts":[],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare konnectivity-agent
echo '{"CN":"koonectivity-server","hosts":[""],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare konnectivity-agent
rm -f "konnectivity-agent.csr"

echo "completed main certificate section") &>"${cert_create_debug_output}" || true
Expand Down Expand Up @@ -2039,7 +2039,7 @@ function generate-cloud-pvl-admission-certs {
# make the config for the signer
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","client auth"]}}}' > "ca-config.json"
# create the cloud-pvl-admission cert with the correct groups
echo '{"CN":"cloud-pvl-admission","hosts":[],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare cloud-pvl-admission
echo '{"CN":"cloud-pvl-admission","hosts":[""],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare cloud-pvl-admission
rm -f "cloud-pvl-admission.csr"

# Make the cloud-pvl-admission server side certificates.
Expand All @@ -2055,7 +2055,7 @@ function generate-cloud-pvl-admission-certs {
# make the config for the signer
echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","agent auth"]}}}' > "ca-config.json"
# create the cloud-pvl-admission server cert with the correct groups
echo '{"CN":"cloud-pvl-admission","hosts":[],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare konnectivity-agent
echo '{"CN":"cloud-pvl-admission","hosts":[""],"key":{"algo":"rsa","size":2048}}' | "${CFSSL_BIN}" gencert -ca=pki/ca.crt -ca-key=pki/private/ca.key -config=ca-config.json - | "${CFSSLJSON_BIN}" -bare konnectivity-agent
rm -f "konnectivity-agent.csr"

echo "completed main certificate section") &>"${cert_create_debug_output}" || true
Expand Down
10 changes: 5 additions & 5 deletions cluster/images/etcd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,19 @@ DOCKERFILE.windows = Dockerfile.windows
DOCKERFILE := ${DOCKERFILE.${OS}}

ifeq ($(ARCH),amd64)
BASEIMAGE?=registry.k8s.io/build-image/debian-base:bookworm-v1.0.6
BASEIMAGE?=registry.k8s.io/build-image/debian-base:bookworm-v1.0.4
endif
ifeq ($(ARCH),arm)
BASEIMAGE?=registry.k8s.io/build-image/debian-base-arm:bookworm-v1.0.6
BASEIMAGE?=registry.k8s.io/build-image/debian-base-arm:bookworm-v1.0.4
endif
ifeq ($(ARCH),arm64)
BASEIMAGE?=registry.k8s.io/build-image/debian-base-arm64:bookworm-v1.0.6
BASEIMAGE?=registry.k8s.io/build-image/debian-base-arm64:bookworm-v1.0.4
endif
ifeq ($(ARCH),ppc64le)
BASEIMAGE?=registry.k8s.io/build-image/debian-base-ppc64le:bookworm-v1.0.6
BASEIMAGE?=registry.k8s.io/build-image/debian-base-ppc64le:bookworm-v1.0.4
endif
ifeq ($(ARCH),s390x)
BASEIMAGE?=registry.k8s.io/build-image/debian-base-s390x:bookworm-v1.0.6
BASEIMAGE?=registry.k8s.io/build-image/debian-base-s390x:bookworm-v1.0.4
endif

BASE.windows = mcr.microsoft.com/windows/nanoserver
Expand Down
6 changes: 1 addition & 5 deletions cmd/kubeadm/app/cmd/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
"k8s.io/kubernetes/cmd/kubeadm/app/util/errors"
kubeconfigutil "k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
"k8s.io/kubernetes/cmd/kubeadm/app/util/output"
staticpodutil "k8s.io/kubernetes/cmd/kubeadm/app/util/staticpod"
)

var (
Expand Down Expand Up @@ -347,10 +346,7 @@ func getInternalCfg(cfgPath string, client kubernetes.Interface, cfg kubeadmapiv
// In case the user is not providing a custom config, try to get current config from the cluster.
// NB. this operation should not block, because we want to allow certificate renewal also in case of not-working clusters
if cfgPath == "" && client != nil {
getNodeRegistration := true
getAPIEndpoint := staticpodutil.IsControlPlaneNode()
getComponentConfigs := true
internalcfg, err := configutil.FetchInitConfigurationFromCluster(client, printer, logPrefix, getNodeRegistration, getAPIEndpoint, getComponentConfigs)
internalcfg, err := configutil.FetchInitConfigurationFromCluster(client, printer, logPrefix, false, false)
if err == nil {
printer.Println() // add empty line to separate the FetchInitConfigurationFromCluster output from the command output
// certificate renewal or expiration checking doesn't depend on a running cluster, which means the CertificatesDir
Expand Down
40 changes: 18 additions & 22 deletions cmd/kubeadm/app/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ package cmd
import (
"fmt"
"io"
"net"
"os"
"path/filepath"
"slices"
"strconv"

"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
Expand Down Expand Up @@ -571,26 +569,24 @@ func (d *initData) Client() (clientset.Interface, error) {
return d.client, nil
}

// WaitControlPlaneClient returns a basic client used for the purpose of waiting
// for control plane components to report 'ok' on their respective health check endpoints.
// It uses the admin.conf as the base, but modifies it to point at the local API server instead
// of the control plane endpoint.
func (d *initData) WaitControlPlaneClient() (clientset.Interface, error) {
config, err := clientcmd.LoadFromFile(d.KubeConfigPath())
if err != nil {
return nil, err
}
for _, v := range config.Clusters {
v.Server = fmt.Sprintf("https://%s",
net.JoinHostPort(
d.Cfg().LocalAPIEndpoint.AdvertiseAddress,
strconv.Itoa(int(d.Cfg().LocalAPIEndpoint.BindPort)),
),
)
}
client, err := kubeconfigutil.ToClientSet(config)
if err != nil {
return nil, err
// ClientWithoutBootstrap returns a dry-run client or a regular client from admin.conf.
// Unlike Client(), it does not call EnsureAdminClusterRoleBinding() or sets d.client.
// This means the client only has anonymous permissions and does not persist in initData.
func (d *initData) ClientWithoutBootstrap() (clientset.Interface, error) {
var (
client clientset.Interface
err error
)
if d.dryRun {
client, err = getDryRunClient(d)
if err != nil {
return nil, err
}
} else { // Use a real client
client, err = kubeconfigutil.ClientSetFromFile(d.KubeConfigPath())
if err != nil {
return nil, err
}
}
return client, nil
}
Expand Down
Loading