Commit Graph

64 Commits

Author SHA1 Message Date
demoManito
35c26f48e4 fix: map and slice create style 2022-09-07 17:10:13 +08:00
Abirdcfly
00b9ead02c cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-14 11:25:19 +08:00
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
Paco Xu
79ecd60208 bugfix(kubeadm): Fix UT and log optmize 2022-03-03 19:09:26 +08:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08: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
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
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
Lubomir I. Ivanov
0bdfe05cf2 kubeadm: remove ClusterConfiguration.DNS.Type from v1beta3
Kubeadm no longer supports kube-dns and CoreDNS is the only
supported DNS server. Remove ClusterConfiguration.DNS.Type
from v1beta3 that is used to set the DNS server type.
2021-05-11 01:31:01 +03:00
Sandeep Rajan
b8a1bd6a6c remove the deprecated kube-dns as an option in kubeadm 2021-03-04 12:12:54 -05:00
Rostislav M. Georgiev
c8b7e5739c kubeadm: Use image tag as version of stacked etcd
kubeadm uses image tags (such as `v3.4.3-0`) to specify the version of
etcd. However, the upgrade code in kubeadm uses the etcd client API to
fetch the currently deployed version. The result contains only the etcd
version without the additional information (such as image revision) that
is normally found in the tag. As a result it would refuse an upgrade
where the etcd versions match and the only difference is the image
revision number (`v3.4.3-0` to `v3.4.3-1`).

To fix the above issue, the following changes are done:
- Replace the existing etcd version querying code, that uses the etcd
  client library, with code that returns the etcd image tag from the
  local static pod manifest file.
- If an etcd `imageTag` is specified in the ClusterConfiguration during
  upgrade, use that tag instead. This is done regardless if the tag was
  specified in the configuration stored in the cluster or with a new
  configuration supplied by the `--config` command line parameter.
  If no custom tag is specified, kubeadm will select one depending on
  the desired Kubernetes version.
- `kubeadm upgrade plan` no longer prints upgrade information about
  external etcd. It's the user's responsibility to manage it in that
  case.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2020-03-30 16:28:45 +03:00
fabriziopandini
2ab2fc8cae make test pass 2019-10-02 12:10:58 +02:00
Ted Yu
2167321adb Remove Client#ClusterAvailable from interface 2019-08-29 07:40:34 -07:00
Yassine TIJANI
309ea4e802 consolidate coreDNS version to ease dependency bump
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-07-03 16:02:13 +02:00
Lubomir I. Ivanov
a49bc480b9 kubeadm: revert CoreDNS to 1.3.1 2019-05-30 23:31:54 +03:00
Sandeep Rajan
0b28419412 bump coredns version to 1.5.0 and update manifest 2019-05-17 10:03:02 -04: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
Yago Nobre
59d2f13850
Bump minimum kubeadm supported version to v1.12 2019-03-05 23:45:17 -03:00
pytimer
83f5296a14 kubeadm: Remove etcd member from the etcd cluster when reset the control plane node 2019-02-22 09:13:01 +08:00
Sandeep Rajan
aa11f6c298 Bump CoreDNS version to 1.3.1 2019-01-31 16:55:02 -05:00
Ed Bartosh
442098bdec kubeadm: use t.Run in selfhosting and update phases
Used T.Run API for kubeadm tests in app/phases/selfhosting and
app/phases/update directories

This should improve testing output and make it more visible
which test is doing what.
2019-01-03 19:23:54 +02:00
Ed Bartosh
b40018da7b kubeadm: simplify minimum Kubernetes version bumps
Replaced hardcoded "v0.12.0" strings with MinimumControlPlaneVersion and
MinimumKubeletVersion global variables.

