Commit Graph

11243 Commits

Author SHA1 Message Date
Patrick Ohly
66dfac3b18 kube-proxy: support the logging feature gates
When trying to bring up a cluster via kubeadm with these feature gates enabled,
kube-proxy fails because it didn't know about them:

    kind: Cluster
    apiVersion: kind.x-k8s.io/v1alpha4
    nodes:
    - role: control-plane
    - role: worker
    - role: worker
    featureGates: {"DynamicResourceAllocation":true,"ContextualLogging":true}
    runtimeConfig: {"resource.k8s.io/v1alpha1":"true"}

    =>

    2023-01-20T07:07:54.474966617Z stderr F E0120 07:07:54.474846       1 run.go:74] "command failed" err="failed complete: unrecognized feature gate: ContextualLogging"

The effect of the logging feature gates is minor for kube-proxy, supporting
them is mostly useful for the sake of consistency and to support kubeadm.
2023-01-20 19:31:57 +01:00
Clayton Coleman
95051a63b3
wait: Use a context implementation for ContextForChannel
ContextForChannel uses a goroutine to transform a channel close to
a context cancel. However, this exposes a synchronization issue if
we want to unify the underlying implementation between contextless
and with context - a ConditionFunc that closes the channel today
expects the behavior that no subsequent conditions will be invoked
(we have a test in wait_test.go TestUntilReturnsImmediately that
verifies this expectation). We can't unify the implementation
without ensuring this property holds.

To do that this commit changes from the goroutine propagation to
implementing context.Context and using stopCh as the Done(). We
then implement Err() by returning context.Canceled and stub the
other methods. Since our context cannot be explicitly cancelled
by users, we cease to return the cancelFn and callers that need
that behavior must wrap the context as normal.

This should be invisible to clients - they would already observe
the same behavior from the context, and the existing error
behavior of Poll* is preserved (which ignores ctx.Err()).

