Commit Graph

1521 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
983dd07760 Merge pull request #128031 from HirazawaUi/kep-4656
[Kubeadm] KEP-4656: Add kubelet instance configuration to configure CRI socket for each node
2024-11-06 20:09:37 +00:00
HirazawaUi
c47eaa88b1 Implement kubeadm upgrade 2024-11-06 21:43:05 +08:00
Kubernetes Prow Robot
3dcad5f0db Merge pull request #128532 from neolit123/1.32-handle-custom-addreses-comp-readyz
kubeadm: use advertise address for WaitForAllControlPlaneComponents
2024-11-06 08:51:29 +00:00
HirazawaUi
16e767d915 Implement kubeadm init 2024-11-05 20:59:53 +08:00
Lubomir I. Ivanov
0cfcaa82e1 kubeadm: use advertise address for WaitForAllControlPlaneComponents 2024-11-05 09:00:38 +02:00
Lubomir I. Ivanov
07918a59e8 kubeadm: support dryrunning upgrade wihout a real cluster
Make the following changes:
- When dryrunning if the given kubeconfig does not exist
create a DryRun object without a real client. This means only
a fake client will be used for all actions.
- Skip the preflight check if manifests exist during dryrun.
Print "would ..." instead.
- Add new reactors that handle objects during upgrade.
- Add unit tests for new reactors.
- Print message on "upgrade node" that this is not a CP node
if the apiserver manifest is missing.
- Add a new function GetNodeName() that uses 3 different methods
for fetching the node name. Solves a long standing issue where
we only used the cert in kubelet.conf for determining node name.
- Various other minor fixes.
2024-10-31 14:58:47 +02:00
Kubernetes Prow Robot
db66e397d9 Merge pull request #128359 from matteriben/disable-caching-for-authoritative-zone
disable caching for authoritative zone to comply with rfc-1035 section 6.1.2
2024-10-30 02:37:24 +00:00
Matt Riben
30d9ed7203 disable caching for authoritative zone
Signed-off-by: Matt Riben <matt.riben@swirldslabs.com>
2024-10-29 17:10:07 -05:00
SataQiu
dc48aed791 kubeadm: support joining control plane nodes in dryrun mode without a real initialized control plane 2024-10-28 21:37:58 +08:00
Kubernetes Prow Robot
769695a218 Merge pull request #126776 from neolit123/1.31-improve-dry-run-logic
kubeadm: refactor the dry-run logic
2024-10-14 10:20:21 +01:00
Lubomir I. Ivanov
30f9893374 kubeadm: refactor the dry-run logic
The current dryrun client implemnetation is suboptimal
and sparse. It has the following problems:

- When an object CREATE or UPDATE reaches the default dryrun client
the operation is a NO-OP, which means subsequent GET calls must
fully emulate the object that exists in the store.
- There are multiple implmentations of a DryRunGetter interface
such the one in init_dryrun.go but there are no implementations
for reset, upgrade, join.
- There is a specific DryRunGetter that is backed by a real
client in clientbacked_dryrun.go, but this is used for upgrade
and does not work in conjuction with a fake client.

This commit does the following changes:

- Removes all existing *dryrun*.go implementations.
- Add a new DryRun implementation in dryrun.go that implements
3 clients - fake clientset, real clientset, real dynamic client.
- The DryRun object uses the method chaining pattern.
- Allows the user opt-in into real clients only if needed, by passing
a real kubeconfig. By default only constructs a fake client.
- The default reactor chain for the fake client, always logs the
object action, then for GET or LIST actions attempts to use the
real dynamic client to get the object. If a real object does not
exist it attempts to get the object from the fake object store.
- The user can prepend or append reactors to the chain.
- All known needed reactors for operations during init, join,
reset, upgrade are added as methods of the DryRun struct.
- Adds detailed unit test for the DryRun struct and its methods
including reactors.

Additional changes:
- Use the new DryRun implementation in all command workflows -
init, join, reset, upgrade.
- Ensure that --dry-run works even if there is no active cluster
by returning faked objects. For join, a faked cluster-info
with a fake bootstrap token and CA are used.
2024-10-11 00:15:59 +03:00
aokumasan
0b62989086 Fix incorrect test case name 2024-10-05 18:45:01 +09:00
Kubernetes Prow Robot
f2700895a4 Merge pull request #127422 from srivastav-abhishek/go-vet-fix
Go vet fixes for gotip
2024-09-20 14:37:58 +01:00
Abhishek Kr Srivastav
95860cff1c Fix Go vet errors for master golang
Co-authored-by: Rajalakshmi-Girish <rajalakshmi.girish1@ibm.com>
Co-authored-by: Abhishek Kr Srivastav <Abhishek.kr.srivastav@ibm.com>
2024-09-20 12:36:38 +05:30
Yuya Yabe
db66416c45 Add activeDeadlineSeconds to kubeadm upgrade-health-check job
With https://github.com/kubernetes/kubernetes/pull/122079,
kubeadm now relies on `ttlSecondsAfterFinished` to clean
up `upgrade-health-check` once its pod reaches a terminal state.
However, there is a case where the pod won't reach a terminal state and
the job will not register a terminal state, hence no garbage collection.

