Commit Graph

23 Commits

Author SHA1 Message Date
Peeyush Gupta
49884bca30 Fixing regex for kubernetes version in kubeadm 2019-12-30 21:12:24 +05:30
RainbowMango
a4ca944d53 kubeadm should always fall back to client version when there is any internet issue 2019-07-19 15:13:47 +08: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
Ed Bartosh
47b4d8fc81 kubeadm: use T.Run API in app/util
Used T.Run API for kubeadm tests in app/util/
2018-12-29 18:27:38 +02:00
Dmitry Rozhkov
b9c2139ccc kubeadm: refactor validateStableVersion()
Currently the function `cmd/kubeadm/app/util.validateStableVersion()`
doesn't validate remote versions in the special case when the client
version is empty. This makes the code more difficult to reason about,
because the function may successfully return a string which isn't a valid version.

Move handling the special case outside of the function to the place
where its meaning is more obvious.
2018-12-17 17:05:41 +02:00
Dmitry Rozhkov
4b6d91c2c3 kubeadm: print stack trace in case of unexpected error 2018-12-14 12:23:54 +02:00
Lubomir I. Ivanov
505413581e kubeadm: handle stable-1 as the default version
The default version in kubeadm is now `stable-1`. This will
pull a version from the `stable-1.txt` endpoint which might
end up being newer than the version of the client by a magnitude
of MINOR or even a MAJOR release.

To be able to prevent this scenario add the new helper function:
validateStableVersion()

This function determines if the remote version is newer than the
local client version and if that's the case it returns `stable-X.xx`
that conforms with the version of the client. If not it returns
the remote version.
2018-10-05 00:02:57 +03:00
Lubomir I. Ivanov
682b1b3d45 kubeadm: fix the air-gapped and offline support issues
1) Do not fail in case a bind address cannot be obtained

If netutil.ChooseBindAddress() fails looking up IP route tables
it will fail with an error in which case the kubeadm config
code will hard stop.

This scenario is possible if the Linux user intentionally disables
the WiFi from the distribution settings. In such a case the distro
could empty files such files as /proc/net/route and ChooseBindAddress()
will return an error.

For improved offline support, don't error on such scenarios but instead
show a warning. This is done by using the NoRoutesError type.
Also default the address to 0.0.0.0.

While doing that, prevent some commands like `init`, `join` and also
phases like `controlplane` and `certs` from using such an invalid
address.

Add unit tests for the new function for address verification.

2) Fallback to local client version

If there is no internet, label versions fail and this breaks
air-gapped setups unless the users pass an explicit version.

To work around that:
- Remain using 'release/stable-x.xx' as the default version.
- On timeout or any error different from status 404 return error
- On status 404 fallback to using the version of the client via
kubeadmVersion()

Add unit tests for kubeadmVersion().

Co-authored-by: Alexander Kanevskiy <alexander.kanevskiy@intel.com>
2018-08-27 23:03:31 +03:00
Davanum Srinivas
ff26e57ba6 Improve where we load builds from for kubeadm upgrade jobs
We should stop special casing "ci-cross" and just use the
configuration in test-infra to dictate where we pick up
the builds from.

For 1.8,1.9,1.10 branches, we need to load the latest
version from ci/latest*.txt.

For master, 1.11 etc, we need to load from ci-cross/latest*.txt.

We need to update test-infra configs if things fail.

try these to verify:
```
gsutil cat gs://kubernetes-release-dev/ci/latest-1.9.txt
gsutil cat gs://kubernetes-release-dev/ci-cross/latest.txt
```
2018-05-09 12:11:41 -04:00
cheyang
4ca3903eab fix typo in kubeadm
Signed-off-by: cheyang <cheyang@163.com>
2018-02-06 13:48:18 +08:00
Alexander Kanevskiy
09e59cfcaf Allow to use version labels in kubeadm upgrade apply
kubeadm upgrade apply now is able to utilize all possible combinations
of version argument, including labels (latest, stable-1.8, ci/latest-1.9)
as well as specific builds (v1.8.0-rc.1, ci/v1.9.0-alpha.1.123_01234567889)

As side effect, specifying exact build to deploy from CI area is now also
possible in kubeadm init command.

Fixes: kubernetes/kubeadm#451
2017-09-26 22:27:58 +03:00
Serguei Bezverkhi
42bd500134 kubeadm golint clean up
Closes #375
2017-09-23 08:07:55 -04:00
Alexander Kanevskiy
2312920cbc Implemented support for using images from CI builds
Implements kubernetes/kubeadm#337
2017-08-18 17:02:18 +03:00
Alexander Kanevskiy
5a4d560e5f Make sure that image tags contain only allowed characters.
Version strings can contain symbols that are not allowed
as part of image tags. Replace those with underscores.
2017-07-17 23:52:17 +03:00
Alexander Kanevskiy
d8fcf4fcd7 Allows to use versions like 1.6.4 instead v1.6.4
As part of issue kubernetes/kubeadm#292 discussion, it
turned out that for users it is not always obvious that
version specification parameter must be in form "vX.Y.Z".
This patch allows to specify it in form "X.Y.Z" and
converts it internally to normal semantic version which
expected in the rest of the code.
2017-07-06 14:15:26 +03:00
Lucas Käldström
051db16083
kubeadm: Cleanup version gates for the Node Authorizer when targeting v1.8 2017-06-24 19:21:41 +03:00
Lucas Käldström
473bb9c1c9
kubeadm: Fix subtle versioning ordering issue 2017-06-14 22:35:50 +03:00
bruceauyeung
8537aa4a99 fix nil check and typos 2016-12-29 18:00:28 +08:00
bruceauyeung
02c1814113 remove unnecessary path.Join
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-17 11:57:00 +08:00
Alexander Kanevskiy
39f55cb4df Added test case for KubernetesReleaseVersion 2016-11-30 18:00:29 +02:00