Commit Graph

1125 Commits

Author SHA1 Message Date
carlory
b3415bfdfe kubeadm: added container runtime version check to preflight
Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: carlory <baofa.fan@daocloud.io>
2025-10-31 09:51:01 +08:00
Benjamin Elder
e0df6b178a migrate kubeadm static pod hashing to fnv-1a
128bit fnv-1a should be drop-in for md5 while being fast and non-obsolete
for non-cryptographic purposes.
2025-10-21 15:25:11 -07:00
Lubomir I. Ivanov
0613fdeccb kubeadm: add missing cluster-info context validation
When retrieving the cluster-info CM, ensure the cluster pointed
out by the current context in the kubeconfig is validated.

Add unit test for the above.

Make the function GetClusterFromKubeConfig() to return various
errors. Handle the errors on call sites. Add unit tests
for the update.

The above changes prevent panics when the users has manually
edited and malformed the kubeconfig in the cluster-info CM.
2025-10-20 11:58:58 +02:00
Jordan Liggitt
39d37a1e92 Remove invalid SAN certificate construction 2025-10-13 10:27:22 -07:00
Kubernetes Prow Robot
095b9d6045 Merge pull request #134433 from neolit123/1.35-show-wait-control-plane-errors-more-verbosely
kubeadm: print errors during control-plane-wait retries
2025-10-13 08:13:43 -07:00
Lubomir I. Ivanov
52c734f1e6 kubeadm: print errors during control-plane-wait retries
While waiting for control plane components, the errors during
retries are not shown in higher klog verbosity. Show them
for level 5.
2025-10-13 14:14:37 +02:00
HirazawaUi
7b4d4f72c9 fix lint error 2025-10-10 22:35:03 +08:00
HirazawaUi
d6dec0b345 Revert "Merge pull request #134178 from HirazawaUi/remove-RootlessControlPlane"
This reverts commit fce5a08b92, reversing
changes made to d39b162163.
2025-10-10 18:36:42 +08:00
Lubomir I. Ivanov
b6afe986c6 kubeadm: rework the FetchInitConfigurationFromCluster node flags
The newControlPlane flag has been historically problematic, since
it implies that the function FetchInitConfigurationFromCluster
cannot handle the cases where a node is worker node but
we still want to fetch its NodeRegistrationOptions conditionally,
in cases such as "upgrade node" for workers.

To fix this issue, replace the flag newControlPlaneNode with
two new flags getNodeRegistration and getAPIEndpoint.

If getNodeRegistration is true, we fetch the NRO, and if
getAPIEndpoint is true, we fetch the API endpoint for
that node.

Additionally, rename skipComponentConfigs to getComponentConfigs
for consistency and flip its value accordingly everywhere.
2025-09-29 19:58:56 +02:00
Lubomir I. Ivanov
bd075eb98c kubeadm: use JoinHostPort in WaitControlPlaneClient
Using naive string concat with ":" does not work for IPv6.
Apply the fix to WaitForKubelet as well.
2025-09-25 19:11:10 +02:00
hoteye
1e4e6e10c1 Use context.Background() directly in kubeadm polling API calls
Replace context.TODO() and poll timeout context propagation with direct
context.Background() calls to prevent timeout errors from masking actual
API errors. Affects discovery/file.go, phases/upgrade/health.go, and
util/apiclient/wait.go for consistent error reporting.
2025-09-22 21:37:27 +08:00
HirazawaUi
12db1e28dc remove unused file 2025-09-21 00:35:54 +08:00
HirazawaUi
8118636321 Close container runtime connections after use 2025-09-06 14:42:36 +08:00
Kubernetes Prow Robot
4f0ce131a3 Merge pull request #133513 from tom1299/fix_missing_controlplanehealthcheck
Add missing conversion for timeoutForControlPlane
2025-08-27 18:30:31 -07:00
tom1299
b46a5cceef Fix missing control plane health check timeout 2025-08-19 13:49:02 +02:00
SataQiu
d959186056 kubeadm: simplify error handling in getAPIEndpointWithRetry 2025-08-01 11:52:55 +08:00
Lubomir I. Ivanov
38080c082e kubeadm: use named ports in static pod manifests
Start using a named port 'probe-port' for all probes in all the control
plane components static pod manifests - kube-apiserver,
kube-controller-manage, kube-scheduler, etcd.