For example, if the pause image is not present, `ErrImagePull` will make
the pod keep retrying to pull the image and the pod will never reach a
terminal state on its own. And the job will continue to wait for the pod
to reach a terminal state which will not happen.

So we need to set `activeDeadlineSeconds` to prevent the job from
waiting forever for the pod to reach a terminal state.

Without this, users invoking `kubeadm upgrade plan` need to cleanup the
job outside of kubeadm even if they ignore the preflight result because
the job still runs when the result is configured to be ignored via
`--ignore-prelight-errors=CreateJob` flag.

Since the timeout for the polling in the `CreateJob` step in kubeadm
is 15 seconds, we should set the `activeDeadlineSeconds` to the same
timeout.
2024-09-12 19:40:25 +00:00
Kubernetes Prow Robot
a8fb2cefbb Merge pull request #126610 from liyuerich/postupgrade
kubeadm: add UT for postupgrade
2024-09-10 15:16:13 +01:00
liyuerich
e4d8154f14 add UT for postupgrade
Signed-off-by: liyuerich <yue.li@daocloud.io>
2024-09-10 19:47:21 +08:00
SataQiu
8db2dd3c8b kubeadm: add addon and post-upgrade phase for 'kubeadm upgrade node' 2024-09-09 19:04:23 +08:00
SataQiu
da234c9b23 kubeadm: improve some grammar issues 2024-09-05 22:12:05 +08:00
SataQiu
595482d264 kubeadm: implement 'kubeadm upgrade apply phase'
Signed-off-by: SataQiu <shidaqiu2018@gmail.com>
2024-09-05 22:04:32 +08:00
Kubernetes Prow Robot
85384fe273 Merge pull request #126945 from liangyuanpeng/kubeadm_split_healthz_scheduler
kubeadm: scheduler using livez and readyz instead of healthz.
2024-09-03 14:05:15 +01:00
Lan Liang
db8f3a4b7c kubeadm: scheduler using livez and readyz instead of healthz.
Signed-off-by: Lan Liang <gcslyp@gmail.com>
2024-09-03 06:44:07 +00:00
Nathan Baulch
ad7cb45bb2 Fix kubeadm typos 2024-09-03 13:07:55 +10:00
Lubomir I. Ivanov
ffbc494a4a kubeadm: add unit test for GetProxyEnvVars 2024-08-20 09:11:53 +03:00
Benjamin Elder
8b69990643 kubeadm: bump coredns to 1.11.3 2024-07-29 13:43:04 -07:00
Lubomir I. Ivanov
b90b280c5a kubeadm: fix join bug where kubeletconfig was not patched in memory
During kubeadm join in 1.30 kubeadm started respecting
the kubeletconfiguration healthz address/port. Previously
it hardcoded the health check to localhost:defaultport.

A corner case was not handled where the user applies --patches
on join to modify the local kubeletconfiguration. This results
in kubeletconfiguration patch target patches not being applied to
the KubeletConfiguration in memory and the health check
running on the address:port which are present in the kubelet-config
configmap.

