Commit Graph

738 Commits

Author SHA1 Message Date
Louis Jackman
62e314a556
Remove potential Goroutine leak in kubeadm wait.go
There are two writes yet only one read on a non-buffered channel that is
created locally and not passed anywhere else.

Therefore, it could leak one of its two spawned Goroutines if either:
* The provided `f` takes longer than an erroneous result from
  `waiter.WaitForHealthyKubelet`, or;
* The provided `f` completes before an erroneous result from
  `waiter.WaitForHealthyKubelet`.

The fix is to add a one-element buffer so that the channel write happens
for the second Goroutine in these cases, allowing it to finish and freeing
references to the now-buffered channel, letting it to be GC'd.
2019-11-08 21:05:19 +00:00
Kubernetes Prow Robot
ab1b374dd9
Merge pull request #84523 from rajansandeep/skipmigration
Retain CoreDNS corefile when migration fails in kubeadm
2019-11-08 09:00:29 -08:00
Dan Winship
afa0b808f8 Fix apiserver to advertise IPv6 endpoints if bound to IPv6
Also rename utilnet.ChooseBindAddress() to ResolveBindAddress(), to
better describe its functionality.
2019-11-06 11:31:43 -05:00
Sandeep Rajan
16191db353 skip deployment update if migration fails 2019-11-06 10:55:54 -05:00
Kubernetes Prow Robot
529d5dd4b2
Merge pull request #84626 from hwdef/fix-staticcheck1
cmd/kubeadm/app: fix staticcheck warning
2019-11-01 10:21:40 -07:00
hwdef
eae3e3ce8c cmd/kubeadm/app: fix staticcheck warning 2019-11-01 10:39:56 +08:00
Yassine TIJANI
3993c42431 propagate proxy env var to kube-proxy
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-10-30 16:18:43 +01:00
Lubomir I. Ivanov
772e2e4e39 kubeadm-validators: bump the latest validated Docker version to 19.03 2019-10-28 22:24:46 +02:00
Kubernetes Prow Robot
46b33af8ef
Merge pull request #84309 from hypnoglow/remove-test
kubeadm: remove commented test
2019-10-25 13:03:51 -07:00
Wenjia Zhang
660b17d0ae Pin dependencies and update vendors 2019-10-24 14:09:24 -07:00
Wenjia Zhang
9ead9373f3 Resolve uncompatibility from update: etcd CAFile -> TrustedCAFIle 2019-10-24 14:09:24 -07:00
Wenjia Zhang
3b274fad2a Replace github.com/coreos/etcd by go.etcd.io/etcd 2019-10-24 14:09:24 -07:00
Igor Zibarev
c1381282a3 kubeadm: remove commented test
Removes commented test TestInitConfigurationMarshallingFromFile
as requested per https://github.com/kubernetes/kubeadm/issues/1431
2019-10-24 22:58:01 +03:00
Kubernetes Prow Robot
9fa1bc8003
Merge pull request #83422 from yastij/remove-ipallocator
remove ipallocator in favor of k/utils net package
2019-10-22 12:52:13 -07:00
Yassine TIJANI
f984b4c7a2 remove ipallocator in favor of k/utils net package
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-10-22 18:37:13 +02:00
Lubomir I. Ivanov
30db92004a
Revert "kubeadm: enable kubelet certificate rotation on primary CP nodes" 2019-10-16 20:45:55 +03:00
Ed Bartosh
078f7a3537 kubeadm: remove OutputFlagSpecified from PrintFlags
This field is not used in the kubeadm code. It was brought from
cli-runtime where it's used to support complex relationship between
command line parameters, which is not present in kubeadm.
2019-10-10 12:53:05 +03:00
Kubernetes Prow Robot
a7e0b768ee
Merge pull request #78764 from bart0sh/PR0070-kubeadm-structured-output-v2
Structured output for 'kubeadm token list'
2019-10-09 14:50:54 -07:00
Kubernetes Prow Robot
33809f24e6
Merge pull request #83556 from zouyee/kubeadminfo
Complete output of docker info
2019-10-08 20:00:04 -07:00
Kubernetes Prow Robot
0f02a0fadf
Merge pull request #83605 from hwdef/fix-spelling-mistake
cmd: fix spelling mistake
2019-10-08 05:25:24 -07:00
Kubernetes Prow Robot
7a0801e1b8
Merge pull request #83339 from neolit123/1.17-master-cert-rotation
kubeadm: enable kubelet certificate rotation on primary CP nodes
2019-10-08 03:45:11 -07:00
Kubernetes Prow Robot
c4108c9b4a
Merge pull request #83090 from Klaven/rm_validator_errors
Removal of kubernetes error dependencies
2019-10-07 23:35:25 -07:00
hwdef
fea743b783 cmd: fix spelling mistake 2019-10-08 13:15:34 +08:00
Kubernetes Prow Robot
6564b34f9e
Merge pull request #83276 from Klaven/pr_v1beta1_dep
Initial deprecation of kubeadm v1beta1 apis
2019-10-07 22:15:11 -07:00
Lubomir I. Ivanov
2dedfddf81 kubeadm: add means to create Node objects via the API client 2019-10-07 18:41:57 +03:00
zouyee
361f20c874 Complete output of docker info
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-10-07 19:24:15 +08:00
Marek Counts
3a050344d0 Initial deprecation of kubeadm v1beta1 apis 2019-10-06 23:26:12 +00:00
Ted Yu
4a26579335 Show the complete docker info command 2019-10-06 11:26:18 -07:00
fabriziopandini
fd2c678b1c 127.0.0.1-as-advertise-address 2019-10-04 08:41:07 +02:00
Ed Bartosh
3765f21012 Add internal kubeadm output API
Added internal structures and APIs to handle
kubeadm structured output.
2019-10-03 14:13:00 +03:00
Kubernetes Prow Robot
f3981710db
Merge pull request #82473 from Nordix/kubeadm-dualstack-service-ip
Kubeadm DualStack Support for List of Service IPs
2019-10-02 11:26:08 -07:00
Marek Counts
114d7855f3 Removal of kubernetes error dependancies
removed kubernetes error deps
2019-09-28 15:09:48 +00:00
Marek Counts
dfbb6fb6bb replaced logs in validators to be warnings
Originally kubeadm used klot in the validators to log
These logs are converted to warnings and klog was removed.
2019-09-19 12:18:40 +00:00
Han Kang
866ea74326 remove pkg/version and some of redundant copies of it
Change-Id: Ia58367c1b1274bfb49c8a4784051463abaf795de
2019-09-16 16:24:35 -07:00
Arvinderpal Wander
bacc06d8fc kubeadm --service-cluster-ip-range supports a comma seperated list
of service subnets.