Users who previously patched the probes with custom values must now
switch to patching the named port too.
2025-07-07 13:30:48 +02:00
Lubomir I. Ivanov
f644e35d19 kubeadm: cleanup after WaitForAllControlPlaneComponents GA 2025-06-28 11:21:54 +02:00
Kubernetes Prow Robot
c1ed20c4ff Merge pull request #131981 from HirazawaUi/promote-4654-to-beta
kubeadm: Graduate NodeLocalCRISocket Feature gate to beta
2025-06-13 04:45:02 -07:00
Jesung Yang
04110fce1b Correct error message to print ResetConfigurationKind
The previous message incorrectly used `JoinConfigurationKind`,
which is unrelated, as `documentMapToResetConfiguration` function
only processes ResetConfiguration.
2025-06-12 21:29:54 +09:00
Lubomir I. Ivanov
5be254650f kubeadm: start using util/errors
- Replace usage of pkg/errors with the local util/errors.
- Run kinder/hack/orderimports tool from kubeadm repo to
order the imports in the source tree.
2025-06-05 16:05:02 +03:00
Lubomir I. Ivanov
f522d7cb85 kubeadm: add a local implementation of wrapped errors
pkg/errors is archived and while there is go-errors/errors as
an alternative, it lacks wraping methods. kubeadm has
specific neends and it's better to implement something
minimal locally instead of introducing another depedency.

- Implement basic wrapped errors and stack trace support.
cmd/kubeadm/app/util/errors.
- Remove unused error codes >1. At some point it seems we broke
these and 1 was returned for all error types.
- Remove the Error type in preflight and separate the printing
of '[preflight]' message and the error return from preflight
checks.
- Print an 'error:' prefix for all errors.
2025-06-05 16:04:52 +03:00
HirazawaUi
ad3a13e014 Graduate NodeLocalCRISocket to beta 2025-06-03 19:28:20 +08:00
Lubomir I. Ivanov
c5f368522d kubeadm: fix dryrun-latest e2e by updating cluster-info fixture
Recently in PR 131741 the kubeadm fixture for cluster-info
in dryrun.go was updated to remove the 'preferences' struct.

This means that the hardcoded JWS signature of the cluster-info
fixture must also be updated.

Update the signature to the expected one to fix e2e
failures in dryrun-latest.

https://testgrid.k8s.io/sig-cluster-lifecycle-kubeadm#kubeadm-kinder-dryrun-latest
2025-05-21 12:09:40 +03:00
Kubernetes Prow Robot
707efc4e51 Merge pull request #131677 from lalitc375/master
[Kubeadm]: Add support for ECDSA-P384 encryption algorithm
2025-05-20 18:24:35 -07:00
Lalit Chauhan
637d234aae feat: Add support for ECDSA-P384 encryption algorithm
This commit introduces support for using ECDSA P-384 as an encryption
algorithm for generating certificates and keys within kubeadm.

The following changes are included:
- Defined the `EncryptionAlgorithmECDSAP384` constant in the kubeadm API types.
- Updated API documentation to reflect the new algorithm option ("ECDSA-P384").
- Added validation for `ECDSA-P384` in the cluster configuration.
- Implemented key generation logic for ECDSA P-384 keys in `pkiutil`
  (using `elliptic.P384()`).
- Added corresponding unit tests to verify the new algorithm's functionality
  in `pkiutil`.

This allows users to choose ECDSA P-384 for
kubeadm-managed clusters.
2025-05-20 17:08:56 +00:00
Maciej Szulik
8cf5e8db78 Deprecate kubeconfig's preference field in favor of kuberc
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2025-05-20 13:31:57 +02:00
Brendan Shephard
c0885e018a Fix --config option from suggested kubeadm command
This change fixes the --config option in the recommended kubeadm command
that is returned to users.

