Commit Graph

4606 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
6fce566781 Merge pull request #128474 from neolit123/1.32-handle-custom-addreses-comp-readyz
kubeadm: use actual addresses/ports for WaitForAllControlPlaneComponents
2024-11-02 17:19:26 +00:00
Lubomir I. Ivanov
b2741f7b1c kubeadm: use actual addresses/ports for WaitForAllControlPlaneComponents
By default check the KCM and scheduler on 127.0.0.1:<port> as that is the
defaall --bind-address kubeamd uses for these components.

For kube-apiserver take the value from APIEndpoint.AdvertiseAddress which is
dynamically detected from the host. Unless the user has passed explicitly --advertise-address
as an extra arg.

Read the <port> values for all components from the --secure-port flag
value if needed. Otherwise use defaults.

Use /livez for apiserver and scheduler. Add TODO for KCM to
switch to /livez as well.
2024-11-02 18:09:36 +02:00
Lubomir I. Ivanov
fceb39ecd2 kubeadm: ensure proper parsing of SSR username
- Split the code that tries to get node name from SSR into
a new function getNodeNameFromSSR(). Unit test the function.
- Fix error that the "system:nodes:" prefix was not trimmed.
- Fix mislearding errors around FetchInitConfigurationFromCluster.
This function performs multiple actions, and the "get node"
action can also be of type apierrors.NotFound(). This creates
confusion in the returned error in enforceRequirement during
upgrade. Fix this problem.
2024-11-01 11:42:58 +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
Kubernetes Prow Robot
646b0bc49b Merge pull request #128354 from SataQiu/join-control-plane-e2e
kubeadm: support joining control plane nodes in dryrun mode without a real initialized control plane
2024-10-28 14:40:55 +00: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
bzsuni
80fe671cc9 Add UT for cmd/kubeadm/app/cmd/util/join.go
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-10-28 11:12:06 +08:00
Kubernetes Prow Robot
6568b4bdb3 Merge pull request #126953 from aroradaman/kubeadm-pre-flight-remove-conntrack
kubeadm: remove preflight check for existence of conntrack binary
2024-10-22 22:36:51 +01:00
Kubernetes Prow Robot
81ce66f059 Merge pull request #127420 from runzhliu/patch-3
improve the logging format
2024-10-21 21:14:58 +01:00
SataQiu
a0f8c51a75 kubeadm: using options.Force constant instead of 'force' string 2024-10-18 18:12:14 +08:00
runzhliu
e8602f224d improve the logging format 2024-10-17 05:57:50 +08:00
Antonio
250d00d8dc #128117 Fix misleading kubadm output
The control-plane should be referred to in plural otherwise it can be misleading to join the the cp to other nodes.
2024-10-16 11:32:18 +02: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
Cookiery
4ce7f8547d chore: cleanup code
chore: cleanup code

chore: cleanup code

chore: cleanup code
2024-10-04 20:43:01 +08:00
Kubernetes Prow Robot
0c713c7bd6 Merge pull request #127285 from bzsuni/bz/etcd/update/v3.5.16
Update etcd from v3.5.15 to v3.5.16
2024-09-28 15:16:02 +01:00
SataQiu
2dc0d2962a kubeadm: fix a bug where the RemoveMember function did not return the correct member list when the member to be removed did not exist 2024-09-26 14:29:30 +08:00
Kubernetes Prow Robot
4c4edfede5 Merge pull request #127398 from my-git9/patch-23
kubeadm: update comment for ArgumentsFromCommand function in app/util/arguments
2024-09-25 11:40:00 +01:00
xin.li
706e939382 kubeadm: update comment for ArgumentsFromCommand function in app/util/arguments
Signed-off-by: xin.li <xin.li@daocloud.io>
2024-09-25 16:19:28 +08:00
Kubernetes Prow Robot
99ff62e87a Merge pull request #127491 from SataQiu/fix-etcd-20240920
kubeadm: check whether the peer URL for the added etcd member already exists when the MemberAddAsLearner/MemberAdd fails
2024-09-25 05:08:07 +01:00
SataQiu
9af1b25bec kubeadm: check the member list status before adding or removing an etcd member 2024-09-24 22:53:42 +08: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
SataQiu
18318a32ce kubeadm: check whether the peer URL for the added etcd member already exists when the MemberAddAsLearner/MemberAdd fails 2024-09-20 11:52:47 +08:00
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
Lubomir I. Ivanov
914fd40712 kubeadm: add default paths to 'upgrade diff'
After the flags to control manifest paths were removed,
the variables in diff.go remained empty and the validation
fails with "empty manifest path".