Update DNS, Cert, dry-run logic to support list of Service CIDRs.
Added unit tests for GetKubernetesServiceCIDR and updated
GetDNSIP() unit test to inclue dual-sack cases.
2019-09-16 09:33:43 -07:00
Kubernetes Prow Robot
fa3dfa82b0
Merge pull request #82414 from SataQiu/kubeadm-20190906
kubeadm: code clean up about kustomize
2019-09-11 15:27:53 -07:00
Kubernetes Prow Robot
7e060eec79
Merge pull request #81908 from tedyu/etcd-cluster-avail
Remove Client#ClusterAvailable from interface
2019-09-10 17:42:46 -07:00
SataQiu
c53f2f306a kubeadm: code clean up 2019-09-06 18:40:44 +08:00
Rostislav M. Georgiev
31b4c782c7 kubeadm: Fetching kube-proxy's config map is now optional
Whenever kubeadm needs to fetch its configuration from the cluster, it gets
the component configuration of all supported components (currently only kubelet
and kube-proxy). However, kube-proxy is deemed an optional component and its
installation may be skipped (by skipping the addon/kube-proxy phase on init).
When kube-proxy's installation is skipped, its config map is not created and
all kubeadm operations, that fetch the config from the cluster, are bound to
fail with "not found" or "forbidden" (because of missing RBAC rules) errors.