As a side effect, one less goroutine is created making it more
efficient.
2023-01-18 10:00:47 -05:00
Kubernetes Prow Robot
fd885b751d
Merge pull request #115068 from neolit123/revert-115000-feature/UpdateOrCreateTokenAddErrProcessing
Revert "UpdateOrCreateToken get secrets err handling optimization"
2023-01-15 07:30:31 -08:00
Kubernetes Prow Robot
3a8e2e399b
Merge pull request #114393 from danielvegamyhre/myfeature
Option to ignore existing pods' preferred inter-pod affinities if the incoming pod has no preferred inter-pod affinities
2023-01-13 17:28:15 -08:00
Daniel Vega-Myhre
41817b1888 optionally ignore preferred terms of existing pods unless incoming pod
has inter-pod affinities
2023-01-13 23:15:53 +00:00
Lubomir I. Ivanov
7938631e22
Revert "UpdateOrCreateToken get secrets err handling optimization" 2023-01-14 00:11:49 +02:00
Kubernetes Prow Robot
a66aad2d80
Merge pull request #115000 from helen-frank/feature/UpdateOrCreateTokenAddErrProcessing
UpdateOrCreateToken get secrets err handling optimization
2023-01-12 19:57:12 -08:00
Kubernetes Prow Robot
2b69bec35d
Merge pull request #114901 from SataQiu/fix-lint-error-20230108
Fix gocritic lint errors for cmd/kubeadm/*
2023-01-12 09:05:06 -08:00
helen
e6591d24ce when UpdateOrCreateTokens get secrets, if the error is not a NotFound, the error is thrown in time
Signed-off-by: helen <haitao.zhang@daocloud.io>
2023-01-12 20:50:02 +08:00
SataQiu
3df577ea28 kubeadm: remove unused variable DefaultAuditPolicyLogMaxAge 2023-01-12 12:30:30 +08:00
Kubernetes Prow Robot
280473ebc4
Merge pull request #114773 from yangjunmyfm192085/fixsmallerrorlog
fix a small log error about proxy
2023-01-11 07:51:43 -08:00
Kubernetes Prow Robot
6699db9f59
Merge pull request #114957 from claudiubelu/kubeadm-preflight-checks-admin
unit tests: Fixes kubeadm enforce requirements test
2023-01-11 03:33:43 -08:00
Claudiu Belu
3af2c257e8 unit tests: Fixes kubeadm enforce requirements test
enforceRequirements will run preflight checks, including whether the user
is privileged is not. Because of this, the test will make different assertions
based on the user's UID. However, we don't have UIDs on Windows, so we're asserting
the wrong thing.

This fix addresses the issue.
2023-01-10 16:56:14 +00:00
Jordan Liggitt
3b64cb5f11
Include head and tail of clipped test messages 2023-01-10 11:26:34 -05:00
SataQiu
e0f11d9c5b kubeadm: fix gocritic lint errors 2023-01-08 11:23:26 +08:00
SataQiu
5d99ad1182 kubeadm: update .import-restrictions 2023-01-07 23:46:02 +08:00
Ian K. Coolidge
f3829c4be3 cpuset: Rename 'NewCPUSet' to 'New' 2023-01-06 23:32:51 +00:00
TommyStarK
527b905aaa cmd/kubeapiserver: Clean code, avoid unnecessary condition, avoid non-nil but zero-length slice
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-01-06 18:03:41 +01:00
Kubernetes Prow Robot
4a98fa2536
Merge pull request #114540 from pacoxu/kubeadm-v1beta2
remove deprecated Kubeadm v1beta2 API
2023-01-05 21:29:58 -08:00
Kubernetes Prow Robot
fcaa32bd99
Merge pull request #114725 from danwinship/kube-proxy-startup-cleanup
(minor) kube-proxy startup cleanup
2023-01-05 13:57:59 -08:00
Kubernetes Prow Robot
2d534e4bea
Merge pull request #114842 from chendave/nil_pointer
kubeadm: fix the nil pointer dereference in testcase
2023-01-05 05:32:22 -08:00
Paco Xu
cca7a205ad remove kubeadm v1beta2 support 2023-01-05 21:30:26 +08:00
Dave Chen
23f75bf40e kubeadm: fix the nil pointer dereference in testcase
`genCSRConfig.kubeadmConfig` is possible to be nil if there any error
from the config loading, so access the field should only be done if
there is no error in the previous step.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2023-01-05 16:21:15 +08:00
Dave Chen
49732716de kubeadm: unittest might run as non-root
Signed-off-by: Dave Chen <dave.chen@arm.com>
2023-01-05 12:13:19 +08:00
Paco Xu
b3056ea9bd remove the deprecated kubeadm v1beta2 API 2023-01-04 12:19:15 +08:00
Kubernetes Prow Robot
b532f2b3e7
Merge pull request #112136 from pacoxu/migrate-runtime-endpoint-flags
kubelet: migrate container runtime endpoint flag to config
2023-01-03 09:29:31 -08:00
Dan Winship
169604d906 Validate single-stack --nodeport-addresses sooner
In the dual-stack case, iptables.NewDualStackProxier and
ipvs.NewDualStackProxier filtered the nodeport addresses values by IP
family before creating the single-stack proxiers. But in the
single-stack case, the kube-proxy startup code just passed the value
to the single-stack proxiers without validation, so they had to
re-check it themselves. Fix that.
2023-01-03 09:01:45 -05:00
Dan Winship
e7ed7220eb Explicitly pass IP family to proxier
Rather than re-determining it from the iptables object in both proxies.
2023-01-03 09:01:45 -05:00
Dan Winship
fb84c4f0f0 Fix kube-proxy dual-stack-iptables-binary-presence check
Kube-proxy was checking that iptables supports both IPv4 and IPv6 and
falling back to single-stack if not. But it always fell back to the
primary IP family, regardless of which family iptables supported...
Fix it so that if the primary IP family isn't supported then it bails
out entirely.
2023-01-03 09:01:35 -05:00
JunYang
281a2bdd2f fix a small log error about proxy 2023-01-03 20:07:20 +08:00
Kubernetes Prow Robot
1edbb8cf1a
Merge pull request #114719 from chendave/cleanup_copy
kubeadm: return the output from stdout and stderr
2023-01-02 19:49:31 -08:00
Dave Chen
fd60b9c492 kubeadm: return the output from stdout and stderr
It was just saying the copy of file failed with `exit status 1`,
no much details for what's going wrong.

Combine the stderr and stdout and show those info will be easier
for us to fix the problem.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2023-01-03 10:45:12 +08:00
JunYang
cc4126a010 use klog.InfoS instead of klog.V(0).Info-proxy part 2022-12-29 11:16:51 +08:00
Kubernetes Prow Robot
68b96575a2
Merge pull request #114669 from Nordix/ipvs-remove-module-check
Ipvs: remove module check
2022-12-26 10:09:27 -08:00
Kubernetes Prow Robot
8a71485643
Merge pull request #114658 from neolit123/1.27-fix-dry-run-server-version
kubeadm: return stored FakedServerVersion when dry-running
2022-12-22 19:05:26 -08:00
Lars Ekman
cd15ca0548 proxy/ipvs: Check that a dummy virtual server can be added
This tests both ipvs and the configured scheduler
2022-12-22 20:36:53 +01:00
Lubomir I. Ivanov
f8da9ab287 kubeadm: return stored FakedServerVersion when dry-running
If we are dry-running, do not attempt to fetch the /version
resource and just return the stored FakeServerVersion,
which is done when constructing the dry-run client in
upgrade/common.go#getClient().

The problem here is that during upgrade
dry-run client reactors are backed by a dynamic client
via NewClientBackedDryRunGetterFromKubeconfig() and
for GetActions there seems to be no analog to
Discovery().Serverversion() resource for a dynamic client(?).
2022-12-22 19:53:35 +02:00
Kubernetes Prow Robot
30e0e8edb9
Merge pull request #114597 from songxiao-wang87/runwxs-test10
Add test for cmd/kubeadm/app/images/images.go
2022-12-22 00:13:25 -08:00
Kubernetes Prow Robot
6e65c98681
Merge pull request #114596 from andrewsykim/cloud-node-ipam
Don't run cloud IPAM controller when cloud provider is not enabled
2022-12-21 16:33:25 -08:00
Kubernetes Prow Robot
a6d66d15f6
Merge pull request #114632 from neolit123/1.27-fix-dry-run-server-version
kubeadm: handle dry run GET actions from fake discovery
2022-12-21 04:11:26 -08:00
Lubomir I. Ivanov
54b73deaca kubeadm: handle dry run GET actions from fake discovery
The kubeadm dry run client reactor code is flawed as it assumes
all invoked "get" verb actions can be casted to GetAction.
Apparently that is not the case when Discovery().ServerVersion()
and other discovery calls are made. In such cases the action
type is the bare ActionImpl.

Catch if an action can be casted to ActionImpl and construct a
GetAction from it. GetActionImpl only suppersets ActionImpl with
a Name field (empty string in this case).

Add unit test for Discovery().ServerVersion().
2022-12-21 11:49:59 +02:00
songxiao-wang87
e09c1327b0 Making a run test.
Signed-off-by: songxiao-wang87 <wang.xiaosong23@zte.com.cn>
2022-12-21 07:00:35 +00:00
Andrew Sy Kim
0a4f582c8b cloud-controller-manager: don't run cloud IPAM controller when cloud provider is not enabled
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
2022-12-20 10:29:02 -05:00
Andrew Sy Kim
99d83fac37 kube-controller-manager: don't run cloud IPAM controller when cloud provider is not enabled
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
2022-12-20 10:29:02 -05:00
Lubomir I. Ivanov
b0f38b223e kubeadm: revert feature to backup kubelet config for "upgrade node"
There seems to be a bug where it's not possible to write to
/etc/kubernetes/tmp... at the time of backing up the old kubelet
config.yaml

Also this kubelet config backup only targets "upgrade node"
and it should also target "upgrade apply".

Revert the related changes until a fully working feature
is implemented.
2022-12-20 16:28:28 +02:00
Kubernetes Prow Robot
03bfbdd8aa
Merge pull request #114455 from SataQiu/fix-kubeadm-2022121302
kubeadm: fix the bug that kubeadm always do CRI detection even if it is not required by phase subcommand
2022-12-19 00:51:44 -08:00
Jordan Liggitt
78cb3862f1
Fix indentation/spacing in comments to render correctly in godoc 2022-12-17 23:27:38 -05:00
Kubernetes Prow Robot
fdafd50085
Merge pull request #113318 from pacoxu/learner-mode
kubeadm: enable etcd's learner mode when joining etcd members
2022-12-16 21:55:41 -08:00
Paco Xu
37f5da904b kubeadm: remove nested loops for member promotion 2022-12-17 12:40:15 +08:00
Shihang Zhang
4fd09a06d6 lock LegacyServiceAccountTokenNoAutoGeneration 2022-12-16 10:45:35 -08:00