This should help with a regular release version bumps.
2018-12-19 20:41:25 +02:00
yuexiao-wang
39f71245b3 kubeadm: fixed cleanup upgrade from no-TLS etcd to TLS etcd
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2018-12-08 08:38:03 +08:00
yuexiao-wang
5610ac3c9c cleanup upgrade from non-TLS etcd to TLS etcd
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2018-12-05 23:10:13 +08:00
fabriziopandini
6759334f6e add DNS struct to kubeadm config 2018-11-10 17:27:39 +01:00
Jason DeTiberus
30048e2e6a
[kubeadm] Update CoreDNS Version
Resolves an issue that has been seen with ExternalName services not resolving.
2018-11-08 08:55:48 -05:00
Yago Nobre
cc670e29a1
Fix typos on cmd/kubeadm/app/cmd 2018-10-31 16:32:02 -03:00
yuexiao-wang
cc303c8774 [kubeadm/app/]switch to github.com/pkg/errors
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2018-10-30 16:23:24 +08:00
fabriziopandini
d30492ee8f kubeadm graduate kubelet-start phase 2018-10-27 18:04:33 +02:00
Chris O'Haver
0cfb4bbe2c make coredns kubeup default, update manifest 2018-10-18 14:52:38 -04:00
Benjamin Elder
8b56eb8588 hack/update-gofmt.sh 2018-09-24 12:21:29 -07:00
Benjamin Elder
088cf3c37b find & replace version import 2018-09-24 12:03:24 -07:00
Zihong Zheng
576d6e5c92 Bump kube-dns to 1.14.13
- Update Alpine base image to 3.8.1.
- Build multi-arch images correctly.
2018-09-20 12:36:02 -07:00
Pavithra Ramesh
216dc8ada8 Update kube-dns container images.
This fixes an issue where SRV records were incorrectly being compressed.
Also updated kubedns version for kubeadm
Upgrade to 1.14.12 with manifest support. Runs dnsmasq version 2.78
2018-09-18 17:44:42 -07:00
Timothy St. Clair
ad2ed0e7df Update default etcd server to 3.2.24 for kubernetes 1.12
Signed-off-by: Timothy St. Clair <timothysc@gmail.com>
2018-09-06 10:24:57 -05:00
Sandeep Rajan
989f6667d2 prep for 1.12 2018-08-30 11:43:36 -04:00
Sandeep Rajan
8d8b47596e update manifest
fix test
2018-05-24 09:02:16 -04:00
Di Xu
bde4fdf258 uses a more resilient way to get branch name from version 2018-05-18 21:32:23 +08:00
Di Xu
c3fad6ec12 fix error tests due to version bumping of etcd and supported k8s 2018-05-17 20:49:12 +08:00
Jason DeTiberus
08ba47b237
kubeadm - set CoreDNS FeatureGate to true by default 2018-05-15 14:00:00 -04:00
Jason DeTiberus
f40b7f389e
kubeadm - fix external etcd upgrades
- Update upgrade plan output when configured for external etcd
  - Move etcd to a separate section and show available upgrades
2018-05-14 20:51:20 -04:00
Craig Tracey
ac1e940c75
Support kubeadm upgrade with remote etcd cluster
Currently kubeadm only performs an upgrade if the etcd cluster is
colocated with the control plane node. As this is only one possible
configuration, kubeadm should support upgrades with etcd clusters
that are not local to the node.

Signed-off-by: Craig Tracey <craigtracey@gmail.com>
2018-05-14 20:40:57 -04:00
Chuck Ha
fb5fe04a1e
Enable bypassing online checks in kubeadm upgrade plan
`kubeadm upgrade plan <version>` is now supported. If no
version is supplied then the original behavior remains.

If a version is supplied there will be no pause when figuring out
versions. Kubeadm will assume the version you pass in is the latest
stable version.

Signed-off-by: Chuck Ha <ha.chuck@gmail.com>
2018-04-26 15:05:46 +01:00
Kubernetes Submit Queue
67870dac16
Merge pull request #62655 from stealthybox/TLSUpgrade_+_detiber-kubeadm_hash
Automatic merge from submit-queue (batch tested with PRs 62655, 61711, 59122, 62853, 62390). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Modify the kubeadm upgrade DAG for the TLS Upgrade

**What this PR does / why we need it**:
This adds the necessary utilities to detect Etcd TLS on static pods from the file system and query Etcd.
It modifies the upgrade logic to make it support the APIServer downtime.
Tests are included and should be passing.