To fix this issue, we have to ignore the 403 and 404 errors, returned on an
attempt to fetch kube-proxy's component config from the cluster.
The `GetFromKubeProxyConfigMap` function now supports returning nil for both
error and object to indicate just such a case.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-09-05 18:25:22 +03:00
Gyuho Lee
93b9545f48 vendor: update with "update-vendor.sh" script
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-29 08:46:02 -07:00
Gyuho Lee
eb1509a1d3 kubeadm/app/util/etcd: : block etcd client creation until connection is up
The new etcd balancer (>3.3.14, 3.4.0) uses an asynchronous resolver for
endpoints. Without "WithBlock", the client may return before the
connection is up.

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-29 08:38:29 -07:00
Ted Yu
2167321adb Remove Client#ClusterAvailable from interface 2019-08-29 07:40:34 -07:00
Kubernetes Prow Robot
b98f622852
Merge pull request #81910 from fabriziopandini/kubeadm-Json6902-Patches
kubeadm: add support for Json6902 Patches
2019-08-28 03:09:54 -07:00
fabriziopandini
0e447d797f kubeadm Json6902 Patches 2019-08-27 14:14:35 +02:00
Kubernetes Prow Robot
2c64627871
Merge pull request #81918 from tedyu/pki-comment
Correct comment in CertOrKeyExist
2019-08-26 10:20:37 -07:00
Ted Yu
55cc0e2957 Correct comment in CertOrKeyExist 2019-08-25 19:30:20 -07:00
Kubernetes Prow Robot
9a5b87a58b
Merge pull request #81821 from hwdef/fix-typo-cmd/kubeadm/app/util/config/initconfiguration.go
fix-typo-cmd/kubeadm/app/util/config/initconfiguration.go
2019-08-23 17:59:30 -07:00
Kubernetes Prow Robot
2d649c347f
Merge pull request #81701 from tedyu/init-cfg-convert
Check error return from Scheme.Convert
2019-08-22 23:27:42 -07:00
SataQiu
7a4cf591ea kubeadm: fix static check failures 2019-08-23 10:51:12 +08:00
hwdef
86dd72f345 fix-typo-cmd/kubeadm/app/util/config/initconfiguration.go 2019-08-23 10:07:07 +08:00
Kubernetes Prow Robot
59f5b3ddc4
Merge pull request #80937 from neolit123/1.16-error-stack-trace
kubeadm: print the stack trace of an error for klog level v>=5
2019-08-22 15:09:18 -07:00
Kubernetes Prow Robot
ca3e86e662
Merge pull request #81623 from neolit123/kernel-validator
kubeadm: support any Linux kernel version newer than 3.10
2019-08-22 11:12:59 -07:00
Lubomir I. Ivanov
2fc19136c1 kubeadm: print the stack trace of an error for klog level v>=5
- replace all stray calls of os.Exit() to util.CheckError() instead
- CheckError() now checks if the klog verbosity level is >=5
and shows a stack trace of the error
- don't call klog.Fatal in version.go
2019-08-22 20:09:54 +03:00
Kubernetes Prow Robot
d54c5163e0
Merge pull request #81458 from fabriziopandini/kubeadm-kustomize-ux
kubeadm: kustomize-ux
2019-08-22 05:46:32 -07:00
Ted Yu
185c0a16ee Check error return from Scheme.Convert 2019-08-20 20:17:14 -07:00
Lubomir I. Ivanov
bec9c3678b kubeadm: support any kernel version newer than 3.10
It seems undesirable that Kubernetes as a system should be
blocking a node if it's Linux kernel is way too new.

If such a problem even occurs we should exclude versions from
the list of supported versions instead of blocking users
from trying e.g. the latest 7.0.0-beta kernel because our
validators are not aware of this new version.
2019-08-21 01:23:53 +03:00
Sadlil Rhythom
3e6d483dd9 Fix Test for kubeadm/app/util/net.GetHostname 2019-08-19 14:38:19 +02:00
Kubernetes Prow Robot
2036ee5dde
Merge pull request #81465 from yanghaichao12/dev190815
remove defaultedInternalConfig from kubeadm
2019-08-16 17:03:06 -07:00
Kubernetes Prow Robot
9e60bedebe
Merge pull request #81385 from neolit123/etcd-probe
kubeadm: use etcd's /health endpoint for it's liveness probe
2019-08-16 14:06:09 -07:00
Lubomir I. Ivanov
99b64f1e8e kubeadm: use etcd's /health endpoint for it's liveness probe
Etcd v3.3.0 added the --listen-metrics-urls flag which allows specifying
addition URLs to the already present /health and /metrics endpoints.

While /health and /metrics are enabled for URLS defined with
--listen-client-urls (v3+ ?) they do require HTTPS.

Replace the present etcdctl based liveness probe with a standard HTTP
GET v1.Probe that connects to http://127.0.0.1:2381/health.