Fix that by explicitly calling a new function to patch the
KubeletConfiguration in memory. This is scoped to only handle
the healthz checks *after* the kubelet config.yaml was already
patched and written to disk.
2024-07-20 19:31:19 +03:00
Kubernetes Prow Robot
33ccc51cb7 Merge pull request #125780 from chrischdi/pr-kubeadm-control-plane-kubelet-local-init
kubeadm: consider feature gate ControlPlaneKubeletLocalMode on init and upgrade
2024-07-12 12:50:16 -07:00
Alex Stundzia
58ff17bbfa When using external CA, look for common trust anchor within CA bundle. 2024-06-28 18:04:31 -05:00
Christian Schlotter
8871513c1b review fixes 2024-06-28 17:15:51 +02:00
Christian Schlotter
e51b55b451 kubeadm: feature gate ControlPlaneKubeletLocalMode on upgrade 2024-06-28 13:31:26 +02:00
xin.li
71d3f9e249 Remove unused function in phases/certs
Signed-off-by: xin.li <xin.li@daocloud.io>
2024-06-22 18:47:28 +08:00
Lubomir I. Ivanov
8a5f849c66 kubeadm: keep v1beta3 only in required code paths
Use v1beta4 everywhere and only use v1beta3
in a few required locations:
- kubeadm-config map handling
- unit and integration tests
2024-06-17 10:07:32 +03:00
Lubomir I. Ivanov
02ed1aee71 kubeadm: fix the generation of ECDSA keys in kubeconfig files
When the PublicKeysECDSA feature gate is used or the new
v1beta4.ClusterConfiguration.EncryptionAlgorithm field is used
with "ECDSA-P256" as value, make sure that this is reflected
in the "cert spec" used to generate private keys and they end
up as "EC keys".
2024-06-07 20:04:18 +03:00
Lubomir I. Ivanov
52302e4ad5 kubeadm: use the actual configured kubelet healthz address:port
When doing a kubelet health check on init/join, do not
hardcode the "localhost" address. Instead, use the
KubeletConfiguration HealthzBindAddress and HealthzPort
fields.
2024-06-01 10:10:31 +03:00
Kubernetes Prow Robot
8565e37525 Merge pull request #125127 from my-git9/ut-compute
kubeadm: increase ut coverage for compute
2024-05-31 02:41:37 -07:00
xin.li
d24d82eda9 kubeadm: increase ut coverage for compute
Signed-off-by: xin.li <xin.li@daocloud.io>
2024-05-31 16:39:51 +08:00
Kubernetes Prow Robot
b503409e9c Merge pull request #124363 from claudiubelu/unittests-11
unittests: Fixes unit tests for Windows (part 11)
2024-05-30 08:17:24 -07:00
Kubernetes Prow Robot
529896474f Merge pull request #124688 from neolit123/1.31-always-rotate-etcd-certs-on-upgrade
kubeadm: ensure that etcd certs are rotated on apiserver upgrade
2024-05-29 05:10:30 -07:00
Lubomir I. Ivanov
f4d5e1d65d kubeadm: ensure that etcd certs are rotated on apiserver upgrade
Currently if etcd.yaml does not have a diff on "kubeadm upgrade"
certificate renewal for it is also skipped.

Check if kube-apiserver.yaml needs an upgrade, if so and if
cert renewal is not disabled, renew etcd's certs and restart
its static pod.
2024-05-29 13:07:41 +03:00
Lubomir I. Ivanov
5e290ebc90 switch k/k to pause version 3.10 2024-05-24 10:02:51 +03:00
Kubernetes Prow Robot
44c45484e0 Merge pull request #124465 from neolit123/1.31-add-etcd-livez-readyz
kubeadm: use etcd 3.5.11's /livez and /readyz endpoints for probes
2024-05-21 04:40:23 -07:00
Claudiu Belu
e90cfb83ed unittests: Fixes unit tests for Windows (part 11)
Currently, there are some unit tests that are failing on
Windows due to various reasons:

- Cannot remove a directory if there's a file open in that directory.
- Paths may have / or \ on Windows.
2024-05-16 12:36:49 +00:00
SataQiu
1329935739 kubeadm: add support for patching a corednsdeployment target 2024-05-11 18:21:20 +08:00
Kubernetes Prow Robot
eeb42fa543 Merge pull request #124678 from my-git9/dns-test-54
kubeadm: increase ut coverage for addon/dns
2024-05-08 21:46:39 -07:00
Kubernetes Prow Robot
78bc18dcb0 Merge pull request #124715 from SataQiu/fix-kubeadm-20240507
kubeadm: remove deprecated UpgradeAddonsBeforeControlPlane featuregate
2024-05-07 13:29:24 -07:00
Kubernetes Prow Robot
72786649b6 Merge pull request #124652 from neolit123/1.31-add-cert-expiration-v1beta4
kubeadm: add support for custom cert validity period in v1beta4
2024-05-07 10:38:51 -07:00
SataQiu
6f94700886 kubeadm: remove deprecated UpgradeAddonsBeforeControlPlane featuregate 2024-05-07 09:24:10 +08:00
xin.li
d1dff562ad kubeam: increase ut coverage for addon/dns
Signed-off-by: xin.li <xin.li@daocloud.io>
2024-05-03 21:21:06 +08:00
SataQiu
1c82e03c2a kubeadm: remove unused CreateKubeConfigFileFunc type 2024-05-03 16:19:51 +08:00
Lubomir I. Ivanov
74e1438d86 kubeadm: add support for custom cert validity period in v1beta4
Allow the user to pass custom cert validity period with
ClusterConfiguration.CertificateValidityPeriod and
CACertificateValidityPeriod.

The defaults remain 1 year for regular cert and 10 years for CA.
Show warnings if the provided values are more than the defaults.

Additional changes:
- In "certs show-expiration" use HumanDuration() to print
more detailed durations instead of ShortHumanDuration().
- Add a new kubeadm util GetStartTime() which can be used
to consistently get a UTC time for tasks like writing certs
and unit tests.
- Update unit tests to validate the new customizable NotAfter.
2024-05-01 19:01:49 +03:00