Commit Graph

4071 Commits

Author SHA1 Message Date
Octopusjust
db0bfd8727
Update version_test.go
run ./hack/verify-gofmt.sh
2022-07-18 14:15:06 +08:00
ZhangYu
ba80421254 Add testcases for cmd/kubeadm/app/util/net.go and version.go 2022-07-16 09:23:48 +08:00
Paco Xu
5c0c20a5ea
kubeadm: UnversionedKubeletConfigMap is GAed in v1.25 2022-07-14 20:56:45 +08:00
Abirdcfly
00b9ead02c cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-14 11:25:19 +08:00
SataQiu
723cadf750 kubeadm: respect user specified image repository when using Kubernetes ci version 2022-07-09 16:24:51 +08:00
Kubernetes Prow Robot
34b9f0dbed
Merge pull request #110998 from chendave/de_dup_kubeadm
kubeadm: De-dup the confirmation on the interactive cmds
2022-07-07 12:46:37 -07:00
Dave Chen
8aeee521e6 kubeadm: De-dup the confirmation on the interactive cmds
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-07 11:51:26 +08:00
Mengjiao Liu
88c6deb778 Update godoc.org to pkg.go.dev in kubeadm 2022-07-07 11:06:13 +08:00
Kubernetes Prow Robot
f88b11897d
Merge pull request #110978 from chendave/dry_run_interactive
kubeadm: Don't ask for input if it's dry run mode
2022-07-06 18:39:33 -07:00
Dave Chen
988b96fcbb kubeadm: Don't ask for input if it's dry run mode
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-07-06 18:18:53 +08:00
runzhliu
37f66cb9d8 improve the comments 2022-07-05 01:59:11 +00:00
Kubernetes Prow Robot
fa16bf8e12
Merge pull request #110791 from SataQiu/fix-kubeadm-20220626
kubeadm: fix the bug that configurable KubernetesVersion not respected during kubeadm join
2022-06-30 21:53:34 -07:00
Kubernetes Prow Robot
8b0221708c
Merge pull request #110744 from neolit123/1.25-update-etcd-startup-probe
kubeadm: use non-serializable startup probe for etcd pods
2022-06-30 21:53:22 -07:00
Kubernetes Prow Robot
3eb7b7a48f
Merge pull request #110874 from chendave/fix_debug
kubeadm: Force to disable debug mode for `crictl`
2022-06-30 10:42:20 -07:00
Lubomir I. Ivanov
2829fc03e3 kubeadm: use non-serializable startup probe for etcd pods
As per the etcd maintainers' recommendation - startup probes
shouldn't be serialized, while the liveness probes should be.
2022-06-30 20:26:32 +03:00
SataQiu
2fb1941ae3 kubeadm: improve the error message of getClusterNodeMask func 2022-06-30 20:28:45 +08:00
Dave Chen
c5b22b535b kubeadm: Force to disable debug mode for crictl
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-06-30 15:08:45 +08:00
SataQiu
5b2d6ca5df kubeadm: fix the bug that configurable KubernetesVersion not respected during kubeadm join 2022-06-30 14:47:33 +08:00
Kubernetes Prow Robot
dafa55be10
Merge pull request #110837 from SataQiu/fix-kubeadm-20220628
kubeadm: support retry mechanism for removing container in reset phase
2022-06-29 05:12:05 -07:00
SataQiu
3889a6cac8 kubeadm: support retry mechanism for removing container in reset phase 2022-06-29 17:54:56 +08:00
Kubernetes Prow Robot
4cd7394252
Merge pull request #110819 from pacoxu/kubeadm-join-doc
kubeadm: update join --discovery-file docs
2022-06-28 19:58:03 -07:00
Paco Xu
0b44750ab9 kubeadm: update join --discovery-file docs(support tokenfile authProvider and exec) 2022-06-28 12:12:29 +08:00
Kubernetes Prow Robot
34b4125351
Merge pull request #110656 from pacoxu/kubeadm-dup-unix
kubeadm: handle dup unix:// prefix in node annotation
2022-06-24 00:21:21 -07:00
Paco Xu
8555f401a0 kubeadm: handle dup unix:// prefix in node annotaiton 2022-06-24 11:16:34 +08:00
Kubernetes Prow Robot
07dfdf0859
Merge pull request #110709 from chendave/fix_renew
kubeadm: Honor `cert-dir` for cert operations
2022-06-23 19:51:19 -07:00
Kubernetes Prow Robot
035f22d781
Merge pull request #110712 from chendave/ignore_args
kubeadm: certs renew doesn't support positional args
2022-06-23 09:09:43 -07:00
Dave Chen
e8e804deaa kubeadm: certs renew doesn't support positional args
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-06-23 19:52:22 +08:00
Kubernetes Prow Robot
df0af6f7b8
Merge pull request #110736 from Octopusjust/k8s-pr3
Incomplete coverage of test scenarios
2022-06-23 04:33:44 -07:00
Dave Chen
57646c941f kubeadm: Honor cert-dir for cert operations
- `cert-dir` could be specified to a value other than the default value
- we have tests that should be executed successfully on the working cluster

Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-06-23 19:32:20 +08:00
ZhangYu
9f4562c7b6 Incomplete coverage of test scenarios 2022-06-23 11:41:23 +08:00
Kubernetes Prow Robot
e9702cfc1b
Merge pull request #110593 from SataQiu/kubeadm-coredns-20220615
kubeadm: add the preferred pod anti-affinity for CoreDNS Deployment
2022-06-22 09:29:56 -07:00
chymy
c8aa25e472 fix several typo
Signed-off-by: chymy <chang.min1@zte.com.cn>
2022-06-21 09:11:41 +00:00
Kubernetes Prow Robot
609db7ed0b
Merge pull request #110635 from chendave/kubeadm_fix
kubeadm: fail faster when the version is not provided
2022-06-19 10:06:03 -07:00
Dave Chen
aa5dfd8b28 kubeadm: fail faster when the version is not provided
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-06-17 16:42:56 +08:00
Lubomir I. Ivanov
81b3540206 kubeadm: ensure kubelet patch results are in YAML
Once we patch a kubelet configuration file, the patched output
is in JSON. Make sure it's converted back to YAML, given
the kubelet config in the cluster and on disk is always in YAML.