These endpoints are not reachable from the outside and only available
for localhost connections.
2019-08-16 01:06:49 +03:00
yanghaichao12
f54856952f remove defaultedInternalConfig fromr kubeadm
remove defaultedInternalConfig from kubeadm
2019-08-15 17:45:27 +08:00
fabriziopandini
a92e7975d2 kubeadm-kustomize-ux 2019-08-15 09:14:31 +02:00
tariqibrahim
6df4f62d1c [kubernetes/kubeadm] fix minor nil issues in kudeadm code 2019-08-14 21:49:39 -07:00
Kubernetes Prow Robot
c08ee9d51b
Merge pull request #80905 from fabriziopandini/kubeadm-kustomize-core
Kubeadm: kustomize core
2019-08-13 07:55:55 -07:00
fabriziopandini
97181595f0 kubeadm-kustomize-core 2019-08-12 14:16:51 +02:00
SataQiu
2e35c6b5bb kubeadm: the permissions of generated CSR files are changed from 0644 to 0600 2019-08-09 17:36:26 +08:00
Kubernetes Prow Robot
34db8e08c1
Merge pull request #81002 from zgfh/patch-10
kubeadm:  fix name of CA spell error
2019-08-07 03:12:49 -07:00
Kubernetes Prow Robot
b29e187a45
Merge pull request #80992 from dzzg/patch-1
cleanup: fix typo "contstruct" -> "construct"
2019-08-05 23:44:07 -07:00
alan
cd2ecefb80 kubeadm: fix name of CA spell error 2019-08-06 12:01:28 +08:00
dzzg
cd57039927
cleanup: fix typo "contstruct" -> "construct" 2019-08-06 06:22:46 +08:00
Lubomir I. Ivanov
540c272f7b kubeadm: use EnsureCertificateAuthorityIsEmbedded() for file discovery
For file discovery, in case the user feeds a file for the CA
from the kubeconfig, make sure it's preloaded and embedded using
the new function EnsureCertificateAuthorityIsEmbedded().

This commit also applies cleanup:
- unroll validateKubeConfig() into ValidateConfigInfo() as this way
the default cluster can be re-used.
- in ValidateConfigInfo() reuse the variable config instead of creating
a new variable kubeconfig.
- make the Ensure* functions return descriptive errors instead of
wrapping the errors on the side of the callers.
2019-08-05 03:23:41 +03:00
Ed Bartosh
6b21af79c2 kubeadm: simplified returns 2019-08-02 13:01:02 +03:00
fabriziopandini
df08af0349 feedback 1 2019-07-29 10:48:23 +02:00
fabriziopandini
d63e778f6f fix-file-discovery 2019-07-27 19:19:29 +02:00
fabriziopandini
ada6b0ddf1 autogenerated 2019-07-27 15:21:24 +02:00
David Xia
fabfd950b1
cleanup: fix some log and error capitalizations
Part of https://github.com/kubernetes/kubernetes/issues/15863
2019-07-20 18:26:16 -04:00
RainbowMango
a4ca944d53 kubeadm should always fall back to client version when there is any internet issue 2019-07-19 15:13:47 +08:00
Ed Bartosh
d221148121 kubeadm: get rid of dependency on pkg/util/node
Created local copy of GetHostname API to avoid
dependency to pkg/util/node.
2019-07-17 18:49:39 +03:00
SataQiu
298909e20e kubeadm: use local copy of kubectl's version package 2019-07-16 09:51:10 +08:00
Kubernetes Prow Robot
7340b6341a
Merge pull request #79677 from neolit123/etcd-add-retry
kubeadm: run MemberAdd/Remove for etcd clients with exp-backoff retry
2019-07-04 05:44:28 -07:00
Lubomir I. Ivanov
25668531f7 kubeadm: run MemberAdd/Remove for etcd clients with exp-backoff retry
When adding a new etcd member the etcd cluster can enter a state
of vote, where any new members added at the exact same time will
fail with an error right away.

Implement exponential backoff retry around the MemberAdd call.

This solves a kubeadm problem when concurrently joining
control-plane nodes with stacked etcd members.

From experiment, a few retries with milliseconds apart are
sufficient to achieve the concurrent join of a 3xCP cluster.

Apply the same backoff to MemberRemove in case the concurrent
removal of members fails for similar reasons.
2019-07-03 03:26:30 +03:00
Seth Jennings
0c7ce5a7d7 kubelet: add allowed sysctl to KubeletConfiguration 2019-07-02 12:19:47 -05:00
Kubernetes Prow Robot
da0f51ffed
Merge pull request #78820 from haosdent/fix_typos
Fix typos.
2019-07-01 15:09:20 -07:00
Lubomir I. Ivanov
cb56f91cc6 kubeadm: don't use the Docker SDK in util/system/docker_validator*
Instead of creating a Docker client and fetching an Info object
from the docker enpoint, call the "docker info" command
and populate a local dockerInfo struct from JSON output.

Also
- add unit tests.
- update import boss and bazel.