```bash 
bazel test //cmd/kubeadm/... \
  && bazel build //cmd/kubeadm --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \
  && issue=TLSUpgrade ~/Repos/vagrant-kubeadm-testing/copy_kubeadm_bin.sh
```
These cases are working consistently for me
```bash
kubeadm-1.9.6 reset \
  && kubeadm-1.9.6 init --kubernetes-version 1.9.1 \
  && kubectl apply -f https://git.io/weave-kube-1.6
/vagrant/bin/TLSUpgrade_kubeadm upgrade apply 1.9.6  # non-TLS to TLS
/vagrant/bin/TLSUpgrade_kubeadm upgrade apply 1.10.0 # TLS to TLS
/vagrant/bin/TLSUpgrade_kubeadm upgrade apply 1.10.1 # TLS to TLS
/vagrant/bin/TLSUpgrade_kubeadm upgrade apply 1.9.1  # TLS to TLS /w major version downgrade
```

This branch is based on top of #61942, as resolving the hash race condition is necessary for consistent behavior.
It looks to fit in pretty well with @craigtracey's PR: #62141
The interfaces are pretty similar

/assign @detiber @timothysc

**Which issue(s) this PR fixes**
Helps with https://github.com/kubernetes/kubeadm/issues/740

**Special notes for your reviewer**:

278b322a1c
   [kubeadm] Implement ReadStaticPodFromDisk

c74b56372d
   Implement etcdutils with Cluster.HasTLS()

   - Test HasTLS()
   - Instrument throughout upgrade plan and apply
   - Update plan_test and apply_test to use new fake Cluster interfaces
   - Add descriptions to upgrade range test
   - Support KubernetesDir and EtcdDataDir in upgrade tests
   - Cover etcdUpgrade in upgrade tests
   - Cover upcoming TLSUpgrade in upgrade tests

8d8e5fe33b
   Update test-case, fix nil-pointer bug, and improve error message

97117fa873
   Modify the kubeadm upgrade DAG for the TLS Upgrade

   - Calculate `beforePodHashMap` before the etcd upgrade in anticipation of
   KubeAPIServer downtime
   - Detect if pre-upgrade etcd static pod cluster `HasTLS()==false` to switch
   on the Etcd TLS Upgrade if TLS Upgrade:
      - Skip L7 Etcd check (could implement a waiter for this)
      - Skip data rollback on etcd upgrade failure due to lack of L7 check
    (APIServer is already down unable to serve new requests)
      - On APIServer upgrade failure, also rollback the etcd manifest to
    maintain protocol compatibility

   - Add logging

**Release note**:
```release-note
kubeadm upgrade no longer races leading to unexpected upgrade behavior on pod restarts
kubeadm upgrade now successfully upgrades etcd and the controlplane to use TLS
kubeadm upgrade now supports external etcd setups
kubeadm upgrade can now rollback and restore etcd after an upgrade failure
```
2018-04-24 13:28:13 -07:00
Jason DeTiberus
4c768bb2ca [kubeadm] Add etcd L7 check on upgrade
- Adds L7 check for kubeadm etcd static pod upgrade
2018-04-24 09:56:35 -06:00
leigh schrandt
99a1143676 [kubeadm] Implement etcdutils with Cluster.HasTLS()
- Test HasTLS()
- Instrument throughout upgrade plan and apply
- Update plan_test and apply_test to use new fake Cluster interfaces
- Add descriptions to upgrade range test
- Support KubernetesDir and EtcdDataDir in upgrade tests
- Cover etcdUpgrade in upgrade tests
- Cover upcoming TLSUpgrade in upgrade tests
2018-04-24 09:55:51 -06:00
Chuck Ha
3cbb283306
Bump kube-dns version for kubeadm upgrade
Signed-off-by: Chuck Ha <ha.chuck@gmail.com>
2018-04-23 17:24:34 +01:00
Joe Betz
a795cb61bc Bump etcd default server version to 3.2.18 2018-04-11 21:12:44 -07:00
Zihong Zheng
ce2d2c7dab [kubeadm] Bump kube-dns to 1.14.9 2018-03-29 15:52:17 -07:00