Always populate the paths with the kubeadm defaults under
/etc/kubernetes/manifest and remove the empty path validation.
2024-09-12 11:59:53 +03:00
Kubernetes Prow Robot
d62b797c16 Merge pull request #127123 from neolit123/1.32-remove-deprecated-upgrade-flags
kubeadm: remove deprecated upgrade flags for 1.32
2024-09-11 19:03:20 +01:00
SataQiu
036e072e41 kubeadm: skip addons phase on worker node 2024-09-11 14:28:09 +08:00
bzsuni
5b6ef4302e Update etcd from v3.5.15 to v3.5.16
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-09-11 10:51:34 +08: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
Kubernetes Prow Robot
d913914511 Merge pull request #127096 from neolit123/1.32-fix-unknown-phase-error
kubeadm: better error handling for unknown phases and commands
2024-09-10 11:00:48 +01:00
SataQiu
8420b096c9 kubeadm: refactor upgrade to reduce duplication code 2024-09-10 14:43:36 +08:00
SataQiu
8db2dd3c8b kubeadm: add addon and post-upgrade phase for 'kubeadm upgrade node' 2024-09-09 19:04:23 +08:00
Kubernetes Prow Robot
d088d4c387 Merge pull request #126032 from SataQiu/imp-apply-phase-20240711
kubeadm: implement 'kubeadm upgrade apply phase'
2024-09-06 11:00:08 +01:00
Lubomir I. Ivanov
b497d28d43 kubeadm: better error handling for unknown phases and commands
If an unknown command or a phase is called consistently
return the same error.

If a command that has subcommands is called
return an error.

To achieve the above add a new util function
RequireSubcommand() that sets NoArgs and RunE for
regular commands or a "phase" command.

Remove MacroCommandLongDescription and just return an
error that a subcommand is required from the phase runner.

Fix minor comments capitalization.

Perform other minor fixes in util/error.go.
2024-09-05 19:41:43 +03:00
Lubomir I. Ivanov
730fd13726 kubeadm: remove deprecated upgrade flags for 1.32
The flags for control-plane component manifest under 'upgrade diff'
and the --feture-gates flag were deprecated and NOOP in 1.31
and can be removed in 1.32.
2024-09-05 17:13:06 +03:00
SataQiu
da234c9b23 kubeadm: improve some grammar issues 2024-09-05 22:12:05 +08:00
SataQiu
ea61d04db1 kubeadm: improve some grammar issues and add post-upgrade phase 2024-09-05 22:04:36 +08:00
SataQiu
a2f8d31c65 kubeadm: improve some grammar issues and add some unit test cases 2024-09-05 22:04:36 +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
Sascha Grunert
5f9a6d3e57 Remove socat and ebtables from kubeadm preflight checks
Follow-up on https://github.com/kubernetes/release/pull/3722

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-09-05 15:14:49 +02:00
Daman Arora
039c72e87d kubeadm: remove preflight check for existence of conntrack binary
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-09-05 14:15:47 +05:30
Kubernetes Prow Robot
09115bd093 Merge pull request #127115 from chenk008/fix_upload-config_example
Correct kubeadm init phase upload-config kubeadm example
2024-09-04 11:39:08 +01:00
chenk008
ea2b03fff3 Fix: kubeadm init phase upload-config kubeadm example 2024-09-04 17:27:59 +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