This change affects "test/e2e_node/e2e_node_suite_test.go"
as it consumes this Docker validator by calling
"system.ValidateSpec()".
2019-07-01 15:18:37 +03:00
Yassine TIJANI
d3620dfa29 move jws to k8s.io/cluster-bootstrap
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-06-25 13:48:13 +02:00
Kubernetes Prow Robot
896c901684
Merge pull request #78929 from SataQiu/fix-kubeadm-20190612
[kubeadm] cleanup deps on pkg/version
2019-06-24 19:28:35 -07:00
Kubernetes Prow Robot
d1f342fb59
Merge pull request #79220 from rosti/fix-MarshalClusterConfigurationToBytes
kubeadm: Retire MarshalClusterConfigurationToBytes
2019-06-24 08:01:58 -07:00
Kubernetes Prow Robot
bc8ea43277
Merge pull request #78026 from Klaven/norm_kube_version
seperation of network call in KubernetesReleaseVersion
2019-06-24 06:27:57 -07:00
Rostislav M. Georgiev
94c56c81ba kubeadm: Retire MarshalClusterConfigurationToBytes
MarshalClusterConfigurationToBytes has capabilities to output the component
configs, as separate YAML documents, besides the kubeadm ClusterConfiguration
kind. This is no longer necessary for the following reasons:

- All current use cases of this function require only the ClusterConfiguration.
- It will output component configs only if they are not the default ones. This
  can produce undeterministic output and, thus, cause potential problems.
- There are only hacky ways to dump the ClusterConfiguration only (without the
  component configs).

Hence, we simplify things by replacing the function with direct calls to the
underlaying MarshalToYamlForCodecs. Thus marshalling only ClusterConfiguration,
when needed.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-06-24 15:17:19 +03:00
Kubernetes Prow Robot
eee3e976d8
Merge pull request #78294 from vllry/kp-remove-resource-container
Remove deprecated flag --resource-container from kube-proxy
2019-06-22 00:38:12 -07:00
Marek Counts
eb6eb11748 added comment 2019-06-21 09:42:34 -04:00
Marek Counts
b66c4e8d45 updates based off reviews 2019-06-21 09:42:34 -04:00
Marek Counts
bf376e863c update to remove unused test
commit will be squashed before merge
2019-06-21 09:42:33 -04:00
Marek Counts
c8045049f3 updated tests to prevent false positive
one test also proved it did not call the internet
but this was not fool proof as it did not return a string
and thus could be called with something expecting to fail.
2019-06-21 09:42:33 -04:00
Marek Counts
aad2b573c6 seperation of network calls when getting version
updated the network calls to be package local so tests could pass their
own implementation. A public interface was not provided as it would not
be likely this would ever be needed or wanted.
2019-06-21 09:42:33 -04:00
SataQiu
10ddd7caf0 kubeadm: cleanup deps on pkg/version 2019-06-18 11:01:30 +08:00
Yassine TIJANI
c3904bbce6 move initsystem to kubeadm
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-06-17 12:21:01 +02:00
Vallery Lancey
dc0f14312e Removed deprecated --resource-container flag from kube-proxy. 2019-06-16 08:36:42 -07:00
Rafael Fernández López
26c9965a97
kubeadm: Add ability to retry ConfigMap get if certain errors happen
During the control plane joins, sometimes the control plane returns an
expected error when trying to download the `kubeadm-config` ConfigMap.
This is a workaround for this issue until the root cause is completely
identified and fixed.

Ideally, this commit should be reverted in the near future.
2019-06-12 17:49:27 +02:00
Haosdent Huang
7ce6e71891 Fix typos. 2019-06-11 01:52:14 +08:00
Ricardo Pchevuzinske Katz
82c42bb6ee Remove deprecated flag --conntrack-max from kube-proxy 2019-06-01 18:10:28 -03:00
Rostislav M. Georgiev
5671ea9cf1 kubeadm: Remove ClusterConfiguration from InitConfiguration in v1beta2
Ever since v1alpha3, InitConfiguration is containing ClusterConfiguration
embedded in it. This was done to mimic the internal InitConfiguration, which in
turn is used throughout the kubeadm code base as if it is the old
MasterConfiguration of v1alpha2.

This, however, is confusing to users who vendor in kubeadm as the embedded
ClusterConfiguration inside InitConfiguration is not marshalled to YAML.
For this to happen, special care must be taken for the ClusterConfiguration
field to marshalled separately.