Add unit test for the new function applyKubeletConfigPatches()
2022-06-15 13:38:04 +03:00
SataQiu
299e745127 kubeadm: add the preferred pod anti-affinity for CoreDNS Deployment 2022-06-15 14:38:12 +08:00
tallaxes
4a542609aa
Support more auth strategies in kubeadm join with discovery file (#110553)
* Add support for client-go credential plugins

* Add support for authprovider authentication

* Add support for TokenFile authentication
2022-06-14 08:03:45 -07:00
Kubernetes Prow Robot
4407a02aef
Merge pull request #110560 from lunhuijie/fixTestpki
Incomplete coverage of test scenarios and optimize bad code
2022-06-14 04:53:32 -07:00
10284789刁浩
696d537239 Incomplete coverage of test scenarios and bad code 2022-06-14 07:48:43 +00:00
Paco Xu
178dc11b75 kubeadm: upgrade coredns to v1.9.3 2022-06-09 18:45:26 +08:00
Paco Xu
31922c7794 kubeadm: use staticpod known tags for upgrade/init phases 2022-06-09 14:21:48 +08:00
Kubernetes Prow Robot
0985c476e3
Merge pull request #109995 from wangyysde/fix_issue_2681
add print-manifest flag to print addon manifests to STDOUT
2022-06-08 09:00:22 -07:00
Paco Xu
29aca9692c overwrite known targets in patch manager cache in case it changes 2022-06-08 16:10:41 +08:00
wangyysde
e863ebb6b5 add print-manifest flag to print addon manifests to STDOUT
Signed-off-by: wangyysde <net_use@bzhy.com>
2022-06-08 13:45:37 +08:00
Kubernetes Prow Robot
cd4b8ed070
Merge pull request #110405 from neolit123/1.25-kubelet-config-patches
kubeadm: add support for patching a "kubeletconfiguration" target
2022-06-07 07:05:07 -07:00
Kubernetes Prow Robot
9fad5c981a
Merge pull request #110327 from neolit123/1.25-ga-unversioned-kubelet-config
kubeadm: graduate the UnversionedKubeletConfigMap FG to GA
2022-06-07 07:04:56 -07:00
Lubomir I. Ivanov
2134026e3b kubeadm: allow passing the --patches flag to init/join/node phases
Allow passing the --patches flag to init/join/node phases
relevant to the kubelet writing the config file on disk.
2022-06-06 20:37:27 +03:00
Lubomir I. Ivanov
428c3fe954 kubeadm: document "kubeletconfiguration" as a patch target
Document the "kubeletconfiguration" as a patch target in the
v1beta3 API Init/JoinConfiguration.Patches struct
and also for the --patches flag.
2022-06-06 20:37:26 +03:00
Lubomir I. Ivanov
c3c9fb8608 kubeadm: add unit tests for patching a "kubeletconfiguration" target 2022-06-06 20:37:26 +03:00
Lubomir I. Ivanov
85fb6b01f8 kubeadm: apply patches to the kubelet config before writing it to disk
In phases/kubelet/WriteConfigToDisk() create a patch
manager for the root patches directory and apply
the user patches with a target "kubeletconfiguration".
2022-06-06 20:37:26 +03:00
Lubomir I. Ivanov
665f66d2bc kubeadm: pass io.Writer and "patches dir" to WriteConfigToDisk()
With phases/kubelet/WriteConfigToDisk() about to support patches
it is required that the function accepts an io.Writer
where the PatchManager can output to and also a patch directory.

Modify all call sites of the function WriteConfigToDisk()
to properly prepare an pass an io.Writer and patches dir to it.
This results in command phases for init/join/upgrade to pass
the root io.Writer (usually stdout) and the patchesDir populated
either via the config file or --patches flag.
2022-06-06 20:37:26 +03:00
Kubernetes Prow Robot
b7b824bb9e
Merge pull request #110033 from mk46/etcd_update_v3.5.4
etcd: Updated to v3.5.4
2022-06-02 13:26:31 -07:00
Lubomir I. Ivanov
1c46686f09 kubeadm: mutate ClusterConfiguration.imageRepository to "registry.k8s.io"
If the user runs "kubeadm upgrade apply", kubeadm can download
a configuration from the cluster. If the configuration contains
the legacy default imageRepository of "k8s.gcr.io", mutate it
to the new default of "registry.k8s.io" and update the
configuration in the config map.

During "upgrade node/diff" download the configuration, mutate the
image repository locally, but do not mutate the in-cluster value.
That is done only on "apply".

This ensures that users are migrated from the old default registry
domain.
2022-06-02 17:37:30 +03:00
Lubomir I. Ivanov
9f6df1d489 kubeadm: graduate the UnversionedKubeletConfig FG to GA
- lock the FG to true by default
- cleanup wrappers and logic related to versioned vs unversioned
naming of API objects (CMs and RBAC)
- update unit tests
2022-06-01 17:17:07 +03:00
Manish Kumar
e9e8be304c etcd: Updated to v3.5.4 2022-06-01 07:52:46 +05:30
Davanum Srinivas
50bea1dad8
Move from k8s.gcr.io to registry.k8s.io
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-05-31 10:16:53 -04:00
Kubernetes Prow Robot
92263ee0dd
Merge pull request #110072 from neolit123/1.25-kubeadm-etcd-liveness-probe
kubeadm: add serializable health checks for etcd probes
2022-05-30 00:40:52 -07:00
Kubernetes Prow Robot
0f8b0e14ae
Merge pull request #110141 from chymy/kubeadm-remove-imagespull
kubeadm: remove unused ImagesPull
2022-05-20 03:45:12 -07:00
Kubernetes Prow Robot
3308ce1caf
Merge pull request #110137 from neolit123/1.25-update-master-label-taint
kubeadm: cleanup OldControlPlaneTaint from unit tests
2022-05-19 22:05:13 -07:00
chymy
525b8cc4b2 kubeadm: remove unused ImagesPull
Signed-off-by: chymy <chang.min1@zte.com.cn>
2022-05-20 10:49:52 +08:00
Lubomir I. Ivanov
9c68116461 kubeadm: cleanup OldControlPlaneTaint from unit tests
The OldControlPlaneTaint taint (master) can be replaced
with the new ControlPlaneTaint (control-plane) taint.

Adapt unit tests in markcontrolplane_test.go
and cluster_test.go.
2022-05-19 22:00:39 +03:00
Manish Kumar
58cc7e7d43 Parse ENV vars to crictl command 2022-05-19 21:53:50 +05:30
Lubomir I. Ivanov
80e5bcae9b kubeadm: remove RemoveOldControlPlaneLabel
The function is no longer used and was missed in a
1.25 cleanup PR.
2022-05-18 15:42:08 +03:00
Kubernetes Prow Robot
84c8afeba3
Merge pull request #110095 from neolit123/1.25-update-master-label-taint
kubeadm: cleanup the "master" taint on CP nodes during upgrade
2022-05-18 00:52:54 -07:00
Kubernetes Prow Robot
90d7400ca1
Merge pull request #109356 from pacoxu/kubeadm-2426-cri
kubeadm: remove temporary handling of CRI socket paths without URL scheme
2022-05-17 18:00:52 -07:00
Kubernetes Prow Robot
9169f16841
Merge pull request #108447 from pacoxu/kubeadm-json-upgrade-plan
`Kubeadm upgrade plan` support json/yaml output
2022-05-17 16:46:31 -07:00
Lubomir I. Ivanov
ddd046f3dd kubeadm: cleanup the "master" taint on CP nodes during upgrade
- iniconfiguration.go: stop applying the "master" taint
for new clusters; update related unit tests in _test.go
- apply.go: Remove logic related to cleanup of the "master" label
during upgrade
- apply.go: Add cleanup of the "master" taint on CP nodes
during upgrade
- controlplane_nodes_test.go: remove test for old "master" taint
on nodes (this needs backport to 1.24, because we have a kubeadm
1.25 vs kubernetes test suite 1.24 e2e test)
2022-05-17 19:21:49 +03:00
Lubomir I. Ivanov
29148f61ac kubeadm: add serializable health checks for etcd probes
Use the etcd 3.5.3+ HTTP(s) endpoint "/health?serializable=true",
to allow the kubelet liveness and starup probes in the
kubeadm generated etcd.yaml (static Pod) to track
individual member health instead of tracking the whole
etcd cluster health.
2022-05-16 20:18:35 +03:00
Paco Xu
ab51557a0c kubeadm: container runtime is by default docker in kubelet v1.23
- can be removed in v1.26
2022-05-14 18:31:48 +08:00
Lubomir I. Ivanov
6efdcfd15b kubeadm: perform dockershim cleanup for 1.25
Given kubeadm 1.25 only supports kubelet 1.25 and 1.24,
1.23 related logic around dockershim can be removed.

- Don't clean the directories
/var/lib/dockershim, /var/runkubernetes, /var/lib/cni
- Pass the CRISocket directly to the kubelet
--container-runtime-endpoint flag without extra handling
of dockershim
- No longer apply the --container-runtime=remote flag
as that is the only possible value in 1.24 and 1.25
- Update unit tests


Note: we are still passing --pod-infra-container-image
to avoid the pause image to be GCed by the kubelet.
2022-05-12 21:38:17 +03:00
Lubomir I. Ivanov
b1f3034051 kubeadm: only taint CP nodes when the legacy "master" taint is present
During upgrade when a CP node is missing the old / legacy "master"
taint, assume the user has manually removed it to allow
workloads to schedule.

In such cases do not re-taint the node with the new "control-plane"
taint.
2022-05-05 23:39:23 +03:00
Kubernetes Prow Robot
f1ad477c88
Merge pull request #109751 from SataQiu/clean-kubeadm-20220502
kubeadm: replace *clientset.Clientset with clientset.Interface for join phase
2022-05-05 01:43:06 -07:00
Kubernetes Prow Robot
74ec2dd197
Merge pull request #109527 from navist2020/kubeadm/preflightError
Return preflightError if an error occurs when running the preflight
2022-05-04 01:29:04 -07:00
Kubernetes Prow Robot
d0fc41d105
Merge pull request #109324 from wppzxc/fix-output
Fix: test case wrong output in cmd/kubeadm/app/cmd/completion_test.go
2022-05-03 19:31:14 -07:00
SataQiu
eb1492bb00 kubeadm: replace *clientset.Clientset with clientset.Interface for join phase 2022-05-02 19:25:47 +08:00
navist2020
2a7e85bfdb Return preflightError if an error occurs when running the preflight 2022-04-20 11:39:35 +08:00
Stephen Augustus
3f85937b11
etcd: Update to v3.5.3
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2022-04-13 19:04:00 -04:00
Paco Xu
36594d739b CRI socket paths should have URL scheme 2022-04-07 16:11:58 +08:00
pengpeng wu
0b076a3dc3 Fix: test case wrong output in cmd/kubeadm/app/cmd/completion_test.go 2022-04-06 10:59:58 +08:00
Davanum Srinivas
f7ad09c447
Switch to pause 3.7
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-03-29 15:36:38 -04:00
Kubernetes Prow Robot
656dc213ce
Merge pull request #108992 from alexzielenski/cache-busting-client-go
client-go: OpenAPI v3 support
2022-03-28 21:37:11 -07:00
Lubomir I. Ivanov
c9386abd5f kubeadm: add etcd flag for member data consistency
Include the flag "--experimental-initial-corrupt-check"
in etcd static pod manifests to ensure
etcd member data consistency.

The etcd feature is planned for graduation in 3.6,
at which point we should switch to using the flag
without the "experimental" prefix.
2022-03-28 20:47:49 +03:00
Alexander Zielenski
52f7fd6534
update kubeadm restrictions to include v3 2022-03-28 10:07:56 -07:00
Kubernetes Prow Robot
9423ea4c1e
Merge pull request #109001 from wppzxc/master
Fix: Correct spelling mistakes in cmd/kubeadm/app/cmd/phases/workflow/runner_test.go
2022-03-28 06:45:00 -07:00
Kubernetes Prow Robot
083c3ac4e8
Merge pull request #106998 from eltociear/patch-7
Fix typo in get_test.go
2022-03-25 20:23:55 -07:00
Paco Xu
22fb3be96d cleanup: kubeadm upgrade plan supports json/yaml output
Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
2022-03-25 16:15:43 +08:00
pengpeng wu
f67ec386a5 Fix: Correct spelling mistakes in cmd/kubeadm/app/cmd/phases/workflow/runner_test.go 2022-03-25 10:08:00 +08:00
Patrick Ohly
edffc700a4 enhance and fix log calls
Some of these changes are cosmetic (repeatedly calling klog.V instead of
reusing the result), others address real issues:

- Logging a message only above a certain verbosity threshold without
  recording that verbosity level (if klog.V().Enabled() { klog.Info... }):
  this matters when using a logging backend which records the verbosity
  level.

- Passing a format string with parameters to a logging function that
  doesn't do string formatting.

All of these locations where found by the enhanced logcheck tool from
https://github.com/kubernetes/klog/pull/297.

In some cases it reports false positives, but those can be suppressed with
source code comments.
2022-03-24 11:13:50 +01:00
Sascha Grunert
6b63231b7e
kubeadm: reuse found crictl path for exec
We now re-use the crictl tool path within the `ContainerRuntime` when
exec'ing into it. This allows introducing a convenience function to
create the crictl command and re-use it where necessary.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-03-22 14:03:57 +01:00
SataQiu
6c57e2fced kubeadm: fix the bug that windows node failed to join IPv6 cluster due to preflight failures
Signed-off-by: SataQiu <shidaqiu2018@gmail.com>
2022-03-17 22:07:08 +08:00
Lubomir I. Ivanov
76e8a067d1 kubeadm: fix bad indentation in the API go docs
For the YAML examples, make the indentation consistent
by starting with a space and following with a TAB.
Also adjust the indentation of some fields to place them under
the right YAML field parent - e.g. ignorePreflightErrors
is under nodeRegistration.
2022-03-10 18:36:13 +02:00
Abirdcfly
2005110090 fix some typo
Change-Id: I211f572555e964581214a5d726ac552676c9833a
2022-03-05 23:25:52 +08:00
Paco Xu
79ecd60208 bugfix(kubeadm): Fix UT and log optmize 2022-03-03 19:09:26 +08:00
Paco Xu
93daef6e77 feature(kubeadm): add support of json/yaml format for upgrade plan
- cherry-pick 83941 and rebase
2022-03-03 17:23:03 +08:00
Haleygo
3bbc2572c5 fix dryrun when ca file exists 2022-03-03 11:53:42 +08:00
XuzhengChang
7824316e89 Print getStaticPodSingleHash err message 2022-03-02 09:34:12 +08:00
Kubernetes Prow Robot
0cfb5ccd6a
Merge pull request #107725 from neolit123/1.24-kubeadm-improve-strict-validation
kubeadm: improve the strict unmarshaling of component config
2022-02-17 15:01:02 -08:00
Lubomir I. Ivanov
ee5c927f06 kubeadm: improve strict validation for configuration
- Modify VerifyUnmarshalStrict to use serializer/json instead
of sigs.k8s.io/yaml. In strict mode, the serializers
in serializer/json use the new sigs.k8s.io/json library
that also catches case sensitive errors for field names -
e.g. foo vs Foo. Include test case for that in strict/testdata.
- Move the hardcoded schemes to check to the side of the
caller - i.e. accept a slice of runtime.Scheme.
- Move the klog warnings outside of VerifyUnmarshalStrict
and make them the responsibility of the caller.
- Call VerifyUnmarshalStrict when downloading the configuration
from kubeadm-config or the kube-proxy or kubelet-config CMs.
This validation is useful if the user has manually patched the CMs.
2022-02-17 19:37:41 +02:00
Kubernetes Prow Robot
1fa888529e
Merge pull request #107533 from neolit123/1.24-update-master-label-taint
kubeadm: apply "master" label/taint migration for 1.24
2022-02-15 21:44:36 -08:00
Kubernetes Prow Robot
d374c954de
Merge pull request #108027 from neolit123/1.24-update-unversioned-kubelet-cm-fg
kubeadm: switch UnversionedKubeletConfigMap to true
2022-02-14 10:59:52 -08:00
Lubomir I. Ivanov
f6fbf6c6e6 kubeadm: remove mentions of the x.yy versioned kubelet config CM
The legacy naming "kubelet-config-x.yy" is no longer the
default behavior. Rename instances in documentation and comments
of "kubelet-config-x.yy" to "kubelet-config".
2022-02-10 18:14:50 +02:00
Lubomir I. Ivanov
66a18df14c kubeadm: switch UnversionedKubeletConfigMap to true
- Graduate the feature gate to Beta and enable it by default.
- Pre-set the default value for UnversionedKubeletConfigMap
to "true" in test/e2e_kubeadm.
- Fix a couple of typos in "tolerate" introduced in the PR that
added the FG in 1.23.
2022-02-09 18:33:27 +02:00
SataQiu
2c5aef9036 kubeadm: fix the bug that 'kubeadm init --dry-run --upload-certs' command failed with 'secret not found' error 2022-02-09 12:58:02 +08:00
Kubernetes Prow Robot
eda02deda2
Merge pull request #107785 from chendave/warn
kubeadm: warn only when config value is different with default value
2022-02-08 08:18:55 -08:00
SataQiu
dcf959c782 kubeadm: fix the bug that 'kubeadm certs generate-csr' command does not remove duplicated SANs 2022-02-07 17:12:38 +08:00
Kubernetes Prow Robot
f11dbaea2f
Merge pull request #106883 from calvin0327/move-well-know-systemConstant
kubeadm: move well-known system constants to constants.go
2022-02-01 17:28:21 -08:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08:00
Dave Chen
29a870da2e kubeadm: warn only when config value is different with default value
Compare with two pointers will always show that they are different value,
so it will always print the warning message.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-01-28 13:04:40 +08:00
calvin
fcfcdef8fd move well-known system constants to constants.go 2022-01-27 10:39:14 +08:00
Kubernetes Prow Robot
8a25964153
Merge pull request #107317 from neolit123/1.24-change-kubeadm-cr-auto-detection
kubeadm: adapt CRI detection and defaults after the dockershim removal
2022-01-17 11:00:50 -08:00
SataQiu
aed6f56257 kubeadm: make the phase prefix and capitalization consistent 2022-01-16 00:01:35 +08:00
SataQiu
e91c829836 kubeadm reset: add support for dry-run 2022-01-14 11:07:09 +08:00
Lubomir I. Ivanov
db6061f5a6 kubeadm: apply the new "control-plane" taint during upgrade
- During "upgrade apply" call a new function AddNewControlPlaneTaint()
that finds all nodes with the new "control-plane" node-role label
and adds the new "control-plane" taint to them.
- The function is called in "apply" and is separate from
the step to remove the old "master" label for better debugging
if errors occur.
2022-01-13 17:46:11 +02:00
Lubomir I. Ivanov
370031cada kubeadm: apply the new "control-plane" taint on CP nodes
- Apply "control-plane" taint during init/join by adding the
taint in SetNodeRegistrationDynamicDefaults(). The old
taint "master" is still applied.
- Clarify API docs (v1beta2 and v1beta3) for nodeRegistration.Taint
to not mention "master" taint and be more generic. Remove
example for taints that includes the word "master".
- Update unit tests.
2022-01-13 17:46:05 +02:00
Lubomir I. Ivanov
a3d5e55982 kubeadm: only apply the new "control-plane" label during init/join
- Update the markcontrolplane phase used by init and join to
only label the nodes with the new control plane label.
- Cleanup TODOs about the old label.
- Remove outdated comment about selfhosting in staticpod/utils.go.
Selfhosting has not been supported in kubeadm for a while
and the comment also mentions the "master" label.
- Update unit tests.
2022-01-13 17:45:54 +02:00
Lubomir I. Ivanov
c0871b4433 kubeadm: delete the old "master" label during upgrade
- Rename the function in postupgrade.go to better reflect
what is being done.
- During "upgrade apply" find all nodes with the old label
and remove it by calling PatchNode.
- Update health check for CP nodes to not track "master"
labeled nodes. At this point all CP nodes should have
"control-plane" and we can use that selector only.
2022-01-13 17:45:32 +02:00
Lubomir I. Ivanov
f3f1332223 kubeadm: update the CRI socket detection logic
- Throw an error if there is more than one known socket on the host.
- Remove the special handling for docker+containerd.
- Remove the local instances of constants for endpoints for
Windows / Unix and use the defaultKnownCRISockets variable
which is populated from OS specific constants.
- Update error message in detectCRISocketImpl to have more
details.
- Make detectCRISocketImpl accept a list of "known" sockets
- Update unit tests for detectCRISocketImpl and make them
use generic paths such as "unix:///foo/bar.sock".
2022-01-12 17:15:45 +02:00
Lubomir I. Ivanov
ea2c948799 kubeadm: change the default CRI socket to containerd
Change the default container runtime CRI socket endpoint to the
one of containerd. Previously it was the one for Docker

- Rename constants.DefaultDockerCRISocket to DefaultCRISocket
- Make the constants files include the endpoints for all supported
container runtimes for Unix/Windows.
- Update unit tests related to docker runtime testing.
- In kubelet/flags.go hardcode the legacy docker socket as a check
to allow kubeadm 1.24 to run against kubelet 1.23 if the user
explicitly sets the criSocket field to "npipe:////./pipe/dockershim"
on Windows or "unix:///var/run/dockershim.sock" on Linux.
2022-01-12 17:15:45 +02:00
Kubernetes Prow Robot
9c468ecf30
Merge pull request #107467 from SataQiu/kubeadm-cleanup-20220111
kubeadm: print warnings to stderr
2022-01-11 09:46:57 -08:00
SataQiu
218b4dea9f kubeadm: print warnings to stderr 2022-01-11 23:08:59 +08:00
Lubomir I. Ivanov
ad58393e19 kubeadm: remove the deprecated output/v1alpha1 API
The API was deprecated in 1.23 when output/v1alpha2 was
added. v1alpha1 is problematic since it embeds kubeadm/v1beta2
BootstrapToken related types directly. v1alpha2 imports
a new group dedicated to bootstrap tokens apis/bootstraptoken.
2022-01-11 12:51:46 +02:00
Ikko Ashimine
6debd53ff3 Fix typo in flags.go 2022-01-07 04:02:11 +09:00
Kubernetes Prow Robot
c15e24b128
Merge pull request #107327 from SataQiu/kubeadm-cert
kubeadm: remove the restriction that the ca.crt can only contain one certificate
2022-01-05 19:08:39 -08:00
Kubernetes Prow Robot
a1be132c0d
Merge pull request #107270 from SataQiu/refactor-20211231
kubeadm: use build tags and split the Windows releated logic into separate files for kubelet component config
2022-01-05 13:54:29 -08:00
Lubomir I. Ivanov
936e12c930 kubeadm: do not special case Docker as a container runtime
crictl already works with the current state of dockershim.
Using the docker CLI is not required and the DockerRuntime
can be removed from kubeadm. This means that crictl
can connect at the dockershim (or cri-dockerd) socket and
be used to list containers, pull images, remove containers, and
all actions that the kubelet can otherwise perform with the socket.

Ensure that crictl is now required for all supported container runtimes
in checks.go. In the help text in waitcontrolplane.go show only
the crictl example.

Remove the check for the docker service from checks.go.
Remove the DockerValidor check from checks.go.
These two checks were special casing Docker as CR and compensating
for the lack of the same checks in dockershim. With the
extraction of dockershim to cri-dockerd, ideally cri-dockerd
should perform the required checks whether it can support
a given Docker config / version running on a host.
2022-01-05 21:27:24 +02:00
SataQiu
2a113424fc kubeadm: use build tags and split the Windows releated logic into separate files for kubelet component config 2022-01-05 16:04:55 +08:00
SataQiu
83ef08336b kubeadm: remove the restriction that the ca.crt can only contain one certificate 2022-01-05 15:08:29 +08:00
Lubomir I. Ivanov
076b19f0eb kubeadm: fix panic in runKubeletConfigPhase
The "nro" struct must be initialized before passing it to
GetNodeRegistration().
2022-01-04 21:28:13 +02:00
Kubernetes Prow Robot
c7d57a01b7
Merge pull request #107295 from neolit123/1.24-kubeadm-add-scheme-to-cri-sockets
kubeadm: ensure CRI endpoints are managed with URL schemes
2022-01-03 23:02:59 -08:00
Lubomir I. Ivanov
39330c4278 kubeadm: ensure CRI URL scheme is present in the kubelet env file
During "upgrade node" and "upgrade apply" read the
kubelet env file from /var/lib/kubelet/kubeadm-flags.env
patch the --container-runtime-endpoint flag value to
have the appropriate URL scheme prefix (e.g. unix:// on Linux)
and write the file back to disk.

This is a temporary workaround that should be kept only for 1 release
cycle - i.e. remove this in 1.25.
2022-01-03 23:13:31 +02:00
Lubomir I. Ivanov
207556e057 kubeadm: make "upgrade node" include URL scheme in socket paths
The CRI socket that kubeadm writes as an annotation
on a particular Node object can include an endpoint that
does not have an URL scheme. This is undesired as long term
the kubelet can stop allowing endpoints without URL scheme.

For control plane nodes "kubeadm upgrade apply" takes
the locally defaulted / populated NodeRegistration and refreshes
the CRI socket in PerformPostUpgradeTasks. But for secondary
nodes "kubeadm upgrade node" does not.

Adapt "upgrade node" to fetch the NodeRegistration for this node
and fix the CRI socket missing URL scheme if needed in the Node
annotation.
2022-01-03 23:13:31 +02:00
pacoxu
7594f0ef90 kubeadm: detect runtime socket as URL format
- Update defaults for v1beta2 and 3 to have URL scheme
- Raname DefaultUrlScheme to DefaultContainerRuntimeURLScheme
- Prepend a missing URL scheme to user sockets and warn them
that this might not be supported in the future
- Update socket validation to exclude IsAbs() testing
(This is broken on Windows). Assume the path is not empty and has
URL scheme at this point (validation happens after defaulting).
- Use net.Dial to open Unix sockets
- Update all related unit tests

Signed-off-by: pacoxu <paco.xu@daocloud.io>
Signed-off-by: Lubomir I. Ivanov <lubomirivanov@vmware.com>
2022-01-03 21:15:03 +02:00
Monokaix
eab74f15a5 Remove unused arg of kubeadm/WaitForKubeletAndFunc 2021-12-25 09:12:00 +08:00
Kubernetes Prow Robot
522c1be4c1
Merge pull request #106648 from calvin0327/remove-dualStack-featureGate
kubeadm: cleanup the feature gate of dual-stack.
2021-12-15 17:27:18 -08:00
Kubernetes Prow Robot
be5b9b4f8d
Merge pull request #107013 from pacoxu/kubeadm-v1beta2-depre
kubeadm: mark v1beta2 as deprecated
2021-12-14 19:48:18 -08:00
Paco Xu
703f2a7b86 kubeadm: mark v1beta2 as deprecated 2021-12-15 09:36:42 +08:00
Lubomir I. Ivanov
6c6c7e5f0c kubeadm: handle dockershim specific flags for 1.24
Currently when the dockershim socket is used, kubeadm only passes
the --network-plugin=cni to the kubelet and assumes the built-in
dockershim. This is valid for versions <1.24, but with dockershim
and related flags removed the kubelet will fail.

Use preflight.GetKubeletVersion() to find the version of the host
kubelet and if the version is <1.24 assume that it has built-in
dockershim. Newer versions should will be treated as "remote" even
if the socket is for dockershim, for example, provided by cri-dockerd.

Update related unit tests.
2021-12-11 02:16:06 +02:00
Davanum Srinivas
9405e9b55e
Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-12-09 21:31:26 -05:00
Kubernetes Prow Robot
b5a610064c
Merge pull request #106920 from neolit123/1.24-update-kubeadm-owners
kubeadm: update OWNERS for 1.24
2021-12-09 18:01:22 -08:00
Kubernetes Prow Robot
481459d12d
Merge pull request #106872 from calvin0327/fix-kubeadm-kubelet-constant
kubeadm: amend constant to kubelet.
2021-12-09 16:29:22 -08:00
Lubomir I. Ivanov
0290eb63b6 kubeadm: update OWNERS for 1.24 2021-12-09 21:07:56 +02:00
Kubernetes Prow Robot
8cc7d14588
Merge pull request #106859 from knight42/refactor/remove-apiserver-insecure-port
refactor(apiserver): remove the insecure flags
2021-12-09 09:48:30 -08:00
haoyun
cd3bafc2ed cleanup: remove insecure flag
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-09 12:36:29 +08:00
Lubomir I. Ivanov
c78afc695b kubeadm: print the CA of kubeconfig files in "check expiration"
Apply a small fix to ensure the kubeconfig files
that kubeadm manages have a CA when printed in the table
of the "check expiration" command. "CAName" is the field used for that.

In practice kubeconfig files can contain multiple credentials
from different CAs, but this is not supported by kubeadm and there
is a single cluster CA that signs the single client cert/key
in kubeadm managed kubeconfigs.
2021-12-08 20:50:23 +02:00
Lubomir I. Ivanov
6603cf6357 kubeadm: validate local etcd certficates during expiration checks
In case stacked etcd is used, the code that does expiration checks
does not validate if the etcd CA is "external" (missing key)
and if the etcd CA signed certificates are valid.

Add a new function UsingExternalEtcdCA() similar to existing functions
for the cluster CA and front-proxy CA, that performs the checks for
missing etcd CA key and certificate validity.

This function only runs for stacked etcd, since if etcd is external
kubeadm does not track any certs signed by that etcd CA.

This fixes a bug where the etcd CA will be reported as local even
if the etcd/ca.key is missing during "certs check-expiration".
2021-12-08 20:39:14 +02:00
calvin
fdf33a27c4 amend constant to kubelet 2021-12-08 14:17:34 +08:00
Lubomir I. Ivanov
847b2e1085 kubeadm: avoid requiring a CA key during kubeconfig expiration checks
When the "kubeadm certs check-expiration" command is used and
if the ca.key is not present, regular on disk certificate reads
pass fine, but fail for kubeconfig files. The reason for the
failure is that reading of kubeconfig files currently
requires reading both the CA key and cert from disk. Reading the CA
is done to ensure that the CA cert in the kubeconfig is not out of date
during renewal.

Instead of requiring both a CA key and cert to be read, only read
the CA cert from disk, as only the cert is needed for kubeconfig files.

This fixes printing the cert expiration table even if the ca.key
is missing on a host (i.e. the CA is considered external).
2021-12-07 20:48:45 +02:00
calvin
d591b62b4a remove the kubeadm feature gate. 2021-11-29 18:11:02 +08:00
Hanna Lee
c862d7c0e9 Fix last remaining SA5011 error by removing unnecessary r != nil check 2021-11-17 08:56:01 +01:00
Kubernetes Prow Robot
1c127d3682
Merge pull request #105706 from uthark/oatamanenko/upgrade-etcd-3.5.1
Upgrade etcd to 3.5.1
2021-11-15 10:04:59 -08:00
navist2020
bc4bbd88b2 kubeadm/certs/renew:remove deprecated flags csrOnly and csrPath 2021-11-12 17:44:35 +08:00
Kubernetes Prow Robot
35f9bcabf1
Merge pull request #105992 from hwdef/fix-kubeadm-2419
kubeadm: add mutation for Linux paths in KubeletConfiguration on Windows
2021-11-11 19:48:29 -08:00
hwdef
b985e094b0 kubeadm: fix absolute paths do not work properly in config files in windows 2021-11-12 10:42:46 +08:00
Lubomir I. Ivanov
e1571bf665 kubeadm: fix typo in KubeProxyClusterRoleBindingName constant
kubeam:node-proxier -> kubeadm:node-proxier
This causes e2e test failures:
"[area-kubeadm] proxy addon kube-proxy ServiceAccount should
be bound to the system:node-proxier cluster role"

in:
- kubeadm-kinder-latest
- kubeadm-kinder-latest-on-...
- other tests
2021-11-10 21:19:30 +02:00
Etienne Champetier
356d9e0626 kubeadm: fix inverted warning message
Before this commit when setting bindAddress to 1.2.3.4 the warning was:
The recommended value for "bindAddress" in "KubeProxyConfiguration" is: 1.2.3.4; the provided value is: 0.0.0.0

Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
2021-11-09 20:54:57 -05:00
Kubernetes Prow Robot
e759c32129
Merge pull request #106243 from calvin0327/fix-kubeadm-init-constant
fix some kubeadm init phase constants
2021-11-09 11:28:24 -08:00
Kubernetes Prow Robot
5848dbaa80
Merge pull request #105741 from neolit123/1.23-kubeadm-kubelet-config-map-change
kubeadm: introduce the UnversionedKubeletConfigMap feature gate
2021-11-09 11:27:48 -08:00
calvin
c5c9429d0e fix some kubeadm init phase constants 2021-11-09 10:30:01 +08:00
Lubomir I. Ivanov
68118d7319 kubeadm: remove unused / legacy function DownloadConfig
The function has been marked as deprecated for a long time
and has been unused in the code base.

Remove it.
2021-11-08 17:31:29 +02:00
Lubomir I. Ivanov
a6587f4ffb kubeadm: add the UnversionedKubeletConfigMap feature gate
Add the UnversionedKubeletConfigMap feature gate that can
be used to control legacy vs new behavior for naming the
default configmap used to store the KubeletConfiguration.

Update related unit tests.
2021-11-08 17:31:29 +02:00
Kubernetes Prow Robot
73f4064fff
Merge pull request #105295 from neolit123/1.23-add-output-v1alpha2
kubeadm: add a new output/v1alpha2 API; deprecate output/v1alpha1
2021-11-08 06:01:11 -08:00
Kubernetes Prow Robot
4ce435cc95
Merge pull request #105251 from calvin0327/issue-upgrade-coredns
Update corefile-migration to v1.0.14 and update coredns to 1.8.6
2021-11-05 14:48:39 -07:00
Kubernetes Prow Robot
6d30c96d4a
Merge pull request #106042 from chendave/aggregate
kubeadm: aggregate all the errors when the shared certs are validated
2021-11-04 10:06:15 -07:00
Dave Chen
c85fb0e6ac Aggregate all the errors when the shared certs are validated
Instead of the individual error and return, it's better to aggregate all
the errors so that we can fix them all at once.

Take the chance to fix some comments, since kubeadm are not checking that
the certs are equal across controlplane.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2021-11-04 10:12:00 +08:00
Lubomir I. Ivanov
d3e1f87fca kubeadm: remove TODO about moving SchemeBuilder to k8s.io/api
This TODO is no longer in scope, thus remove it from
all register.go files under /app/apis.
2021-11-03 19:11:43 +02:00
Lubomir I. Ivanov
f73894359d kubeadm: update converters after the output/v1alpha2 addition
The addition of output/v1alpha2 made the converter-gen require
an explicit converter for:
kubeadm/v1beta2.BootstrapToken -> bootstraptoken/v1.BootstrapToken.

Add this converter under kubeadm/v1beta.
Use the converter in output/v1alpha1.
2021-11-03 19:11:43 +02:00
Tim Hockin
11a25bfeb6
De-share the Handler struct in core API (#105979)
* De-share the Handler struct in core API

An upcoming PR adds a handler that only applies on one of these paths.
Having fields that don't work seems bad.

This never should have been shared.  Lifecycle hooks are like a "write"
while probes are more like a "read". HTTPGet and TCPSocket don't really
make sense as lifecycle hooks (but I can't take that back). When we add
gRPC, it is EXPLICITLY a health check (defined by gRPC) not an arbitrary
RPC - so a probe makes sense but a hook does not.

In the future I can also see adding lifecycle hooks that don't make
sense as probes.  E.g. 'sleep' is a common lifecycle request. The only
option is `exec`, which requires having a sleep binary in your image.

* Run update scripts
2021-10-29 13:15:11 -07:00
Lubomir I. Ivanov
b9171aee20 kubeadm: remove the reset/update-cluster-status phase
The phase has been deprecated and a NO-OP since 1.22.
Remove the phase related code.
2021-10-25 22:47:15 +03:00
Kubernetes Prow Robot
9251115fa1
Merge pull request #105807 from jonyhy96/fix-magic-number
kubeadm: make constant of the magic-number in bootstraptoken util
2021-10-22 04:46:37 -07:00
haoyun
9b5f28053c feat: make a const of magic-number
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
2021-10-22 09:53:07 +08:00
Oleg Atamanenko
965f10f539 Upgrade etcd to 3.5.1 2021-10-18 23:09:27 -07:00
haoyun
a600e31c55 test: add test for PatchNode when error happend
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-10-19 11:01:01 +08:00
Kubernetes Prow Robot
9804a83d8f
Merge pull request #105343 from jonyhy96/fix-patch-node-once
kubeadm: fix some retry logic in PatchNodeOnce
2021-10-17 09:49:49 -07:00
haoyun
bd8f26c2d7 fix: patchNode retry logic
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-10-17 12:36:36 +08:00
navist2020
cc2802d9bb validate flag cfgPath to make sure it is not empty 2021-10-14 11:05:06 +08:00
calvin0327
941c78f411 Update corefile-migration to v1.0.14 and update coredns to 1.8.6 2021-10-12 11:03:52 +08:00
Lubomir I. Ivanov
73d528dce9 kubeadm: make output/BootstrapToken use bootstraptoken/v1 2021-09-28 16:37:41 +03:00
Lubomir I. Ivanov
47af311ea4 kubeadm: mark output/v1alpha1 as deprecated 2021-09-28 16:37:40 +03:00
Lubomir I. Ivanov
473e781ccb kubeadm: set output/v1alpha2 as the priority version 2021-09-28 16:37:40 +03:00
Lubomir I. Ivanov
b92966aeac kubeadm: use output/v1alpha2 in kubeadm commands
Use the new API for "config images list" and
"token list".
2021-09-28 16:37:40 +03:00
Lubomir I. Ivanov
2d4fcedbcf kubeadm: add a new output/v1alpha2 API
The API is a copy of output/v1alpha1 with a minor difference
where output/v1alpha2.BootstrapToken embeds
bootstraptoken/v1.BootstrapToken instead of
kubeadm/v1beta2.BootstrapToken.

Embedding the later is an undesired binding between the "kubeadm"
and "output" groups, preventing the eventual deprecation and removal
of the kubeadm.v1beta2 API.

This new output API version, unlike v1alpha1, does not include
defaulting which is not needed.
2021-09-28 16:37:26 +03:00
Kubernetes Prow Robot
bf000e8770
Merge pull request #104770 from pacoxu/dual-stack-ga-kubeadm
cleanup: DualStack GA for kubeadm
2021-09-28 03:42:42 -07:00
Paco Xu
751ad37a05 kubeadm: cleanup remove some empty feature gate for dual-stack 2021-09-28 15:34:26 +08:00
Khaled Henidak (Kal)
a53e2eaeab
move IPv6DualStack feature to stable. (#104691)
* kube-proxy

* endpoints controller

* app: kube-controller-manager

* app: cloud-controller-manager

* kubelet

* app: api-server

* node utils + registry/strategy

* api: validation (comment removal)

* api:pod strategy (util pkg)

* api: docs

* core: integration testing

* kubeadm: change feature gate to GA

* service registry and rest stack

* move feature to GA

* generated
2021-09-24 16:30:22 -07:00
Kubernetes Prow Robot
91f820eee4
Merge pull request #104854 from pacoxu/kubeadm-swap-check
kubeadm: move swap on check error to warning since NodeSwap is beta
2021-09-17 04:57:13 -07:00
Kubernetes Prow Robot
8975906dfc
Merge pull request #104942 from SataQiu/kubeadm-20210912
kubeadm: do not check if the /etc/kubernetes/manifests folder is empty on joining worker nodes during preflight
2021-09-15 11:16:11 -07:00
Paco Xu
0b8433a3f5 kubeadm: remove --port from kube-scheduler manifest 2021-09-15 12:58:35 +08:00
Kubernetes Prow Robot
fa2657b8b2
Merge pull request #104624 from Haleygo/support-null-resolvConf-in-configFile
When resolvConf is "" in kubelet configuration, pod will be created with wrong dns policy
2021-09-14 14:18:59 -07:00
SataQiu
d57e442c62 kubeadm: do not check if the /etc/kubernetes/manifests folder is empty on joining worker nodes during preflight
Signed-off-by: SataQiu <shidaqiu2018@gmail.com>
2021-09-14 20:26:04 +08:00
Haleygo
46454ea9dc support null resolvConf in Kubelet Configuration 2021-09-14 16:12:52 +08:00
Paco Xu
1385bd3a06 kubeadm: fix ut failures of dualstack GA 2021-09-14 13:16:40 +08:00
Kubernetes Prow Robot
c79f7c1add
Merge pull request #104711 from claudiubelu/update-pause-3.6
update pause image references to use 3.6
2021-09-13 19:09:08 -07:00
Paco Xu
d57bad5fa9 Update cmd/kubeadm/app/preflight/checks.go
Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
2021-09-14 09:33:12 +08:00
Paco Xu
7007b417e5 kubeadm: move swap on check error to warning since NodeSwap is beta in 1.23 2021-09-14 09:33:12 +08:00
RA489
2a96e22c0a remove the --csr* flags from "kubeadm certs renew" 2021-09-13 14:50:33 +05:30
Paco Xu
a0cc3f1c9a cleanup: DualStack GA for kubeadm 2021-09-04 22:38:14 +08:00
Claudiu Belu
18936d4785 updates pause image references
The pause:3.6 image has been published.

Also updates older / incorrect references.
2021-08-29 21:50:05 -07:00
la3mmchen
57f2af2834 FIX: just add a missing word in output 2021-08-25 21:53:49 +02:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
XinYang
72fd01095d
re-order imports for kubeadm
Signed-off-by: XinYang <xinydev@gmail.com>
2021-08-17 22:40:46 +08:00
Lubomir I. Ivanov
096c3e8f2d kubeadm: further improve the dynamic version population
Panicing if not running in a test and if the component-base/version
variables are empty is not ideal. At some point sections
of kubeadm could be exposed as a library and if these sections
import the constants package, they would panic on the library
users unless they set the version information in component-base
with ldflags.

Instead:
- If the component-base version is empty, return a placeholder version
that should indicate to users that build kubeadm that something is not
right (e.g. they did not use 'make'). During library usage or unit
tests this version should not be relevant.
- Update unit tests to use hardcoded versions instead of the versions
from the constants package. Using the constants package for testing
is good but during unit tests these versions are already placeholders
since unit tests do not populate the actual component-base versions
(e.g. 1.23).
2021-08-12 19:54:06 +03:00
Kubernetes Prow Robot
746fea56ae
Merge pull request #104065 from pacoxu/kubeadm-patches
kubeadm: disallow the mixture of --config and --patches & remove deprecated --experimental-patches
2021-08-11 08:06:58 -07:00
Benjamin Elder
e6cb526f6b set umask on linux and darwin when testing kubeadm copycerts 2021-08-10 22:42:35 -07:00
Kubernetes Prow Robot
40c9066054
Merge pull request #103027 from Haleygo/feature/add-kubeadm-join-dryrun
kubeadm: support kubeadm join --dry-run
2021-08-10 13:02:39 -07:00
Haleygo
95e000fd65 support kubeadm join dry-run 2021-08-10 23:43:54 +08:00
Kubernetes Prow Robot
e96652ea74
Merge pull request #104015 from neolit123/1.23-use-dynamic-versions
kubeadm: dynamically populate the current/minimum k8s versions
2021-08-09 21:59:17 -07:00
Lubomir I. Ivanov
e3538edc22 kubeadm: update unit tests to support dynamic version updates
Tests under /app and /test would fail if the current/minimum k8s version
is dynamically populated from the version in the kubeadm binary.
Adapt the tests to support that.
2021-08-09 19:42:08 +03:00
Lubomir I. Ivanov
207ffa7bdc kubeadm: dynamically populate the current/minimum k8s versions
Kubeadm requires manual version updates of its current supported k8s
control plane version and minimally supported k8s control plane and
kubelet versions every release cycle.

To avoid that, in constants.go:
- Add the helper function getSkewedKubernetesVersion() that can be
used to retrieve a MAJOR.(MINOR+n).0 version of k8s. It currently
uses the kubeadm version populated in "component-base/version" during
the kubeadm build process.
- Use the function to set existing version constants (variables).

Update util/config/common.go#NormalizeKubernetesVersion() to
tolerate the case where a k8s version in the ClusterConfiguration
is too old for the kubeadm binary to use during code freeze.

Include unit tests for the new utilities.
2021-08-09 19:42:08 +03:00
Kubernetes Prow Robot
5eeaafd2b4
Merge pull request #104157 from knight42/remove-port-from-kubeadm-manifest
refactor(kubeadm): remove the flag --port from KCM manifest
2021-08-05 16:37:10 -07:00
Kubernetes Prow Robot
de4e500673
Merge pull request #104134 from ihgann/topic/ganni/optimize-kubeadm-etcd-member-add-2
kubeadm: reduce the backoff time of AddMember for etcd
2021-08-05 16:37:03 -07:00
Kubernetes Prow Robot
8df554bafd
Merge pull request #103801 from gkarthiks/master
Remove purell package usage from kubeadm
2021-08-05 14:09:56 -07:00
Ian Gann
c8431f42d9 kubeadm: Reduce the backoff time of AddMember for etcd
This change optimizes the kubeadm/etcd `AddMember` client-side function
by stopping early in the backoff loop when a peer conflict is found
(indicating the member has already been added to the etcd cluster). In
this situation, the function will stop early and relay a call to
`ListMembers` to fetch the current list of members to return. With this
optimization, front-loading a `ListMembers` call is no longer necessary,
as this functionally returns the equivalent response.

This helps reduce the amount of time taken in situational cases where an
initial client request to add a member is accepted by the server, but
fails client-side.

This situation is possible situationally, such as if network latency
causes the request to timeout after it was sent and accepted by the
cluster. In this situation, the following loop would occur and fail with
an `ErrPeerURLExist` response, and would be stuck until the backoff
timeout was met (roughly ~2min30sec currently).

Testing Done:

* Manual testing with an etcd cluster. Initial "AddMember` call was
  successful, and the etcd manifest file was identical to prior version
  of these files. Subsequent calls to add the same member succeeded
  immediately (retaining idempotency), and the resulting manifest file
  remains identical to previous version as well. The difference, this
  time, is the call finished ~2min25sec faster in an identical test in
  the environment tested with.
2021-08-05 13:11:42 -07:00
Jian Zeng
c486b229d2 refactor(kubeadm): remove the flag --port from KCM manifest
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
2021-08-05 19:51:02 +08:00
Kubernetes Prow Robot
90ac41bd77
Merge pull request #103813 from SataQiu/update-kubeadm-ci-bucket
kubeadm: update references to legacy artifacts locations
2021-08-05 01:44:27 -07:00
paco
b7ea7a7766 kubeadm: disallow the mixture of --config and --patches 2021-08-02 10:20:31 +08:00
paco
375ef778c4 kubeadm: remove deprecated --experimental-patches 2021-08-02 10:10:20 +08:00
Kevin Delgado
ca90849724 add kube-openapi/pkg/schemaconv to kubeadm import-restrictions 2021-07-28 01:06:15 +00:00
SataQiu
5be47eaf27 kubeadm: update references to legacy artifacts locations 2021-07-21 12:13:05 +08:00
gkarthiks
019e8f71b6 refactor: normalizing URL string locally and move out from purell package
The purell package at github.com/PuerkitoBio/purell is no longer maintained and in k/k repo under kubeadm package its been used for normalizing the URL. This commit removes the dependency on this package and creates a local function for normalizing the URL within the preflight package under cmd/kubeadm.

Signed-off-by: gkarthiks <github.gkarthiks@gmail.com>

chore: add new line at end of the file

Signed-off-by: gkarthiks <github.gkarthiks@gmail.com>

fix: remove unused mod from vendor modules file

Signed-off-by: gkarthiks <github.gkarthiks@gmail.com>
2021-07-20 21:56:08 +05:30
Lubomir I. Ivanov
6cf3e36c37 kubeadm: statically default the "from cluster" InitConfiguration
During operations such as "upgrade", kubeadm fetches the
ClusterConfiguration object from the kubeadm ConfigMap.
However, due to requiring node specifics it wraps it in an
InitConfiguration object. The function responsible for that is:
  app/util/config#FetchInitConfigurationFromCluster().

A problem with this function (and sub-calls) is that it ignores
the static defaults applied from versioned types
(e.g. v1beta3/defaults.go) and only applies dynamic defaults for:
- API endpoints
- node registration
- etc...

The introduction of Init|JoinConfiguration.ImagePullPolicy now
has static defaulting of the NodeRegistration object with a default
policy of "PullIfNotPresent". Respect this defaulting by constructing
a defaulted internal InitConfiguration from
FetchInitConfigurationFromCluster() and only then apply the dynamic
defaults over it.

This fixes a bug where "kubeadm upgrade ..." fails when pulling images
due to an empty ("") ImagePullPolicy. We could assume that empty
string means default policy on runtime in:
cmd/kubeadm/app/preflight/checks.go#ImagePullCheck()

but that might actually not be the user intent during "init" and "join",
due to e.g. a typo. Similarly, we don't allow empty tokens
on runtime and error out.
2021-07-08 02:52:11 +03:00
Kubernetes Prow Robot
ac554af79b
Merge pull request #103142 from serathius/etcd-3.5.0
Upgrade etcd to 3.5.0
2021-07-07 12:40:22 -07:00
Kubernetes Prow Robot
656d00e894
Merge pull request #103496 from neolit123/1.22-add-defaulting-v1beta3-imagepull
kubeadm: statically default ImagePullPolicy in v1beta3
2021-07-06 22:11:48 -07:00
Lubomir I. Ivanov
f01d251e38 kubeadm: statically default ImagePullPolicy in v1beta3
Instead of dynamically defaulting NodeRegistration.ImagePullPolicy,
which is common when doing defaulting depending on host state - e.g.
hostname, statically default it in v1beta3/defaults.go.

- Remove defaulting in checks.go
- Add one more unit test in checks_test.go
- Adapt v1beta2 conversion and fuzzer / round tripping tests

This also results in the default being visible when calling:
"kubeadm config print ...".
2021-07-05 21:48:06 +03:00
Lubomir I. Ivanov
94414bea47 kubeadm: fix godoc formatting for v1beta3
Fix indentation of entries in the changelog and the migration steps.
2021-07-05 20:52:18 +03:00
Kubernetes Prow Robot
120f6325a7
Merge pull request #103471 from pacoxu/patch-1
kubeadm: fix nil pointer in  Cfg() feature gate checking
2021-07-04 23:06:53 -07:00
Paco Xu
772344aef2
kubeadm: fix nil pointer in Cfg() feature gate checking 2021-07-05 09:59:57 +08:00
XinYang
c2a8cd359f
re-order the imports in kubeadm
Signed-off-by: XinYang <xinydev@gmail.com>

Update cmd/kubeadm/app/cmd/join.go

Co-authored-by: Lubomir I. Ivanov <neolit123@gmail.com>
2021-07-04 16:41:27 +08:00
Kubernetes Prow Robot
5fe522c237
Merge pull request #101988 from vinayakankugoyal/kubeadm
Remove users and groups created as part of rootless control-plane in kubeadm.
2021-07-02 23:42:17 -07:00
Vinayak Goyal
1ae9b8f04d Update kernel components to run as non-root in kubeadm. 2021-07-02 17:37:55 -07:00
Kubernetes Prow Robot
1345a802de
Merge pull request #103187 from Haleygo/fix-dry-run-when-using-externalCA
Kubeadm init --dry-run should work when using an external ca
2021-07-02 07:58:25 -07:00
Haleygo
6d6d200c3a dry-run can work when using an external ca 2021-07-02 18:53:51 +08:00
Lubomir I. Ivanov
622f69bf8d kubeadm: update v1beta3's godoc changelog 2021-07-02 00:12:25 +03:00
Lubomir I. Ivanov
11d444b00e kubeadm: remove versioned copies of the bootstrap token API and utils
Given bootstraptoken/v1 is now a separate GV, there is no need
to duplicate the API and utilities inside v1beta3 and the internal
version.

v1beta2 must continue to use its internal copy due, since output/v1alpha1
embeds the v1beta2.BootstrapToken object. See issue 2427 in k/kubeadm.
2021-07-02 00:11:49 +03:00
Lubomir I. Ivanov
14fa296bb3 kubeadm: use the bootstraptoken/v1 API across the code base
- Make v1beta3 use bootstraptoken/v1 instead of local copies
- Make the internal API use bootstraptoken/v1
- Update validation, /cmd, /util and other packages
- Update v1beta2 conversion
2021-07-02 00:11:49 +03:00
Lubomir I. Ivanov
5b7bda90c0 kubeadm: introduce apis/bootstraptoken/v1
Package bootstraptoken contains an API and utilities wrapping the
"bootstrap.kubernetes.io/token" Secret type to ease its usage in kubeadm.

The API is released as v1, since these utilities have been part of a
GA workflow for 10+ releases.

The "bootstrap.kubernetes.io/token" Secret type is also GA.
2021-07-02 00:11:49 +03:00
Kubernetes Prow Robot
3f4c39bbd7
Merge pull request #103063 from neolit123/1.22-add-patches-to-v1beta3
kubeadm: add support for patches in v1beta3; deprecate --experimental-patches
2021-07-01 02:25:54 -07:00
Vinayak Goyal
1c39cf2365 Fix incorrect user and group for kube-scheduler when it is running as non-root. 2021-06-30 11:28:15 -07:00
Lubomir I. Ivanov
5c00024c70 kubeadm: fix wrong check for keys/certs during "download-certs"
During "join" of new control plane machines, kubeadm would
download shared certificates and keys from the cluster stored
in a Secret. Based on the contents of an entry in the Secret,
it would use helper functions from client-go to either write
it as public key, cert (mode 644) or as a private key (mode 600).

The existing logic is always writing both keys and certs with mode 600.
Allow detecting public readable data properly and writing some files
with mode 644.

First check the data with ParsePrivateKeyPEM(); if this passes
there must be at least one private key and the file should be written
with mode 600 as private. If that fails, validate if the data contains
public keys with ParsePublicKeysPEM() and write the file as public
(mode 644).

As a result of this new logic, and given the current set of managed
kubeadm files, .key files will end up with 600, while .crt and .pub
files will end up with 644.
2021-06-29 23:42:04 +03:00
wangyysde
39a373b162 correct example command of kubeadm help
Signed-off-by: wangyysde <net_use@bzhy.com>
2021-06-28 16:12:52 +08:00
navist2020
538e7777c3 kubeadm:remove deprecated flags CSROnly and CSRDir 2021-06-24 18:28:43 +08:00
Marek Siarkowicz
ebe550bd48 Upgrade etcd to 3.5.0 2021-06-24 09:15:17 +02:00
Lubomir I. Ivanov
70a524659a kubeadm: add {Init|Join}Configuration.Patches.Directory to v1beta3
Add {Init|Join}Configuration.Patches, which is a structure that
contains patch related options. Currently it only has the "Directory"
field which is the same option as the existing --experimental-patches
flag.

The flags --[experimental-]patches value override this value
if both a flag and config is passed during "init" or "join".
2021-06-23 22:24:10 +03:00
Lubomir I. Ivanov
a4402122b4 kubeadm: add the --patches flag and deprecate --experimental-patches
The feature of "patches" in kubeadm has been in Alpha for a few
releases. It has not received major bug reports from users.
Deprecate the --experimental-patches flag and add --patches.

Both flags are allowed to be mixed with --config.
2021-06-23 22:22:41 +03:00
Lubomir I. Ivanov
3b36e6bcea kubeadm: fix image pull policy integration
If the user has not specified a pull policy we must assume a default of
v1.PullIfNotPresent.

Add some extra verbose output to help users monitor what policy is
used and what images are skipped / pulled.

Use "fallthrough" and case handle "v1.PullAlways".

Update unit test.
2021-06-23 00:52:35 +03:00
Kubernetes Prow Robot
c864f2357d
Merge pull request #102901 from wangyysde/add-support-imagePullPolicy-fix524
kubeadm: add support of imagePullPolicy to kubeadm
2021-06-22 07:43:59 -07:00
Kubernetes Prow Robot
e78e692f33
Merge pull request #101449 from CaoDonghui123/fix5
kubeadm: allow passing the flag --log-file if --config is passed
2021-06-21 20:43:57 -07:00
caodonghui
25f479c2ac fix'--log-file only works if --logtostderr=false' 2021-06-22 09:32:26 +08:00
Kubernetes Prow Robot
cfa0130b9f
Merge pull request #102466 from pacoxu/dns-1.8.4
kubeadm: update coredns to 1.8.4
2021-06-21 18:14:10 -07:00
wangyysde
459fe7d08a add support of imagePullPolicy to kubeadm
Signed-off-by: wangyysde <net_use@bzhy.com>
2021-06-22 07:13:25 +08:00