Fixes: https://github.com/kubernetes/kubeadm/issues/3201
Signed-off-by: Brendan Shephard <bshephar@bne-home.net>
2025-05-18 18:36:45 +10:00
Jordan Liggitt
079d4e52c2 Fix kubeadm etcd client interface 2025-05-15 21:19:18 -04:00
Jordan Liggitt
6bb6c99342 Drop null creationTimestamp from test fixtures 2025-05-02 15:38:40 -04:00
Kubernetes Prow Robot
0abee6bd55 Merge pull request #131488 from sivchari/apply-slices-package
kubeadm: use slices package to reduce the codes
2025-04-28 03:07:28 -07:00
sivchari
494b2b563f use testing.TempDir and delete helper function
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-04-27 01:21:39 +09:00
sivchari
efcceee903 reduce assignment
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-04-27 00:33:07 +09:00
sivchari
f42ee7a2d6 use slices package to reduce the codes
Signed-off-by: sivchari <shibuuuu5@gmail.com>
2025-04-26 23:08:02 +09:00
Kubernetes Prow Robot
c2d40b77aa Merge pull request #130782 from BernardMC/master
Kubeadm issue #3152 ControlPlane node setup failing with "etcdserver: can only promote a learner member"
2025-04-23 13:31:36 -07:00
Lubomir I. Ivanov
2037f39e20 kubeadm: use 'writer' everywhere in util/apiclient/wait.go 2025-03-24 21:45:11 +02:00
Lubomir I. Ivanov
310723b21c kubeadm: fix WaitForAllControlPlaneComponents with anonymous auth
When the kube-apiserver has --anonymous-auth=false,
the regular http.Client.Get() that WaitForAllControlPlaneComponents
does will not work.

Always use the discovery client when checking the health status
of the kube-apiserver.

Do a minor rework of struct fields and unit tests.

Replace nil client in cmd/phases/join/waitcontrolplane.go.
2025-03-24 20:58:59 +02:00
bconry
a68501da72 Add check to see if promote worked within the retry loop 2025-03-18 20:18:12 +00:00
Kubernetes Prow Robot
eacb9beec1 Merge pull request #130345 from HirazawaUi/kubeadm-yaml-json
kubeadm: Replace the yaml in the log/comments with a generic term.
2025-03-03 16:59:48 -08:00
HirazawaUi
9a843790a3 Adding tests for consistency 2025-03-03 21:10:02 +08:00
HirazawaUi
a94403e942 add BytesToXConfiguration function 2025-03-03 21:08:02 +08:00
HirazawaUi
77647cdfc3 rename SplitYAMLDocuments function 2025-03-03 18:37:52 +08:00
HirazawaUi
2d8d972cb8 Add warning logs for uninteresting kind 2025-03-03 18:35:50 +08:00
HirazawaUi
6a59c98a9e distinguish between YAML and JSON file formats during log output 2025-03-03 18:35:17 +08:00
Kubernetes Prow Robot
19feb379b3 Merge pull request #130289 from marosset/windows-unit-tests-cmd-kubeadm-app-util-static-pod-fixes
Fixing k8s.io/kubernetes/cmd/kubeadm/app/util/staticpod unit tests on Windows
2025-02-20 15:00:26 -08:00
Kubernetes Prow Robot
72333a838a Merge pull request #130287 from marosset/windows-unit-tests-cmd-kubeadm-app-util-dryrun-fixes
Fixing k8s.io/kubernetes/cmd/kubeadm/app/util/dryrun unit tests on Windows
2025-02-19 18:20:26 -08:00
Mark Rossetti
c186de0080 Fixing k8s.io/kubernetes/cmd/kubeadm/app/util/staticpod unit tests on Windows
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2025-02-19 12:51:19 -08:00
Mark Rossetti
697293906a Fixing k8s.io/kubernetes/cmd/kubeadm/app/util/dryrun unit tests on Windows
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2025-02-19 12:27:34 -08:00
SataQiu
9315ddbb65 kubeadm: fix panic when no UpgradeConfiguration was found in the config file 2025-02-18 22:49:40 +08:00
Kubernetes Prow Robot
e30c8a3dde Merge pull request #130040 from HirazawaUi/make-error-consistent
kubeadm: make kubeadm init and join output the same error
2025-02-11 07:47:58 -08:00