Thus, to make things smooth for users and to reduce third party exposure to
technical debt, this change removes ClusterConfiguration embedding from
InitConfiguration.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-05-29 12:13:37 +03:00
Kubernetes Prow Robot
2f7eaa1ee3
Merge pull request #78053 from ksubrmnn/crisocket
Implement CRI detection for Windows
2019-05-28 07:17:58 -07:00
ksubrmnn
310bafe658 Implement CRI detection for Windows 2019-05-23 09:54:53 -07:00
Marc Carré
e706d27262
kubeadm errors now ignorable via v1beta2 config files
Specifically, IgnorePreflightErrors in {Init,Join}Configuration's NodeRegistrationOptions can be used to achieve this.
See also: https://docs.google.com/document/d/1XnP67oO1i9VcDIpw42IzptnJsc5OQM-HTf8cVcjCR2w/edit
2019-05-23 16:22:17 +09:00
fabriziopandini
919826531c certs-expiration 2019-05-18 16:28:33 +02:00
Daniel (Shijun) Qian
5268f69405 fix duplicated imports of k8s code (#77484)
* fix duplicated imports of api/core/v1

* fix duplicated imports of client-go/kubernetes

* fix duplicated imports of rest code

* change import name to more reasonable
2019-05-08 10:12:47 -07:00
Kubernetes Prow Robot
0a83ed51b4
Merge pull request #77345 from rosti/omitempty-v1beta2
kubeadm: Fix omitempty in v1beta2
2019-05-04 12:13:37 -07:00
Kubernetes Prow Robot
f29138c372
Merge pull request #77012 from rosti/certkey-v1beta2
kubeadm: Add certificateKey field to v1beta2 config
2019-05-03 15:11:39 -07:00
Rostislav M. Georgiev
81e3adc53b kubeadm: Fix omitempty in v1beta2
There are a couple of problems with regards to the `omitempty` in v1beta1:

- It is not applied to certain fields. This makes emitting YAML configuration
  files in v1beta1 config format verbose by both kubeadm and third party Go
  lang tools. Certain fields, that were never given an explicit value would
  show up in the marshalled YAML document. This can cause confusion and even
  misconfiguration.

- It can be used in inappropriate places. In this case it's used for fields,
  that need to be always serialized. The only one such field at the moment is
  `NodeRegistrationOptions.Taints`. If the `Taints` field is nil, then it's
  defaulted to a slice containing a single control plane node taint. If it's
  an empty slice, no taints are applied, thus, the cluster behaves differently.
  With that in mind, a Go program, that uses v1beta1 with `omitempty` on the
  `Taints` field has no way to specify an explicit empty slice of taints, as
  this would get lost after marshalling to YAML.

To fix these issues the following is done in this change:

- A whole bunch of additional omitemptys are placed at many fields in v1beta2.
- `omitempty` is removed from `NodeRegistrationOptions.Taints`
- A test, that verifies the ability to specify empty slice value for `Taints`
  is included.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-05-03 12:59:41 +03:00
Rostislav M. Georgiev
1826e445fe kubeadm: Add certificateKey field to v1beta2 config
This change introduces config fields to the v1beta2 format, that allow
certificate key to be specified in the config file. This certificate key is a
hex encoded AES key, that is used to encrypt certificates and keys, needed for
secondary control plane nodes to join. The same key is used for the decryption
during control plane join.
It is important to note, that this key is never uploaded to the cluster. It can
only be specified on either command line or the config file.
The new fields can be used like so:

---
apiVersion: kubeadm.k8s.io/v1beta2
kind: InitConfiguration
certificateKey: "yourSecretHere"
---
apiVersion: kubeadm.k8s.io/v1beta2
kind: JoinConfiguration
controlPlane:
  certificateKey: "yourSecretHere"
---

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-05-02 11:47:07 +03:00
Àbéjídé Àyodélé
a2b0cb62a1 Clean up kubeadm.
These are based on recommendation from
[staticcheck](http://staticcheck.io/).

- Remove unused struct fields
- Remove unused function
- Remove unused variables
- Remove unused constants.
- Miscellaneous cleanups
2019-05-01 22:16:06 +00:00
Kubernetes Prow Robot
b5d9aa58e3
Merge pull request #77218 from neolit123/chroot-fix-flakes
kubeadm: remove flaky unit tests for chroot
2019-04-29 14:36:26 -07:00
Kubernetes Prow Robot
35b278447c
Merge pull request #76920 from sempr/master
MOD: support wildcard DNS for apiserver certSANs
2019-04-29 14:36:01 -07:00
Lubomir I. Ivanov
96e907348a kubeadm: remove flaky unit tests for chroot
This unit test contains some hacks are causing the bazel-test
e2e job to flake very often. Instead of maintaining this
unit test remove it completely. It has little benefits
WRT testing app/util/chroot*.go.
2019-04-29 20:49:09 +03:00
Chen Zhiwei
79c436f48f use new method to detect cgroup driver 2019-04-27 08:39:18 +00:00
Kubernetes Prow Robot
3148eb750d
Merge pull request #76390 from rojkov/ecdsa-v2
kubeadm: add support for ECDSA keys
2019-04-26 19:56:23 -07:00
Kubernetes Prow Robot
332d62a94a
Merge pull request #76710 from rosti/introduce-v1beta2
kubeadm: Introduce v1beta2 config
2019-04-26 10:38:27 -07:00
Rostislav M. Georgiev
9e1ac76c1a kubeadm: Introduce v1beta2 config
Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-04-25 17:10:04 +03:00
Chen Zhiwei
d4aaacfc18 Bump minimum docker version to 1.13.1 in kubeadm 2019-04-25 13:57:50 +00:00
Dmitry Rozhkov
d125f3bddc kubeadm: add support for ECDSA keys
kubeadm still generates RSA keys when deploying a node, but also
accepts ECDSA keys if they already exist pregenerated in the
directory specified in --cert-dir.
2019-04-25 12:52:42 +03:00
Kubernetes Prow Robot
36ccff1b27
Merge pull request #76821 from ereslibre/kubeadm-config-retry-on-conflict
kubeadm: improve resiliency when conflicts arise when updating the kubeadm-config configmap
2019-04-23 15:50:01 -07:00
Kubernetes Prow Robot
44f254d55e
Merge pull request #76922 from xichengliudui/small-bug
Fix two minor bugs in kubeadm
2019-04-23 07:53:35 -07:00
Kubernetes Prow Robot
0f617a3825
Merge pull request #76500 from rojkov/issue-1399
kubeadm: check all available CA certs against pinned certs
2019-04-23 07:52:21 -07:00
Rafael Fernández López
bc8bafd825
kubeadm: improve resiliency when conflicts arise when updating the kubeadm-config ConfigMap
Add the functionality to support `CreateOrMutateConfigMap` and `MutateConfigMap`.

* `CreateOrMutateConfigMap` will try to create a given ConfigMap object; if this ConfigMap
  already exists, a new version of the resource will be retrieved from the server and a
  mutator callback will be called on it. Then, an `Update` of the mutated object will be
  performed. If there's a conflict during this `Update` operation, retry until no conflict
  happens. On every retry the object is refreshed from the server to the latest version.

* `MutateConfigMap` will try to get the latest version of the ConfigMap from the server,
  call the mutator callback and then try to `Update` the mutated object. If there's a
  conflict during this `Update` operation, retry until no conflict happens. On every retry
  the object is refreshed from the server to the latest version.

Add unit tests for `MutateConfigMap`

* One test checks that in case of no conflicts, the update of the
  given ConfigMap happens without any issues.

* Another test mimics 5 consecutive CONFLICT responses when updating
  the given ConfigMap, whereas the sixth try it will work.
2019-04-23 15:40:37 +02:00
Sempr
0c7d8722bf MOD: support Wildcard DNS for apiserver certSANs 2019-04-23 10:47:45 +08:00
aaa
a5b88f69e9 Fix two minor bugs in kubeadm 2019-04-20 06:42:36 -04:00
Dmitry Rozhkov
580513ed66 kubeadm: drop duplicate function NewCACertAndKey
The function certs.NewCACertAndKey() is just a wrapper around
pkiutil.NewCertificateAuthority() which doesn't add any
additional functionality.

Instead use pkiutil.NewCertificateAuthority() directly.
2019-04-19 19:17:34 +03:00
Dmitry Rozhkov
7f8fc5d189 kubeadm: check all available CA certs against pinned certs
Currently kubeadm produces an error upon parsing multiple
certificates stored in the cluster-info configmap. Yet it
should check all available certificates in a scenario like
CA key rotation.

Check all available CA certs against pinned certificate hashes.

Fixes https://github.com/kubernetes/kubeadm/issues/1399
2019-04-15 15:08:06 +03:00
Kubernetes Prow Robot
299aa5d7a6
Merge pull request #76505 from rosti/fix-join-cri-detection
kubeadm: Don't error out on join with --cri-socket override
2019-04-14 14:30:00 -07:00
Rostislav M. Georgiev
2d4307db9f kubeadm: Don't error out on join with --cri-socket override
In the case where newControlPlane is true we don't go through
getNodeRegistration() and initcfg.NodeRegistration.CRISocket is empty.
This forces DetectCRISocket() to be called later on, and if there is more than
one CRI installed on the system, it will error out, while asking for the user
to provide an override for the CRI socket. Even if the user provides an
override, the call to DetectCRISocket() can happen too early and thus ignore it
(while still erroring out).
However, if newControlPlane == true, initcfg.NodeRegistration is not used at
all and it's overwritten later on.
Thus it's necessary to supply some default value, that will avoid the call to
DetectCRISocket() and as initcfg.NodeRegistration is discarded, setting
whatever value here is harmless.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-04-12 17:25:11 +03:00
aaa
980de9d38b Use fmt.printf() to end with a newline
update pull request
2019-04-10 03:27:25 -04:00
leigh capili
47e52d2981 Refactor loops over SupportedMediaTypes() where mediaType is used to match a single SerializerInfo{}
We have an existing helper function for this:  runtime.SerializerInfoForMediaType()

This is common prep-work for encoding runtime.Objects into JSON/YAML for transmission over the wire or writing to ComponentConfigs.
2019-04-04 19:01:01 -06:00
qingsenLi
1350446417 fix some spelling error 2019-04-04 00:07:19 +08:00
PingWang
38fe68658d Extract Method for kubeadm
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2019-04-02 18:45:30 +08:00
SataQiu
a41c85ea07 fix golint failures in cmd/kubeadm/app/util/system 2019-03-29 12:03:25 +08:00
Kubernetes Prow Robot
5a6c66a729
Merge pull request #72454 from rojkov/kubeadm-fallback-version
kubeadm: add final fallback to constants.CurrentKubernetesVersion
2019-03-27 11:02:50 -07:00
Kubernetes Prow Robot
9c53f24012
Merge pull request #75179 from rosti/kill-v1alpha3
kubeadm: remove v1alpha3
2019-03-22 17:02:21 -07:00
Kubernetes Prow Robot
5e90834abe
Merge pull request #75102 from qingsenLi/k8s190307-fix-typo
fix a typo
2019-03-20 00:54:23 -07:00
Jordan Liggitt
f2a0c0342c Revert "Revert kubelet to default to ttl cache secret/configmap behavior"
This reverts commit cd1c9f9018.
2019-03-13 15:12:26 -07:00
Rostislav M. Georgiev
36783eb88b kubeadm: remove v1alpha3
Remove deprecated old v1alpha3 kubeadm config.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-03-08 14:54:51 +02:00
qingsenLi
55d34ac97e fix a typo 2019-03-08 04:05:49 +08:00
Marek Counts
a9eea0a353 kubeadm-reset: add means to clear the ClusterStatus
Add ResetClusterStatusForNode() that clears a certain
control-plane node's APIEndpoint from the ClusterStatus
key in the kubeadm ConfigMap on "kubeadm reset".
2019-03-07 04:03:19 +02:00
Lubomir I. Ivanov
6f6b364b9c kubeadm: update output of init, join reset commands
- move most unrelated to phases output to klog.V(1)
- rename some prefixes for consistency - e.g.
[kubelet] -> [kubelet-start]
- control-plane-prepare: print details for each generated CP
component manifest.
- uppercase the info text for all "[reset].." lines
- modify the text for one line in reset
2019-03-06 03:17:35 +02:00
Kubernetes Prow Robot
d8d260a09d
Merge pull request #74755 from liggitt/kubelet-watch
Revert kubelet to default to ttl cache secret/configmap behavior
2019-03-01 19:14:14 -08:00
fabriziopandini
d0d843c588 fix-go-vet-1.12 2019-03-01 15:13:17 +01:00
Jordan Liggitt
cd1c9f9018 Revert kubelet to default to ttl cache secret/configmap behavior 2019-02-28 17:54:22 -05:00
Kubernetes Prow Robot
e64336e94b
Merge pull request #74590 from vanduc95/cleanup-kubeadm-cont.6-20190226
kubeadm cleanup: master -> control-plane (cont.6)
2019-02-26 15:30:03 -08:00
Jordan Liggitt
d1e865ee34 Update client callers to use explicit versions 2019-02-26 08:36:30 -05:00
vanduc95
3759fcd4c8 kubeadm cleanup: master -> control-plane (cont.6) 2019-02-26 18:42:27 +07:00