Commit Graph

578 Commits (20fa30e4b5a2566cfd989421c5b8c15a79cfe91d)

Author SHA1 Message Date
Derek McQuay 63327647a5
kubeadm: added tests for preflight checks
increased coverage from ~9% to ~71%
2017-02-08 17:38:14 -08:00
xilabao efa6afdad0 replace update to patch in setupmaster.go 2017-02-09 09:37:37 +08:00
Kubernetes Submit Queue e283d21cb8 Merge pull request #40873 from liggitt/bootstrap-get-node
Automatic merge from submit-queue

Remove 'get node' call during bootstrapping

Kubelet bootstrapping should have minimal permissions until it obtains an approved client certificate.

@luxas PTAL

/cc @mikedanese @cjcullen https://github.com/kubernetes/kubernetes/pull/40760#issuecomment-276832957
2017-02-08 14:14:28 -08:00
Derek McQuay 3fc181fb1b
kubeadm: moved to location after SIG discussion 2017-02-08 11:31:55 -08:00
Derek McQuay 8e9f6ece8d kubeadm: adding integration tests for init
removed two tests cases that tested for success because they require
waiting for the control plan to get ready
2017-02-08 10:11:18 -08:00
Kubernetes Submit Queue a326735ea0 Merge pull request #40175 from apprenda/kubeadm-40155-test-skip
Automatic merge from submit-queue (batch tested with PRs 40175, 41107, 41111, 40893, 40919)

kubeadm: skip integration tests if kubeadm-cmd-skip flag passed

Will skip integration tests for token generation if it can't find a file by the given --kubeadm-path or default value.

**What this PR does / why we need it**: Tests would fail if just running `go test` in the dir because it expects to have more values. This won't change the behavior of `make test-cmd` which gets run here:
https://github.com/kubernetes/kubernetes/blob/master/Makefile#L258

**Which issue this PR fixes**: fixes #40155 

**Special notes for your reviewer**: /cc @pires @pipejakob @liggitt 

```release-note
NONE
```
2017-02-08 01:47:37 -08:00
Kubernetes Submit Queue 3268d8102a Merge pull request #41020 from luxas/kubeadm_cleanup
Automatic merge from submit-queue (batch tested with PRs 41061, 40888, 40664, 41020, 41085)

kubeadm: Small cleanup and fixes, validate the service subnet

**What this PR does / why we need it**:
 - Validate the minimum subnet cidr so there are always 10 available addresses
 - Remove an old proxy arg function, add clustercidr to the proxy manifest and automatically calculate the dns ip

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

@errordeveloper @pires @mikedanese @dmmcquay @dgoodwin
2017-02-07 23:06:42 -08:00
Kubernetes Submit Queue b58a20740a Merge pull request #40888 from apprenda/kubeadm_pkiutil_tests
Automatic merge from submit-queue (batch tested with PRs 41061, 40888, 40664, 41020, 41085)

kubeadm: added tests cert/pkiutil pkg

raised coverage from ~37% to ~77%

**What this PR does / why we need it**: added tests to cert/pkiutil pkg and raised coverage from ~37% to ~77%

Adding unit tests is a WIP from #34136

**Special notes for your reviewer**: /cc @luxas @pires 

**Release note**:
```release-note
NONE
```
2017-02-07 23:06:39 -08:00
Kubernetes Submit Queue 3ce49346a7 Merge pull request #40882 from apprenda/kubeadm_util_tests
Automatic merge from submit-queue (batch tested with PRs 41064, 41090, 41068, 41073, 40882)

kubeadm: updated tests in app/util pkg

**What this PR does / why we need it**: Tests did not follow the standard of being table driven. Updated to make future changes (Adding/deleting tests) easier as well as more readable

Adding unit tests is a WIP from #34136

**Special notes for your reviewer**: /cc @luxas @pires 

**Release note**:
```release-note
NONE
```
2017-02-07 13:46:41 -08:00
Derek McQuay 1459bbade4
kubeadm: updated cmd tests as discussed in SIG
After today's SIG meeting, it was discussed how to proceed with these
types of test-cmd tests.  They will live in kubeamd/test/cmd and will
provide a flag that will allow you to skip them (--kubeadm-cmd-skip) and
by default will fail if kubeadm binary is not present
2017-02-07 12:47:07 -08:00
Lucas Käldström f6647fc152
Update bazel, the validation test and use ipallocator.RangeSize 2017-02-07 18:25:25 +02:00
Derek McQuay d23507f40d kubeadm: added tests cert/pkiutil pkg
raised coverage from ~37% to ~77%
2017-02-07 08:22:12 -08:00
Derek McQuay 8cf23139e6
kubeadm: tests for apis/kubeadn/validation pkg 2017-02-07 09:06:12 +02:00
Kubernetes Submit Queue 751cbc9b0c Merge pull request #41026 from apprenda/kubeadm_fix_os_remove
Automatic merge from submit-queue (batch tested with PRs 40385, 40786, 40999, 41026, 40996)

kubeadm: change os.Remove to os.RemoveAll

**What this PR does / why we need it**: This would not correctly clean out the tmp dir, since os.Remove doesn't recursively remove dirs, which could exist in the tmp dir.

Unit tests are a WIP from #34136

**Special notes for your reviewer**: /cc @luxas @pires 

**Release note**:
```release-note
NONE
```
2017-02-06 16:51:10 -08:00
Lucas Käldström 407722b378
Remove an old proxy arg function, add clustercidr to the proxy manifest and automatically calculate the dns ip 2017-02-06 23:09:27 +02:00
Kubernetes Submit Queue a461eab321 Merge pull request #40883 from apprenda/kubeadm_util_template_has_unit_tests
Automatic merge from submit-queue (batch tested with PRs 39681, 39321, 41018, 40883)

kubeadm: app/util/template.go has unit tests

**What this PR does / why we need it**: There was a TODO tag about adding unit tests, but unit tests have been added and the coverage for that file is ~90%.  Tag should be removed. 

Adding unit tests is a WIP from #34136

**Special notes for your reviewer**: /cc @luxas @pires 

**Release note**:
```release-note
NONE
```
2017-02-06 10:47:00 -08:00
Derek McQuay 011629fb5a
kubeadm: change os.Remove to os.RemoveAll
This would not correctly clean out the tmp dir, since os.Remove doesn't
recursively remove dirs, which could exist in the tmp dir.
2017-02-06 10:28:44 -08:00
Lucas Käldström 667dc64e79
Validate the minimum subnet cidr so there are always 10 available addresses 2017-02-06 19:34:06 +02:00
Kubernetes Submit Queue 8805a068b8 Merge pull request #40937 from pipejakob/discovery
Automatic merge from submit-queue

Discovery typo fix.

Simple typo fix.

**Release note**:

```release-note
NONE
```
2017-02-06 09:05:20 -08:00
Kubernetes Submit Queue 53f48f129c Merge pull request #40994 from xilabao/update-kubeadm-usage-message
Automatic merge from submit-queue (batch tested with PRs 40978, 40994, 41008, 40622)

update kubeadm usage message
2017-02-06 06:45:06 -08:00
Kubernetes Submit Queue 09cb6ee193 Merge pull request #40832 from apprenda/kubeadm_discovery_remove_error_passing
Automatic merge from submit-queue

Kubeadm discovery remove error passing

**What this PR does / why we need it**: In the app/discovery there is some confusion about the passing of error values created in the discovery/token, discovery/https/ and discovery/file pkgs.  Since they always return `nil` , it was very confusing in discovery/flags.go why to propagate them up as if there was a chance for them to return a value other than `nil`.  This change makes it much more clear what is being passed.  

I noticed this as I was making a sweep through trying to add more unit tests and it was very confusing to read the code. 

**Which issue this PR fixes** : fixes #https://github.com/kubernetes/kubeadm/issues/141

**Special notes for your reviewer**: /cc @luxas @pires 

**Release note**:
```release-note
NONE
```
2017-02-06 05:24:47 -08:00
xilabao f16ed82f2f update kubeadm usage message 2017-02-06 14:25:40 +08:00
Jacob Beacham d5319ec63d Typo fix. 2017-02-03 11:49:19 -08:00
Lucas Käldström 876153d491
Remove the kubernetes.io/cluster-service label from the Deployment templates 2017-02-02 22:08:47 +02:00
Derek McQuay 318e27b68a
kubeadm: app/util/template.go has unit tests
remove TODO because unit tests have been added
2017-02-02 11:31:52 -08:00
Derek McQuay 42738fffb3
kubeadm: updated tests in app/util pkg
Tests did not follow the standard of being table driven.
2017-02-02 11:28:56 -08:00
Jordan Liggitt 2085f77e27
Remove 'get node' call during bootstrapping 2017-02-02 13:36:13 -05:00
Derek McQuay 69dd248747 kubeadm: changed error passing to be more clear
updated flag error in discovery/https, discovery/token, and
discovery/file
2017-02-02 09:18:42 -08:00
Kubernetes Submit Queue 478c82325c Merge pull request #40855 from apprenda/kubeadm_reset_better_error_logging
Automatic merge from submit-queue

kubeadm: fix reset error logging.

**What this PR does / why we need it**: while investigating https://github.com/kubernetes/kubeadm/issues/142 I realized error logging was misleading. This PR is meant to fix it.

**Special notes for your reviewer**: /cc @luxas 

**Release note**:
```release-note
NONE
```
2017-02-02 08:55:41 -08:00
Paulo Pires 68113cacf2
kubeadm: fix reset error logging. 2017-02-02 12:58:42 +00:00
Kubernetes Submit Queue e47d9a6866 Merge pull request #40556 from luxas/kubeadm_proxy_rbac
Automatic merge from submit-queue

kubeadm: Refactoring the apiconfig and addons phases 

**What this PR does / why we need it**:

First commit: Fix the defaulting for AuthorizationMode - **Ready for review**
Second commit: Refactoring the apiconfig and addons phases in kubeadm - **work in progress, broken at the moment**

**Special notes for your reviewer**:

Please take a look at the first commit now. You can also see the direction I'm going with the addons and apiconfig phases.

For example, I'm using Go templates instead of creating native Go structs for kube-dns and kube-proxy now. The question is if I should do it for the RBAC rules as well, it might make sense there as well.

Converting the dns addon to a yaml spec makes it 100x easier to maintain when changes are made to the "upstream" DNS spec, and also more swappable. We could for instance have a configuration param for it for those who want a custom file, etc.

**Release note**:

```release-note
NONE
```

@mikedanese @pires @lukemarsden @errordeveloper @dgoodwin @liggitt @andrewrynhard
2017-02-02 03:00:01 -08:00
Kubernetes Submit Queue 9dedf92d42 Merge pull request #39440 from apprenda/kubeadm_102-fix_proxy
Automatic merge from submit-queue (batch tested with PRs 40574, 40806, 40308, 40771, 39440)

kubeadm: kube-proxy needs to know the pod subnet CIDR

**What this PR does / why we need it**: `kube-proxy` 1.5 has a new flag `cluster-cidr` that isn't specified by `kubeadm`, thus resulting in bug https://github.com/kubernetes/kubeadm/issues/102.

**Which issue this PR fixes**: fixes https://github.com/kubernetes/kubeadm/issues/102

**Special notes for your reviewer**:
/cc @luxas @dmmcquay
2017-02-01 16:12:51 -08:00
Kubernetes Submit Queue 2ee058c2cc Merge pull request #40771 from apprenda/kubeadm-135-FQDN
Automatic merge from submit-queue (batch tested with PRs 40574, 40806, 40308, 40771, 39440)

kubeadm: preflight check for incorrect FQDN

**What this PR does / why we need it**: There are a variety of system configuration errors (such as cloud-init bugs when deploying on AWS) which can cause hostname and uname -n to be wrong for a given host. This will cause kubeadm setup to fail in interesting and hard-to-figure-out ways (it doesn't fail until you start trying to set up DNS on the master, for example).

This PR adds a preflight check to test whether or not the server can reach itself using that name. This does not catch the case that the FQDN belongs to a different but valid server, but it would catch some of the cases. 

**Which issue this PR fixes** : fixes https://github.com/kubernetes/kubeadm/issues/135

**Special notes for your reviewer**: /cc @luxas 

**Release note**:
```release-note
NONE
```
2017-02-01 16:12:49 -08:00
Lucas Käldström 6d7d1317cb
Move the apiCallRetryInterval constants to a common place and a little bit cleanup 2017-02-02 00:05:14 +02:00
Lucas Käldström e289342158
Move the discovery deployment to a yaml spec 2017-02-01 23:55:49 +02:00
Lucas Käldström e261627260
Remove unused helpers in apiclient.go and deploy the dummy deployment from a yaml spec 2017-02-01 23:54:31 +02:00
Lucas Käldström 183f71d57a
Add a new, dedicated package for the addons and use templates instead of native Go types, and remove the previous Go files 2017-02-01 23:33:35 +02:00
Lucas Käldström 8f660dc24e
Add a ParseTemplate util function for parsing go text templates easily 2017-02-01 23:33:22 +02:00
Kubernetes Submit Queue 582187b6fb Merge pull request #40758 from luxas/kubeadm_cleanup_rbac
Automatic merge from submit-queue

kubeadm: Move some code from apiclient.go to the dedicated apiconfig phase

**What this PR does / why we need it**:

Add constants and somewhat refactor the RBAC code as well + some cleanup.
I'm planning to rewrite the code in `setupmaster.go` later, but this PR has only the move of the code for easier reviewing.

**Special notes for your reviewer**:

This is broken out from: https://github.com/kubernetes/kubernetes/pull/40556

**Release note**:

```release-note
NONE
```

@mikedanese @pires @dmmcquay @dgoodwin
2017-02-01 13:20:37 -08:00
Derek McQuay 8e06ea9bda
kubeadm: break out check for err and hostname 2017-02-01 11:51:16 -08:00
Lucas Käldström 79515ec880
Move some code from apiclient.go to the dedicated apiconfig phase package. Add constants and somewhat refactor the RBAC code as well 2017-02-01 19:06:51 +02:00
Paulo Pires ab1a5b53ab
kubeadm: set maxUnavailable and maxSurge for self-hosted component deployments.
Refs https://github.com/kubernetes/kubeadm/issues/127
2017-02-01 11:42:02 +00:00
Derek McQuay 2c0b3da430
kubeadm: preflight check for incorrect FQDN? 2017-01-31 15:42:46 -08:00
Kubernetes Submit Queue 8ffada6699 Merge pull request #40698 from luxas/kubeadm_fix_authz_default
Automatic merge from submit-queue (batch tested with PRs 40707, 40698)

kubeadm: Default to control plane v1.6.0-alpha.1 and using RBAC

Also use constants for authz modes

**What this PR does / why we need it**:

Defaults to v1.6.0-alpha.1 (will be cut later today) because the certificates API group has been upgraded to beta, so `kubeadm join` at HEAD doesn't work on a `v1.5` cluster anyway.

By defaulting to v1.6.0-alpha.1, we can focus totally on v1.6 for kubeadm at HEAD, we don't support other versions in the upcoming v1.6 kubeadm release because of the alpha -> beta upgrades.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

@mikedanese @pires
2017-01-31 03:29:44 -08:00
Kubernetes Submit Queue 41684eb22b Merge pull request #40628 from skriss/kubeadm_multi_endpoint_bugfix
Automatic merge from submit-queue (batch tested with PRs 40392, 39242, 40579, 40628, 40713)

fixed bug #36988 -- kubeadm join crashes when using multiple API endpoints

**What this PR does / why we need it**:
Simple bug fix for #36988 (kubeadm crashes when trying to join nodes to a master with multiple API endpoints) -- stopChan was getting closed multiple times, once per endpoint. Moved the close into the once.Do(...)

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*:
fixes #36988 

**Special notes for your reviewer**:
this is my first kubernetes commit, just getting familiar with the process, so any/all feedback is appreciated

**Release note**:
2017-01-31 01:16:54 -08:00
Lucas Käldström fbc550c945
Default to control plane v1.6.0-alpha.1 for clusters deployed with kubeadm and using RBAC. Also use constants for authz modes 2017-01-31 09:24:15 +02:00
Kubernetes Submit Queue 1bc78add3e Merge pull request #40682 from dgoodwin/pod-security-context
Automatic merge from submit-queue (batch tested with PRs 38443, 40145, 40701, 40682)

Move kubeadm etcd SELinux options from container to pod.

**What this PR does / why we need it**:

Works around a bug that surfaces in Docker 1.12+ related to the pause
container's namespace and selinux labels being transferred to the etcd
container when it runs.

At present it appears that applying selinux options to a container may
be broken, or perhaps shouldn't be supported at all. Moving these to the
pod causes all containers (including pause) to run with the correct
labels.



**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

Related to and partial fix for https://github.com/kubernetes/kubeadm/issues/107

This is one of several selinux related fixes in flight for upcoming releases, and newer versions of Docker. To successfully run kubeadm with selinux enforcing right now would like require a recent container-selinux build as uncovered in https://github.com/kubernetes/kubeadm/issues/107, a bugfix for the format labels in #40179, and finally this fix.

**Release note**:

```release-note
Fixed an SELinux issue in kubeadm on Docker 1.12+ by moving etcd SELinux options from container to pod.
```
2017-01-30 20:59:44 -08:00
deads2k c9a008dff3 move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
Devan Goodwin 65a48b57ff Move kubeadm etcd SELinux options from container to pod.
Works around a bug that surfaces in Docker 1.12+ related to the pause
container's namespace and selinux labels being transferred to the etcd
container when it runs.

At present it appears that applying selinux options to a container may
be broken, or perhaps shouldn't be supported at all. Moving these to the
pod causes all containers (including pause) to run with the correct
labels.
2017-01-30 10:16:22 -04:00
Dr. Stefan Schimanski 44ea6b3f30 Update generated files 2017-01-29 21:41:45 +01:00
Dr. Stefan Schimanski bc6fdd925d pkg/api/resource: move to apimachinery 2017-01-29 21:41:44 +01:00
Kubernetes Submit Queue babecf10dd Merge pull request #40194 from bruceauyeung/k8s-branch-fix-error-message-in-TestGetAddonImage
Automatic merge from submit-queue (batch tested with PRs 40132, 39302, 40194, 40619, 40601)

fix error message in TestGetAddonImage

Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>

**What this PR does / why we need it**:

1. fix incorrect error message in TestGetAddonImage
2. rename some variables to make them more reasonable
2017-01-27 18:32:24 -08:00
Kubernetes Submit Queue a812493aae Merge pull request #39302 from bruceauyeung/k8s-branch-fix-nil-check-and-typos
Automatic merge from submit-queue (batch tested with PRs 40132, 39302, 40194, 40619, 40601)

fix nil check and typos

**What this PR does / why we need it**:
1. nil error should be checked before defer statement.
2. fix some typos.

Signed-off-by: bruceauyeung ouyang.qinhua@zte.com.cn
2017-01-27 18:32:23 -08:00
Kubernetes Submit Queue 433e7a1fee Merge pull request #40132 from bruceauyeung/k8s-branch-add-invalid-and-valid-tokens-in-TestValidateToken-testcase
Automatic merge from submit-queue

add test tokens for TestValidateToken

Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>


**What this PR does / why we need it**:

1. add invalid tokens which token ID and token secret contain special characters such as `*`
2. add valid tokens which  token ID and token secret contain mixed lowercase characters and numeric numbers
2017-01-27 18:23:36 -08:00
Kubernetes Submit Queue 3ac0581a81 Merge pull request #39320 from bruceauyeung/k8s-branch-fix-incorrect-parameter-passing
Automatic merge from submit-queue

fix incorrect parameter passing

Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>


**What this PR does / why we need it**:
1. fix incorrect parameter passing when creating error
2. fix ineffectual assignment to err variable.
2017-01-27 15:50:54 -08:00
Derek McQuay 7472adff5b kubeadm: skip tests if binary not present
Will skip integration tests for token generation if it can't find a file
by the given --kubeadm-path or default value.
2017-01-26 20:45:07 -08:00
deads2k 2734f8f892 move dynamic and discovery clients 2017-01-26 08:37:06 -05:00
Kubernetes Submit Queue a931b7e238 Merge pull request #40357 from sttts/sttts-more-cutoffs-2
Automatic merge from submit-queue (batch tested with PRs 39538, 40188, 40357, 38214, 40195)

genericapiserver: cut off more dependencies – episode 2

Compare commit subjects.

approved based on #40363
2017-01-25 17:47:13 -08:00
Kubernetes Submit Queue 61d4a71853 Merge pull request #40429 from dgoodwin/self-hosted-wait
Automatic merge from submit-queue

Wait for the self-hosted control plane during kubeadm init.

**What this PR does / why we need it**:

Currently we are completing kubeadm init while the scheduler and
controller manager are likely still not yet up. In some cases if they
will fail, they won't ever come up.

Instead wait until each pod enters running state before exiting kubeadm.

**Release note**:

```release-note
NONE
```
2017-01-25 13:26:05 -08:00
Dr. Stefan Schimanski a0137e9b28 Update generated files 2017-01-25 19:49:45 +01:00
Dr. Stefan Schimanski d7eb3b6870 pkg/util: move uuid and strategicpatch into k8s.io/apimachinery 2017-01-25 19:45:09 +01:00
Devan Goodwin 1eb2e60dbf Wait for the self-hosted control plane during kubeadm init.
Currently we are completing kubeadm init while the scheduler and
controller manager are likely still not yet up. In some cases if they
will fail, they won't ever come up.

Instead wait until each pod enters running state before exiting kubeadm.
2017-01-25 12:16:03 -04:00
Timothy St. Clair bfe41927ba Cleaup Affinity post conversion from annotations to fields 2017-01-25 08:32:28 -06:00
Steve Kriss 29087066d0 fixed bug #36988 -- kubeadm crashes when using multiple API endpoints 2017-01-24 16:51:16 -08:00
Kubernetes Submit Queue df42444742 Merge pull request #40216 from sttts/sttts-more-cutoffs
Automatic merge from submit-queue (batch tested with PRs 39260, 40216, 40213, 40325, 40333)

genericapiserver: more dependency cutoffs

- cut-off pkg/api.Resource and friends - lgtm
- authn plugins -> k8s.io/apiserver - 
- webhook authz plugin -> k8s.io/apiserver - lgtm
- ~~pkg/cert -> k8s.io/apimachinery (will rebase on @deads2k's PR also moving it)~~
- split pkg/config into kubelet config merger and flags - lgtm
- split feature gate between generic apiserver and kube - lgtm
- move pkg/util/flag into k8s.io/apiserver - lgtm
2017-01-24 16:26:00 -08:00
Dr. Stefan Schimanski 2b8e938128 Update generated files 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 82826ec273 pkg/util/flag: move to k8s.io/apiserver 2017-01-24 20:56:03 +01:00
Clayton Coleman be6d2933df
refactor: Move *Options references to metav1 2017-01-24 13:41:51 -05:00
Clayton Coleman 7b1c715496
generated: Move references to metav1.*Options 2017-01-24 13:41:48 -05:00
Clayton Coleman fca7e00608
Move all *Options to metav1 2017-01-24 13:15:26 -05:00
deads2k 5a8f075197 move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
Kubernetes Submit Queue 0fac54e65e Merge pull request #40316 from luxas/kubeadm_fix_apiserver_certs
Automatic merge from submit-queue (batch tested with PRs 40303, 40316)

kubeadm: Fix up the apiserver kubelet client cert

**What this PR does / why we need it**:

I didn't notice that the apiserver serving cert was _only_ a server cert, not both a server and client cert in https://github.com/kubernetes/kubernetes/pull/40292.

This PR fixes that misconception and generates a dedicated client cert for apiserver -> kubelet communication and harmonizes the `ca.crt` path to `/etc/kubernetes/pki/ca.crt` on both master and node.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

```console
$ systemctl cat kubelet
# /lib/systemd/system/kubelet.service
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=http://kubernetes.io/docs/

[Service]
ExecStart=/usr/bin/kubelet
Restart=always
StartLimitInterval=0
RestartSec=10

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--kubeconfig=/etc/kubernetes/kubelet.conf **--authorization-mode=Webhook --client-ca-file=/etc/kubernetes/pki/ca.crt** --require-kubeconfig=true"
Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true"
Environment="KUBELET_NETWORK_ARGS=--network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
Environment="KUBELET_DNS_ARGS=--cluster-dns=10.96.0.10 --cluster-domain=cluster.local"
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_SYSTEM_PODS_ARGS $KUBELET_NETWORK_ARGS $KUBELET_DNS_ARGS $KUBELET_EXTRA_ARGS


$ curl -k https://localhost:10250/containerLogs/kube-system/weave-net-arm64-4t2xv/weave
Forbidden (user=system:anonymous, verb=get, resource=nodes, subresource=proxy)
$ curl --cert /etc/kubernetes/pki/apiserver-kubelet-client.crt --key /etc/kubernetes/pki/apiserver-kubelet-client.key -k https://localhost:10250/containerLogs/kube-system/weave-net-arm64-4t2xv/weave
[Works!!]
```

**Release note**:

```release-note
NONE
```

@liggitt @deads2k
2017-01-24 01:57:11 -08:00
bruceauyeung 21e49646b8 fix incorrect parameter passing
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2017-01-24 14:37:57 +08:00
Clayton Coleman 9009c1ac14
generated: informer,client 2017-01-23 17:52:47 -05:00
Clayton Coleman 469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
Clayton Coleman f623a8c908
Make all groups use metav1.AddToGroupVersion for ListOptions 2017-01-23 16:53:18 -05:00
Lucas Käldström 695fb7440e
Fix up the misunderstanding about the apiserver kubelet client cert 2017-01-23 21:45:48 +02:00
Kubernetes Submit Queue 5ea80569ae Merge pull request #40227 from deads2k/client-11-easy
Automatic merge from submit-queue

make client-go tools/auth and tools/clientcmd authoritative

These moved easily.  Pure mechanical.  I'll have a couple snip pulls for some of the more complicated packages.  `pkg/util/homedir` was a transitive that moved with. It was only used in `kubectl` and you'd need it to be consistent with `clientcmd` loading order.

@sttts
2017-01-23 09:07:17 -08:00
Kubernetes Submit Queue 071844e35f Merge pull request #40292 from luxas/kubeadm_node_ca
Automatic merge from submit-queue (batch tested with PRs 38445, 40292)

kubeadm: Secure apiserver -> kubelet communication and set storage backend to etcd3

**What this PR does / why we need it**:

Switch storage backend to etcd3
Writes ca.crt down to disk so we can set `--client-ca-file=/etc/kubernetes/ca.crt` for the kubelet.
Adds --kubelet-client-{certificate,key} to the apiserver args and make it allowed to access the kubelets
In some cases the `path` dependency is switched to `filepath`

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*:

fixes https://github.com/kubernetes/kubeadm/issues/118
fixes https://github.com/kubernetes/kubeadm/issues/129

**Special notes for your reviewer**:

This PR is should make it possible to secure the apiserver -> kubelet communication.

**Release note**:

```release-note
NONE
```

@pires @mikedanese @andrewrynhard @liggitt @deads2k
2017-01-23 08:11:08 -08:00
deads2k 335ef747d6 mechanical 2017-01-23 10:03:55 -05:00
deads2k 7cc9702402 separate announce factories 2017-01-23 08:02:14 -05:00
Lucas Käldström 6a37f450ae
Add --kubelet-client-{certificate,key} to the apiserver args and make it allowed to access the kubelets 2017-01-23 13:16:04 +02:00
Lucas Käldström 6579c94559
Write ca.crt down to disk in kubeadm join 2017-01-23 13:15:19 +02:00
Lucas Käldström 22ce0fdf2d
Set apiserver's storage backend to etcd3 2017-01-23 12:08:01 +02:00
Lucas Käldström 9e7ef10f95
Don't require the kubeconfigs and certs to not exist; that's now handled in later in the individual phase code. Also fix a small test 2017-01-21 01:00:17 +02:00
Lucas Käldström 13499f443a
Generate two certs and two private keys; only the necessary ones; make the certs and kubeconfig phases work with valid files already on-disk and some cleanup 2017-01-21 00:33:06 +02:00
Lucas Käldström 741b0b8c9f
Make the discovery deployment load the CA from a file 2017-01-21 00:30:35 +02:00
Kubernetes Submit Queue 0efee9a67e Merge pull request #40152 from liggitt/sign-cert-org
Automatic merge from submit-queue (batch tested with PRs 40187, 40231, 40152)

Update client/server cert generation utilities

Limit generated cert usage to client or server use.
2017-01-20 13:29:48 -08:00
Kubernetes Submit Queue b5929bfb2b Merge pull request #38789 from jessfraz/cleanup-temp-dirs
Automatic merge from submit-queue (batch tested with PRs 37228, 40146, 40075, 38789, 40189)

Cleanup temp dirs

So funny story my /tmp ran out of space running the unit tests so I am cleaning up all the temp dirs we create.
2017-01-20 12:34:58 -08:00
Kubernetes Submit Queue 7f9997a456 Merge pull request #40075 from apprenda/kubeadm_self_hosted
Automatic merge from submit-queue (batch tested with PRs 37228, 40146, 40075, 38789, 40189)

kubeadm: add optional self-hosted deployment

**What this PR does / why we need it**: add an optional self-hosted deployment type to `kubeadm`, for master components only, namely `apiserver`, `controller-manager` and `scheduler`.

**Which issue this PR fixes**: closes #38407

**Special notes for your reviewer**: /cc @aaronlevy @luxas @dgoodwin

**Release note**:
```release-note
kubeadm: add optional self-hosted deployment for apiserver, controller-manager and scheduler.
```
2017-01-20 12:34:56 -08:00
Paulo Pires 724ce6a8a5
kubeadm: add temporary --self-hosted flag. 2017-01-20 17:41:47 +00:00
Paulo Pires c80c0275da
kubeadm: add self-hosted as optional deployment type. 2017-01-20 17:41:47 +00:00
Devan Goodwin 750cdb5bc2
kubeadm: first pass at self-hosted master components. 2017-01-20 17:41:46 +00:00
Jordan Liggitt 11012c19df
Update client/server cert generation utilities 2017-01-20 12:22:39 -05:00
deads2k 9d3dfbf630 move apimachinery/announced to apimachinery 2017-01-20 12:20:13 -05:00
deads2k dfd8db8ae9 allow API groups to be installed and registered in multiple schemes 2017-01-20 12:19:49 -05:00
Kubernetes Submit Queue 22a405055d Merge pull request #40170 from deads2k/client-10-restclient
Automatic merge from submit-queue (batch tested with PRs 36693, 40154, 40170, 39033)

make client-go authoritative for pkg/client/restclient

Moves client/restclient to client-go and a util/certs, util/testing as transitives.
2017-01-20 09:18:52 -08:00
Kubernetes Submit Queue 49cb10c843 Merge pull request #40154 from liggitt/kubeadm-rbac
Automatic merge from submit-queue (batch tested with PRs 36693, 40154, 40170, 39033)

kubeadm: RBAC cleanup

builds on https://github.com/kubernetes/kubernetes/pull/40153 and includes some follow-up items from https://github.com/kubernetes/kubernetes/pull/39846
2017-01-20 09:18:51 -08:00
deads2k ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k c587b8a21e re-run client-gen 2017-01-20 08:02:36 -05:00
bruceauyeung db08ac829e fix error message in TestGetAddonImage
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2017-01-20 11:14:53 +08:00
Lucas Käldström c771dff526
Only enable RBAC if the k8s version is above 1.6.0-alpha.0, move some of the defaulting of the api type into a specific file 2017-01-19 22:24:50 +02:00
Jordan Liggitt 083ffb6e93
kubeadm: clean up RBAC grants 2017-01-19 14:54:41 -05:00
Jordan Liggitt e3f79588f4
kubeadm: use built-in system:node-bootstrapper role 2017-01-19 14:52:47 -05:00
Jordan Liggitt 0b5fcbe2ab
Remove kubeadm authorizer package dependency 2017-01-19 12:01:53 -05:00
deads2k 11e8068d3f move pkg/fields to apimachinery 2017-01-19 09:50:16 -05:00
deads2k cdb2934bbc remove kubernetes copy of clientcmd types 2017-01-19 07:39:19 -05:00
bruceauyeung cc198d3293 add test tokens for TestValidateToken
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2017-01-19 17:16:26 +08:00
Andrew Rynhard f46bf42ba0 Add authorization mode to kubeadm 2017-01-18 14:02:53 -08:00
Kubernetes Submit Queue 6895518177 Merge pull request #40008 from apprenda/kubeadm_112_init_token
Automatic merge from submit-queue

kubeadm: init must validate or generate token before anything else.

**What this PR does / why we need it**: `kubeadm init` must validate or generate a token before anything else. Otherwise, if token validation or generation fail, one will need to run `kubeadm reset && systemctl restart kubelet` before re-running `kubeadm init`.

**Which issue this PR fixes**: fixes kubernetes/kubeadm#112

**Special notes for your reviewer**: /cc @luxas

Tested manually.

### With no token

```
$ sudo ./kubeadm init
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
[preflight] Running pre-flight checks
[init] Using Kubernetes version: v1.5.2
[token-discovery] A token has not been provided, generating one
[certificates] Generated Certificate Authority key and certificate.
[certificates] Generated API Server key and certificate
[certificates] Generated Service Account signing keys
[certificates] Created keys and certificates in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 7.762803 seconds
[apiclient] Waiting for at least one node to register and become ready
[apiclient] First node is ready after 1.003148 seconds
[apiclient] Creating a test deployment
[apiclient] Test deployment succeeded
[token-discovery] Using token: 8321b6:a535ba541af7623c
[token-discovery] Created the kube-discovery deployment, waiting for it to become ready
[token-discovery] kube-discovery is ready after 1.003423 seconds
[addons] Created essential addon: kube-proxy
[addons] Created essential addon: kube-dns
Your Kubernetes master has initialized successfully!
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
    http://kubernetes.io/docs/admin/addons/
You can now join any number of machines by running the following on each node:
kubeadm join --discovery token://8321b6:a535ba541af7623c@10.142.0.6:9898
```

### With invalid token

```
$ sudo ./kubeadm init --discovery token://12345:12345
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
[preflight] Running pre-flight checks
[init] Using Kubernetes version: v1.5.2
[token-discovery] A token has been provided, validating [&{ID:12345 Secret:12345 Addresses:[]}]
token ["12345:12345"] was not of form ["^([a-z0-9]{6})\\:([a-z0-9]{16})$"]
```

### With valid token

```
$ sudo ./kubeadm ex token generate
cd540e:c0e0318e2f4a63b1

$ sudo ./kubeadm init --discovery token://cd540e:c0e0318e2f4a63b1
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
[preflight] Running pre-flight checks
[init] Using Kubernetes version: v1.5.2
[token-discovery] A token has been provided, validating [&{ID:cd540e Secret:c0e0318e2f4a63b1 Addresses:[]}]
[certificates] Generated Certificate Authority key and certificate.
[certificates] Generated API Server key and certificate
[certificates] Generated Service Account signing keys
[certificates] Created keys and certificates in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[apiclient] Created API client, waiting for the control plane to become ready
[apiclient] All control plane components are healthy after 13.513305 seconds
[apiclient] Waiting for at least one node to register and become ready
[apiclient] First node is ready after 0.502656 seconds
[apiclient] Creating a test deployment
[apiclient] Test deployment succeeded
[token-discovery] Using token: cd540e:c0e0318e2f4a63b1
[token-discovery] Created the kube-discovery deployment, waiting for it to become ready
[token-discovery] kube-discovery is ready after 2.002457 seconds
[addons] Created essential addon: kube-proxy
[addons] Created essential addon: kube-dns
Your Kubernetes master has initialized successfully!
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
    http://kubernetes.io/docs/admin/addons/
You can now join any number of machines by running the following on each node:
kubeadm join --discovery token://cd540e:c0e0318e2f4a63b1@10.142.0.6:9898
```

**Release note**:
```release-note
NONE
```
2017-01-18 04:03:48 -08:00
Clayton Coleman 9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
Kubernetes Submit Queue b79765e38d Merge pull request #40002 from apprenda/kubeadm_dns_1_11_0
Automatic merge from submit-queue (batch tested with PRs 39911, 40002, 39969, 40012, 40009)

kubeadm: upgrade kube-dns to 1.11.0.

**What this PR does / why we need it**: See kubernetes/dns#25

**Which issue this PR fixes**: fixes kubernetes/kubeadm#121

**Special notes for your reviewer**: /cc @luxas
I know this is not the template solution you are looking for but seems to me it's important enough to do this now because of the issues it fixes.
Tested manually and it works.

`NONE`
2017-01-17 06:46:55 -08:00
Kubernetes Submit Queue 6d19340d95 Merge pull request #39911 from bruceauyeung/k8s-branch-check-docker-service-active-when-resetting-cluster
Automatic merge from submit-queue

[kubeadm] resetting cluster should check whether docker service is active

Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>

**What this PR does / why we need it**:

if not, `kubeadm reset` will fail to remove kubernetes-managed containers
2017-01-17 06:41:57 -08:00
Paulo Pires 6b5d803e8a
kubeadm: improve init token logging. 2017-01-17 12:42:06 +00:00
Dr. Stefan Schimanski 52f6831576 genericapiserver: cut off kube pkg/version dependency 2017-01-17 12:34:05 +01:00
Paulo Pires 2e8df3b569
kubeadm: init must validate or generate token before anything else.
Fixes kubernetes/kubeadm#112
2017-01-17 10:29:15 +00:00
Paulo Pires 262eeea0d3
kubeadm: upgrade kube-dns to 1.11.0.
Fixes kubernetes/kubeadm#121
2017-01-17 09:13:04 +00:00
bruceauyeung 2ba9347233 resetting cluster should check whether docker service is active
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2017-01-17 15:53:19 +08:00
Kubernetes Submit Queue 451a24d6de Merge pull request #39677 from apprenda/kubeadm_104-lowercase_token
Automatic merge from submit-queue

kubeadm: must lower-case token portion used in DNS label.

**What this PR does / why we need it**: In Kubernetes, DNS labels must be lower-case. `kubeadm` doesn't care when creating certain objects through the API. This PR fixes that erroneous behavior.

**Which issue this PR fixes**: fixes https://github.com/kubernetes/kubeadm/issues/104

**Special notes for your reviewer**: /cc @luxas @mikedanese @dgoodwin
2017-01-16 13:43:12 -08:00
Paulo Pires a34eacc2af
kubeadm: token must be validated before creation, deletion or usage.
Refs kubernetes/kubeadm#104
2017-01-16 19:25:07 +00:00
Paulo Pires 44b044ab0a
kubeadm: token generation must respect Kubernetes DNS labeling rules.
Refs kubernetes/kubeadm#104
2017-01-16 19:14:20 +00:00
Paulo Pires 394f93b921
kubeadm: replaced period as token separator in favor of colon. 2017-01-16 18:57:23 +00:00
Paulo Pires c707cbf176
kubeadm: test should not proceed if script execution fails. 2017-01-16 18:23:30 +00:00
Paulo Pires 0fdc0fcfbb
kubeadm: test should escape regexp on output. 2017-01-16 18:23:24 +00:00
deads2k 77b4d55982 mechanical 2017-01-16 09:35:12 -05:00
NickrenREN a12dea14e0 fix redundant alias clientset 2017-01-12 10:21:05 +08:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue dccd073888 Merge pull request #39495 from apprenda/kubeadm_89-remove_preflight_stutter
Automatic merge from submit-queue (batch tested with PRs 39495, 39547)

kubeadm: updated preflight types to avoid stutter

Small change to kubeadm preflight pkg to remove stutter from preflight types PreFlightError and PreFlightCheck (now names Error and Checker). 

**Release note**:

`NONE`
2017-01-10 23:20:08 -08:00
Kubernetes Submit Queue f74a556f56 Merge pull request #39534 from apprenda/kubeadm_refactor_token_discovery
Automatic merge from submit-queue (batch tested with PRs 39684, 39577, 38989, 39534, 39702)

kubeadm: refactored token discovery.

**What this PR does / why we need it**: refactored `kubeadm` token discovery to follow the discovery interface and use new TLS bootstrap mechanism.

/cc @luxas @mikedanese
2017-01-10 22:24:15 -08:00
Kubernetes Submit Queue c425f77263 Merge pull request #39617 from apprenda/kubeadm_dns_upgrade
Automatic merge from submit-queue (batch tested with PRs 39673, 39536, 39617, 39540, 39686)

kubeadm: updated DNS deployment.

**What this PR does / why we need it**: Updates KubeDNS deployment to match upstream.

**Special notes for your reviewer**: It was tested manually by bootstrapping a new cluster, running a busybox container and making sure one could `nslookup` from within the container to find `kubernetes` and other services.
2017-01-10 20:38:17 -08:00
Paulo Pires 8a195b9a1b
kubeadm: refactored token discovery. 2017-01-11 01:09:34 +00:00
Paulo Pires d2e0913e68
kubeadm: fixed TLS bootstrap. 2017-01-11 01:08:31 +00:00
Derek McQuay 8f0f09c0fe kubeadm: updated preflight types to avoid stutter
PreFlightError and PreFlightCheck to Error and Checker to avoid
preflight.PreFlightError and preflight.PreFlightCheck stutter.
2017-01-10 16:20:38 -08:00
Derek McQuay fb4ee4deba kubeadm: add preflight check for bridge-nf 2017-01-09 09:56:02 -08:00
Paulo Pires 070f7d9d2d
kubeadm: updated DNS deployment. 2017-01-09 15:43:30 +00:00
Kubernetes Submit Queue 41d7acc0f5 Merge pull request #39464 from apprenda/kubeadm_93-more_discovery
Automatic merge from submit-queue

Implemented file and HTTPS based discovery for kubeadm

**What this PR does / why we need it**:
This PR implements both file and HTTPS based discovery for `kubeadm`.

**Which issue this PR fixes**:
fixes https://github.com/kubernetes/kubeadm/issues/93
fixes https://github.com/kubernetes/kubeadm/issues/94

**Special notes for your reviewer**:
I'd like to add some tests but 'm sure `kubeconfig` loading is already covered by other tests in `clientcmd` package.

/cc @luxas @pipejakob
2017-01-06 05:42:02 -08:00
Paulo Pires c272bc56b1
kubeadm: flag token discovery pieces to be refactored. 2017-01-06 12:09:50 +00:00
Paulo Pires a519335303
kubeadm: added HTTPS discovery.
Fixes kubernetes/kubeadm#94
2017-01-06 12:08:34 +00:00
Paulo Pires 18370ba0c1
kubeadm: added file discovery.
Fixes kubernetes/kubeadm#93
2017-01-06 12:07:25 +00:00
Jeff Grafton 20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
Kubernetes Submit Queue ed5414d333 Merge pull request #39426 from apprenda/kubeadm_95-fix_token_discovery
Automatic merge from submit-queue

kubeadm token discovery URL may not have valid input for url.Parse

**What this PR does / why we need it**:

**Which issue this PR fixes**: fixes https://github.com/kubernetes/kubeadm/issues/95

**Special notes for your reviewer**:
/cc @dgoodwin @luxas @mikedanese this is a WIP! Need a couple things:
* decide token separator, `.` or `:`
* define error handling in `token.go::37`
2017-01-05 01:47:14 -08:00
Kubernetes Submit Queue f605bfda61 Merge pull request #39429 from apprenda/kubeadm_80-change_etcd_datadir
Automatic merge from submit-queue

kubeadm: change etcd data dir to match host path.

**What this PR does / why we need it**: Trivial change that adopts a well-known path for etcd data, following the `hostPath` defined.

**Which issue this PR fixes**: Fixes https://github.com/kubernetes/kubeadm/issues/80

**Special notes for your reviewer**:
/cc @luxas @kad
2017-01-05 00:13:28 -08:00
Paulo Pires a6cdfdef4b
kubeadm: make sure URL is valid for token discovery. 2017-01-05 08:05:48 +00:00
Jacob Beacham 5cc36c9f05 Bugfix on kubeadm join with non-token discovery.
Without this change, using a non-token discovery mechanism during a join
triggers a nil pointer panic (instead of an error message about not
being implemented yet).
2017-01-04 15:40:52 -08:00
Paulo Pires cae862dadf
kubeadm: kube-proxy needs to know the pod subnet CIDR in order to understand what's internal and external traffic.
Fixes https://github.com/kubernetes/kubeadm/issues/102
2017-01-04 20:32:27 +00:00
Jess Frazelle db75904b42
fix when os.Remove should be os.RemoveAll
Signed-off-by: Jess Frazelle <acidburn@google.com>
2017-01-04 10:34:06 -08:00
Paulo Pires 241c530648
kubeadm: change etcd data dir to match host path.
Fixes https://github.com/kubernetes/kubeadm/issues/80
2017-01-04 16:43:13 +00:00
Kubernetes Submit Queue d0e160559d Merge pull request #39389 from mikedanese/kubeadm-fix
Automatic merge from submit-queue (batch tested with PRs 39280, 37350, 39389, 39390, 39313)

kubeadm: readd --api-port, accidentally removed during refactor.

this broke stuff
2017-01-03 18:25:12 -08:00
Lucas Käldström 720f3b45aa
Refactor the pki, cert, kubeconfig code in the kubeadm binary into two separate and logically independent phases 2017-01-03 23:40:07 +02:00
Mike Danese 0d6c029f7f kubeadm: readd --api-port, accidentally removed during refactor. 2017-01-03 13:38:21 -08:00
Jeff Grafton fae627dd65 Update generated for 2017 2017-01-01 23:11:09 -08:00
Mike Danese 161c391f44 autogenerated 2016-12-29 13:04:10 -08:00
bruceauyeung 8537aa4a99 fix nil check and typos 2016-12-29 18:00:28 +08:00
Kubernetes Submit Queue 67a3cd3a58 Merge pull request #39029 from kad/issue75
Automatic merge from submit-queue

Fix cloud-config name in test case

**What this PR does / why we need it**: fixes default cloud-config name in test cases for reset.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: related to kubernetes/kubeadm#75

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2016-12-23 06:21:27 -08:00
Kubernetes Submit Queue 9d38145cfb Merge pull request #37887 from bruceauyeung/k8s-branch-use-bytes-buffer-instead-of-append-for-error-string-concat
Automatic merge from submit-queue

use bytes.Buffer instead of append for error string concat

**What this PR does / why we need it**:
1. in my benchmark test, `bytes.Buffer` takes much less time ( about 1:1000 ) than string append( `+=` ). 
>BenchmarkAppendConcat-4           100000            151438 ns/op          578181 B/op          2 allocs/op
BenchmarkBufferSprintf-4         3000000               487 ns/op              65 B/op          3 allocs/op
BenchmarkBufferConcat-4          5000000               271 ns/op              47 B/op          1 allocs/op

the benchmark codes is here  https://play.golang.org/p/LS52zGuwZN

2. in our `RunInitMasterChecks`, `RunJoinNodeChecks` there are lots of preflight checks. they may result in a huge error message. so `bytes.Buffer` can bring considerable performance enhancement in the worst of conditions.

beyond that, this PR 
1. fix an exported struct comment,
1. and use `found = append( found, errs...)` instead of for loop for simplicity.


Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-23 03:56:32 -08:00
Kubernetes Submit Queue 58d319e589 Merge pull request #39093 from dgoodwin/token-default
Automatic merge from submit-queue

kubeadm: Default to using token discovery.

Recent changes to support multiple methods for discovery meant that
"kubeadm init" no longer was sufficient and users would need to add
"--discovery token://" to achieve the same results.

Instead lets assume discovery if the user does not specify anything else
to maintain parity and the brevity of our original instructions.


**Release note**:

```release-note
NONE
```

CC @mikedanese @luxas
2016-12-23 01:20:00 -08:00
Devan Goodwin bf69fb1747 kubeadm: Default to using token discovery.
Recent changes to support multiple methods for discovery meant that
"kubeadm init" no longer was sufficient and users would need to add
"--discovery token://" to achieve the same results.

Instead lets assume discovery if the user does not specify anything else
to maintain parity and the brevity of our original instructions.
2016-12-22 12:54:34 -04:00
Joe Finney ecaeab60e3 Fix kubeadm test in bazel. 2016-12-21 15:15:00 -08:00
Alexander Kanevskiy 2ac85d762f Fix cloud-config name in reset tests
Default name is /etc/kubernetes/cloud-config, thus tests
should cover "cloud-config" and not "cloud-config.json"
2016-12-21 14:42:11 +02:00
Devan Goodwin bfe345dd86 Implement kubeadm bootstrap token management.
Adds kubeadm subcommands to create, list, and delete bootstrap tokens.
Tokens can be created with a TTL duration, or 0 for tokens that will not
expire. The create command can also be used to specify your own token
(for use when bootstrapping masters and nodes in parallel), or update an
existing token's secret or ttl.

Marked "ex" for experimental for now as the boostrap controllers are not
yet hooked up in core.
2016-12-20 11:43:55 -04:00
Kubernetes Submit Queue 01b9d49673 Merge pull request #38677 from bruceauyeung/k8s-branch-fix-typos-and-comments
Automatic merge from submit-queue

path.Clean paths in GlobalEnvParams and remove unnecessary path.Join

**What this PR does / why we need it**:

1. clean all paths in `GlobalEnvParams`
1. remove unnecessary path.Join call in `pki.go`
2. fix some typos and comment errors

Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-17 12:16:47 -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
Kubernetes Submit Queue e2a9fc1022 Merge pull request #38841 from mikedanese/fix-tests
Automatic merge from submit-queue

bazel: fix some unit tests
2016-12-15 20:19:46 -08:00
Mike Danese 8fdec87d19 bazel: fix some unit tests 2016-12-15 18:36:22 -08:00
Mike Danese 7945c437e5 kubeadm: support --discovery token:// 2016-12-15 13:54:49 -08:00
Mike Danese 690c7e578b kubeadm: refactor discovery behind an interface 2016-12-15 13:54:49 -08:00
Chao Xu 03d8820edc rename /release_1_5 to /clientset 2016-12-14 12:39:48 -08:00
Lucas Käldström 96850dc600 Set --anonymous-auth to false on v1.5 clusters to preserve the locked-down v1.4 behaviour 2016-12-13 17:51:15 +02:00
Kubernetes Submit Queue 8abbedae54 Merge pull request #38315 from mikedanese/pin-gazel
Automatic merge from submit-queue

Pin gazel to a version and support cgo

This fixes the bazel build.

@krousey who is buildcop
2016-12-12 19:32:29 -08:00
Kubernetes Submit Queue 3dcbafa861 Merge pull request #36393 from apelisse/owners-cmd-kubeadm
Automatic merge from submit-queue

Curating Owners: cmd/kubeadm

cc @jbeda @mikedanese @luxas @errordeveloper

In an effort to expand the existing pool of reviewers and establish a
two-tiered review process (first someone lgtms and then someone
experienced in the project approves), we are adding new reviewers to
existing owners files.


If You Care About the Process:
------------------------------

We did this by algorithmically figuring out who’s contributed code to
the project and in what directories.  Unfortunately, that doesn’t work
well: people that have made mechanical code changes (e.g change the
copyright header across all directories) end up as reviewers in lots of
places.

Instead of using pure commit data, we generated an excessively large
list of reviewers and pruned based on all time commit data, recent
commit data and review data (number of PRs commented on).

At this point we have a decent list of reviewers, but it needs one last
pass for fine tuning.

Also, see https://github.com/kubernetes/contrib/issues/1389.

TLDR:
-----

As an owner of a sig/directory and a leader of the project, here’s what
we need from you:

1. Use PR https://github.com/kubernetes/kubernetes/pull/35715 as an example.

2. The pull-request is made editable, please edit the `OWNERS` file to
remove the names of people that shouldn't be reviewing code in the future in
the **reviewers** section. You probably do NOT need to modify the **approvers**
section. Names asre sorted by relevance, using some secret statistics.

3. Notify me if you want some OWNERS file to be removed.  Being an
approver or reviewer of a parent directory makes you a reviewer/approver
of the subdirectories too, so not all OWNERS files may be necessary.

4. Please use ALIAS if you want to use the same list of people over and
over again (don't hesitate to ask me for help, or use the pull-request
above as an example)
2016-12-12 17:30:24 -08:00
bruceauyeung 12e97da0c1 use bytes.Buffer instead of append for error string concat
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-13 09:10:13 +08:00
Antoine Pelisse 2084e0e665 Update OWNERS approvers and reviewers: cmd/kubeadm 2016-12-12 15:48:47 -08:00
Lucas Käldström 5222bd3e34 Bump default kubernetes version when no internet is present to v1.5 2016-12-12 23:59:14 +02:00
Mike Danese c87de85347 autoupdate BUILD files 2016-12-12 13:30:07 -08:00
Kubernetes Submit Queue e732ee70f4 Merge pull request #38406 from liggitt/remove-internal-json-annotations
Automatic merge from submit-queue

Remove json serialization annotations from internal types

fixes #3933

Internal types should never be serialized, and including json serialization tags on them makes it possible to accidentally do that without realizing it.

fixes in this PR:

* types
  * [x] remove json tags from internal types
  * [x] fix references from serialized types to internal ObjectMeta
* generation
  * [x] remove generated json codecs for internal types (they should never be used)
* kubectl
  * [x] fix `apply` to operate on versioned object
  * [x] fix sorting by field to operate on versioned object
  * [x] fix `--record` to build annotation patch using versioned object
* hpa
  * [x] fix unmarshaling to internal CustomMetricTargetList in validation
* thirdpartyresources
  * [x] fix encoding API responses using internal ObjectMeta
* tests
  * [x] fix tests to use versioned objects when checking encoded content
  * [x] fix tests passing internal objects to generic printers

follow ups (will open tracking issues or additional PRs):
- [ ] remove json tags from internal kubeconfig types (`kubectl config set` pathfinding needs to work against external type)
- [ ] HPA should version CustomMetricTargetList serialization in annotations
- [ ] revisit how TPR resthandlers encoding objects
- [ ] audit and add tests for printer use (human-readable printer requires internal versions, generic printers require external versions)
- [ ] add static analysis tests preventing new internal types from adding tags
- [ ] add static analysis tests requiring json tags on external types (and enforcing lower-case first letter)
- [ ] add more tests for `kubectl get` exercising known and unknown types with all output options
2016-12-10 14:00:17 -08:00
Kubernetes Submit Queue ac05e7135a Merge pull request #37568 from luxas/various_kubeadm_improvements
Automatic merge from submit-queue (batch tested with PRs 37270, 38309, 37568, 34554)

kubeadm UX improvements for the v1.5 stable release

This PR targets the next stable kubeadm release.

It's work in progress, but please comment on it and review, since there are many changes.

I tried to group the commits logically, so you can review them separately.

Q: Why this large PR? Why not many small?
A: Because of the Submit Queue and the time it takes.

PTAL @kubernetes/sig-cluster-lifecycle

_Edit:_ This work was splitted up in three PRs in total
2016-12-09 14:11:19 -08:00
Jordan Liggitt d5afb71cf4
Remove json serialization annotations from internal types 2016-12-09 16:26:03 -05:00
Lucas Käldström b0603046b4 Fix review feedback, bazel files, tests and the dnsmasq-metrics spec. Set --kubelet-preferred-address-types on v1.5 and higher clusters 2016-12-09 22:16:37 +02:00
Kubernetes Submit Queue 5b5b1e7533 Merge pull request #38371 from wojtek-t/get_options_in_client
Automatic merge from submit-queue (batch tested with PRs 38354, 38371)

Add GetOptions parameter to Get() calls in client library

Ref #37473 

This PR is super mechanical - the non trivial commits are:
- Update client generator
- Register GetOptions in batch/v2alpha1 group
2016-12-09 04:12:09 -08:00
Lucas Käldström 810e9e107f Refactor the whole binary, a lot of changes in one commit I know, but I just hacked on this and modified everything I thought was messy or could be done better.
Fix boilerplates, comments in the code and make the output of kubeadm more user-friendly
Start using HostPKIPath and KubernetesDir everywhere in the code, so they can be changed for real
More robust kubeadm reset code now.
Removed old glog-things from app.Run()
Renamed /etc/kubernetes/cloud-config.json to /etc/kubernetes/cloud-config since it shouldn't be a json file
Simplification of the code
Less verbose output from master/pki.go
Cleaned up dead code

Start a small logging/output framework:
 - fmt.Println("[the-stage-here] Capital first letter of this message. Tell the user what the current state is")
 - fmt.Printf("[the-stage-here] Capital first letter. Maybe a [%v] in the end if an error should be displayed. Always ends with \n")
 - fmt.Errorf("Never starts with []. Includes a short error message plus the underlying error in [%v]. Never ends with \n")
2016-12-09 12:48:12 +02:00
Lucas Käldström e46d8fef60 Run the root check before the other checks in order to fail fast if non-root to avoid strange errors. Also auto-start the kubelet if inactive 2016-12-09 12:48:11 +02:00
Lucas Käldström 95d97a0e8e Mark socat, ethtool and ebtables as soft deps, since kubelet can be run in a container. Also refactor preflight.go a little bit and improve logging 2016-12-09 12:48:11 +02:00
Wojciech Tyczynski e8d1cba875 GetOptions in client calls 2016-12-09 09:42:01 +01:00
bruceauyeung 511350a369 trimspace on user specified env params
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-08 10:31:23 +08:00
Kubernetes Submit Queue 72e7adb658 Merge pull request #36735 from YuPengZTE/devHTTP
Automatic merge from submit-queue

type HttpProxyCheck should be HTTPProxyCheck

**What this PR does / why we need it**:
Change HttpProxyCheck to HTTPProxyCheck
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:
golint
**Release note**:

```release-note
```

Signed-off-by: yupeng <yu.peng36@zte.com.cn>
2016-12-07 16:21:21 -08:00
Kubernetes Submit Queue aa08702d23 Merge pull request #37835 from luxas/kubeadm_cloudprovider_and_dns
Automatic merge from submit-queue (batch tested with PRs 38294, 37009, 36778, 38130, 37835)

Add a cloudprovider validator flag to kubeadm and update the DNS spec

Broken out from: https://github.com/kubernetes/kubernetes/pull/37568

This PR creates a flag for `cloud-provider` that validates the value before `RunInit()` is run, which makes it now act as a "real" flag
Then it removes the `k8s.io/kubernetes/pkg/cloudprovider` dependency, which makes the binary ~40MB smaller! That's _really_ worth it!

In the second commit, the DNS addon is updated to the latest version: https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/skydns-rc.yaml.base

@kubernetes/sig-cluster-lifecycle
2016-12-07 10:45:22 -08:00
Lucas Käldström f4cb405164 Update the built-in DNS addon of kubeadm to the v1.5 version 2016-12-07 16:24:21 +02:00
Lucas Käldström 342f98d516 Create a new cloud-provider flag in order to catch wrong args directly and don't import the cloudprovider package and save ~50% in binary size 2016-12-07 16:24:02 +02:00
Kubernetes Submit Queue 87d907cafe Merge pull request #37084 from kenan435/fail-fast-on-duplicate-node
Automatic merge from submit-queue (batch tested with PRs 38194, 37594, 38123, 37831, 37084)

[kubeadm] Fail fast if there already is a node in the cluster with that name

kubeadm Fail fast if there is another node with the same name already in the cluster. 

Fixes #36255

cc @kubernetes/sig-cluster-federation
2016-12-06 17:41:37 -08:00
Kubernetes Submit Queue 4eb4777df1 Merge pull request #37831 from luxas/improve_reset
Automatic merge from submit-queue (batch tested with PRs 38194, 37594, 38123, 37831, 37084)

Improve kubeadm reset

Depends on: https://github.com/kubernetes/kubernetes/pull/36474
Broken out from: https://github.com/kubernetes/kubernetes/pull/37568
Carries: https://github.com/kubernetes/kubernetes/pull/35709, @camilocot

This makes the `kubeadm reset` command more robust and user-friendly.
I'll rebase after #36474 merges...

cc-ing reviewers: @mikedanese @errordeveloper @dgoodwin @jbeda
2016-12-06 17:41:35 -08:00
Kenan Karamehmedovic 16453a3334 Fail fast if there is already a node with same name as the one being joined. 2016-12-06 15:46:15 +01:00
Lucas Käldström 7a463eff08 Drain node on kubeadm reset and make it possible to specify if the node should be removed from the cluster as well 2016-12-06 15:43:59 +02:00
Lucas Käldström 67d4ddaf59 Improve the kubeadm reset command. Reorder the functions and log more user-friendly output 2016-12-06 14:45:29 +02:00
Lucas Käldström 51d733f418 Remove the cni directory when resetting; otherwise kubelet can pick up the wrong config on the next kubeadm init run 2016-12-06 14:45:19 +02:00
Alexander Kanevskiy 1eeb3f155f Pass proxy environment variables to static pods
To access outside world or cloud provider APIs it might be
required to use proxy.

Fixes: kubernetes/kubernetes#36573, kubernetes/kubeadm#5
2016-12-06 14:38:48 +02:00
Alexander Block fd8e6d03e6 Fix test failures in manifests_test.go 2016-12-05 10:28:23 +01:00
Alexander Block 8373ab5890 kubeadm: Let apiserver and controller-manager host-mount /etc/pki when required
fixes: #36150
2016-12-05 10:11:15 +01:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Kubernetes Submit Queue 00e369b14f Merge pull request #37813 from kubernetes/revert-36625-branch-eliminate-recursive-call-attemptToUpdateMasterRoleLabelsAndTaints
Automatic merge from submit-queue (batch tested with PRs 35300, 36709, 37643, 37813, 37697)

Revert "[kubeadm] use iteration instead of recursion in function"

Reverts kubernetes/kubernetes#36625

Removing the recursive call means that `n` is never updated, so you never succeed in the update, and you've creating an infinite loop.

Also, this entire bit of functionality should be a patch and you won't have to worry about conflicts.  

@luxas
2016-12-03 08:55:59 -08:00
Kubernetes Submit Queue efa42b95a6 Merge pull request #37532 from smarterclayton/remove_export
Automatic merge from submit-queue

Remove ExportOptions from api/internal and use unversioned

Should only have one internal object in use

Part of #37530
2016-12-02 21:11:56 -08:00
Kubernetes Submit Queue c868b870e6 Merge pull request #37498 from dgoodwin/firewalld-check
Automatic merge from submit-queue (batch tested with PRs 37945, 37498, 37391, 37209, 37169)

Warn if firewalld service is enabled.

Fixes https://github.com/kubernetes/kubeadm/issues/21

Output will be:

```
(root@centos1 ~) $ kubeadm init             
Running pre-flight checks
WARNING: firewalld is active, please ensure ports [6443 9898 10250] are open
```

I went with the port list from @errordeveloper 's ansible playbook here but it's possible there should be others listed.
2016-12-02 20:32:44 -08:00
Kubernetes Submit Queue 51458a0ef0 Merge pull request #37524 from vwfs/skip_etcd_checks_reset
Automatic merge from submit-queue (batch tested with PRs 36263, 36755, 37357, 37222, 37524)

kubeadm: Skip etcd related preflight checks and reset actions for external etcd

**What this PR does / why we need it**:
Skip etcd related preflight checks and reset actions for external etcd

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # https://github.com/kubernetes/kubeadm/issues/69#issuecomment-262988388

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
kubeadm: Skip etcd related preflight checks and reset actions for external etcd
```
2016-12-02 16:26:51 -08:00
Kubernetes Submit Queue 1132d1645b Merge pull request #37222 from kad/dyn-version
Automatic merge from submit-queue (batch tested with PRs 36263, 36755, 37357, 37222, 37524)

kubeadm: Implement support for symbolic labels in --use-kubernetes-version

**What this PR does / why we need it**: This patch adds "stable", "latest" and other labels as valid versions in "kubeadm init --use-kubernetes-version" flag.

Now, defaults can be pointing to "stable" and users will always get
latest available stable build of Kubernetes via kubeadm.
There is no need anymore to hardcode version string inside kubeadm
binary.

 It is also possible to use labels like "latest" or point to exact
 branch: "stable-1.4"

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:
```release-note
- kubeadm init --use-kubernetes-version now understands "stable","latest", "stable-1.4" and other labels as valid version. It will fetch actual build number from release servers. 
```
2016-12-02 16:26:49 -08:00
Derek McQuay b3a56abed0 kubeadm: updated pkg node tests to correct type
updated ""k8s.io/kubernetes/pkg/api" to apiv1 "k8s.io/kubernetes/pkg/api/v1" to fix broken types in tests.
2016-12-02 08:42:46 -08:00
Derek McQuay 644a0ceec9 kubeadm: adding test owner and bazel update 2016-12-02 08:42:46 -08:00
Derek McQuay 49b53b8644 kubeadm: unit tests for app/master/apiclient.go 2016-12-02 08:42:46 -08:00
Derek McQuay ada63282ed kubeadm: unit tests for app/master/addons.go 2016-12-02 08:42:45 -08:00
Derek McQuay a54515d281 kubeadm: unit tests for app/master/discovery.go 2016-12-02 08:42:45 -08:00
Derek McQuay fe73a8a8ff kubeadm: unit tests for app/master/pki.go 2016-12-02 08:42:45 -08:00
Derek McQuay bd4d98fabe kubeadm: unit tests for app/master/manifests.go 2016-12-02 08:42:45 -08:00
Derek McQuay 124dab6c5a kubeadm: unit tests for app/master/kubeconfig.go 2016-12-02 08:42:45 -08:00
Derek McQuay cb3b08a8d4 kubeadm: unit tests for app/master/tokens.go 2016-12-02 08:42:45 -08:00
Kubernetes Submit Queue 53b27ef14e Merge pull request #36474 from bruceauyeung/branch-failure-check-on-umount-when-kubeadm-reset
Automatic merge from submit-queue

add failure check on umount when kubeadm reset, and on service stop

**What this PR does / why we need it**:
before this PR, `umount` will exit with code `123` if `grep` does not match anything
`xargs` has an option:

>-r, --no-run-if-empty
              If the standard input does not contain any nonblanks, do not run the command.  Normally, the command is run  once  even  if
              there is no input.  This option is a GNU extension.


1. this PR add `-r` option to `xargs` , so `umount` will not execute and exit with code `0` correctly while `grep` does not match anything.
2. this PR add failure check on umount. for example, if the directory to be umount is busy, a error message will be printed:
>failed to unmount directories in /var/lib/kubelet, umount: /var/lib/kubelet/foo/bar: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)

3. add failure check on kubelet service stop.


Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-02 05:45:03 -08:00
Kubernetes Submit Queue edefe66c78 Merge pull request #36106 from apprenda/kubeadm-unit-tests-pkg-node
Automatic merge from submit-queue

Kubeadm unit tests pkg node

Added unit tests for the kubeadm/app/node package testing functionality of bootstrap.go, csr.go, and discovery.go. 

This PR is part of the ongoing effort to add tests (#35025)

/cc @pires @jbeda
2016-12-02 05:45:01 -08:00
Kubernetes Submit Queue 9a67c20b3d Merge pull request #37327 from jasonbrooks/pr-kubeadm-selinux
Automatic merge from submit-queue

change unconfined_t to spc_t

**What this PR does / why we need it**:

When installing kube via kubeadm on a system w/ selinux enabled, it's necessary to disable selinux in order for the etcd and kube-discovery containers to run. 

The kube etcd and discovery pods are currently set to unconfined_t in order to avoid disabling selinux, but the correct type for an unconfined container is spc_t. For more information, see http://danwalsh.livejournal.com/2016/10/03/.
2016-12-02 01:00:42 -08:00
Derek McQuay d87d3ff9ca
kubeadm: updated pkg node tests to correct types
updated pkg "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" to "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5" because the type that bootstrap.go:126 checkAPIEndpoint requires changed as well as *internalversion.CertificatesClient in csr_test.go:69
2016-12-01 10:32:41 -08:00
Derek McQuay 4ab42db17e kubeadm: unit tests for app/node/ pkg 2016-12-01 09:30:19 -08:00
David Eads ce7b08af92 Revert "[kubeadm] use iteration instead of recursion in function" 2016-12-01 08:48:45 -05:00
Kubernetes Submit Queue 2fab199390 Merge pull request #36334 from luxas/add_preflight
Automatic merge from submit-queue

Add the system verification test to the kubeadm preflight checks

And refactor the system verification test to accept to write to a specific writer in order to customize the output

This PR is targeting v1.5, PTAL
cc @Random-Liu @dchen1107 @kubernetes/sig-cluster-lifecycle
2016-12-01 04:52:07 -08:00
Kubernetes Submit Queue aef15aa875 Merge pull request #36625 from bruceauyeung/branch-eliminate-recursive-call-attemptToUpdateMasterRoleLabelsAndTaints
Automatic merge from submit-queue

[kubeadm] use iteration instead of recursion in function

**What this PR does / why we need it**:

before this PR, function `attemptToUpdateMasterRoleLabelsAndTaints` recursively call itself. there are some defeats in it:
1. potential stack overflow.
2. unnecessary extra  `json.Marshal` calls.
3. unnecessary extra `client.Nodes().List` calls.

this PR rewrite `attemptToUpdateMasterRoleLabelsAndTaints` function, use iterate instead of recursion.
so these 3 defeats the metioned above are gone.
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-12-01 00:39:14 -08:00
Kubernetes Submit Queue c74fae7b14 Merge pull request #36172 from apprenda/kubeadm-tests-table-driven
Automatic merge from submit-queue

kubeadm: changed tests to be table driven

Small change to migrate tests in kubeadm/app/util/tokens_test.go to be table driven which should make adding more tests in the future easier and also have them match how other tests are being written. 

This PR is part of the ongoing effort to add tests (#35025)
2016-12-01 00:39:07 -08:00
Kubernetes Submit Queue 39e64fde8c Merge pull request #35948 from spacexnice/master
Automatic merge from submit-queue

support customize repository prefix of image through environment KUBE…

## Problem
kubeadm does not support customize repository prefix of image. this prevent us from using our own image repository to deploy k8s.

## Fix
make ```gcr.io/google_containers/ ``` be configurable.
ADD environment variable KUBE_REPO_PREFIX

Signed-off-by: yaoyao.xyy <yaoyao.xyy@alibaba-inc.com>
2016-11-30 18:39:25 -08:00
Alexander Kanevskiy 6338b7fda0 Fallback to known good stable version in case of network errors.
Hardcoded known stable version will be returned if user
didn't request specific version and kubeadm for some reason
not able to fetch latest stable information from release servers.

For now, fallback version is v1.4.6
2016-11-30 18:00:29 +02:00
Alexander Kanevskiy 39f55cb4df Added test case for KubernetesReleaseVersion 2016-11-30 18:00:29 +02:00
Alexander Kanevskiy 78e28923ba Implement support for symbolic labels in --use-kubernetes-version
Now, defaults can be pointing to "stable" and users will always get
latest available stable build of Kubernetes via kubeadm.
There is no need anymore to hardcode version string inside kubeadm
binary.

It is also possible to use labels like "latest" or point to exact
branch: "stable-1.4"
2016-11-30 18:00:29 +02:00
Kubernetes Submit Queue 40d5dca16a Merge pull request #35921 from luxas/bump_kubeadm_etcd3
Automatic merge from submit-queue

Update kubeadm etcd to 3.0.13 in order to switch to the etcd3 storage format

ref: https://github.com/kubernetes/kubernetes/issues/35723

I think we should switch as soon as possible, but run it in etcd2 mode until the full etcd3 mode is stable

@kubernetes/sig-cluster-lifecycle @wojtek-t @xiang90 @lavalamp
2016-11-28 16:52:59 -08:00
Clayton Coleman 3dde81f8d0
Remove references to v1/internal ExportOptions 2016-11-27 23:21:06 -05:00
Alexander Block de0e92b4fd Skip etcd related preflight checks and reset actions for external etcd
We should not assume ownership of etcd when external etcd endpoints were
set.

Fixes: https://github.com/kubernetes/kubeadm/issues/69
2016-11-27 12:53:07 +01:00
Devan Goodwin 16e01c65c4 Warn if firewalld service is enabled.
In future we might try to verify ports are actually exposed in firewalld
policy, but this can be quite complex. Instead lets just warn the user
if we see firewalld is running.
2016-11-25 15:37:28 -04:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Chao Xu bcc783c594 run hack/update-all.sh 2016-11-23 15:53:09 -08:00
Chao Xu e3cf383181 cmd/kubeadm 2016-11-23 15:53:09 -08:00
Jason Brooks bf153fc1d3 change unconfined_t to spc_t
The kube etcd and discovery pods are set to unconfined_t in
order to avoid disabling selinux, but the correct type for
an unconfined container is spc_t. For more information, see
http://danwalsh.livejournal.com/2016/10/03/.
2016-11-22 16:25:31 -08:00
Lucas Käldström aecb0994fb Update the default etcd version for kubeadm to 3.0.14-kubeadm 2016-11-21 16:41:56 +02:00
Derek McQuay bff1af69e9 kubeadm: fixed typo in kubeadm/app/master/pki.go 2016-11-15 09:55:27 -08:00
Derek McQuay 4f035181cb kubeadm: changed tests to be table driven
This change was to make tests found in tokens_test.go be table driven to
match other testing development that has been going on in kubeadm.
2016-11-15 09:55:27 -08:00
yupeng 62681dbe73 type HttpProxyCheck should be HTTPProxyCheck
Signed-off-by: yupeng <yu.peng36@zte.com.cn>
2016-11-14 15:04:58 +08:00
Lucas Käldström a26cbbf3d0 Add the system verification check to the kubeadm preflight checks 2016-11-12 16:37:12 +02:00
bruceauyeung f3c5a6ef8f eliminate recursive call attemptToUpdateMasterRoleLabelsAndTaints
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-11-11 12:25:36 +08:00
bruceauyeung 06a6ec2181 add failure check on umount when kubeadm reset, and on service stop
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-11-09 10:55:34 +08:00
Kubernetes Submit Queue 9761442b19 Merge pull request #36040 from bruceauyeung/add-master-address-desc-into-kubeadm-join-and-some-validations
Automatic merge from submit-queue

add master address into kubeadm join help message and some validations

**What this PR does / why we need it**:

1, add master address into kubeadm join help message. looks like :

>Usage:
>  kubeadm join <master address> [flags]

2, when user provides more than one master address, return an error.

3, since `kubeadm join` not only support ip addresses but also host names or domain names, so i delete the word `ip` from error message `must specify master ip address (see --help)`


Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-11-08 14:52:09 -08:00
Kubernetes Submit Queue 15fa0df93e Merge pull request #35975 from justinsb/role_labels_2
Automatic merge from submit-queue

Add constants for node role labels
2016-11-07 15:02:58 -08:00
Kubernetes Submit Queue afa99c68b8 Merge pull request #35144 from pipejakob/generate-token
Automatic merge from submit-queue

New command: "kubeadm token generate"

As part of #33930, this PR adds a new top-level command to kubeadm to just generate a token for use with the init/join commands. Otherwise, users are left to either figure out how to generate a token on their own, or let `kubeadm init` generate a token, capture and parse the output, and then use that token for `kubeadm join`.

At this point, I was hoping for feedback on the CLI experience, and then I can add tests. I spoke with @mikedanese and he didn't like the original propose of `kubeadm util generate-token`, so here are the runners up:

```
$ kubeadm generate-token          # <--- current implementation
$ kubeadm generate token          # in case kubeadm might generate other things in the future?
$ kubeadm init --generate-token   # possibly as a subcommand of an existing one
```

Currently, the output is simply the token on one line without any padding/formatting:

```
$ kubeadm generate-token
1087fd.722b60cdd39b1a5f
```

CC: @kubernetes/sig-cluster-lifecycle 

**Release note**:

<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->

``` release-note
New kubeadm command: generate-token
```
2016-11-05 16:12:52 -07:00
Justin Santa Barbara cef8315ae8 Add constants for node role labels
Rather than sharing well-known strings, we should be declaring these in
the API.
2016-11-04 18:00:35 -04:00
yaoyao.xyy 73244f078c support customize repository prefix of image through environment KUBE_REPO_PREFIX=gcr.io/google_containers/.
Signed-off-by: yaoyao.xyy <yaoyao.xyy@alibaba-inc.com>
2016-11-04 16:17:01 +08:00
bruceauyeung 3616a04177 add master address desc into kubeadm join and some validations
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
2016-11-03 10:07:39 +08:00
Devan Goodwin fe03e1319f Fix preflight check failure on node join.
We recently improved this to tolerate existence of things like
/etc/kubernetes/manifests/ as an empty dir, but forgot to do so for the
join pre-flight checks where it is also failing.

Instead ensure only the sub-directories and files we need are available.
2016-11-02 16:09:09 -03:00
Kubernetes Submit Queue 7d14b568c3 Merge pull request #36001 from smarterclayton/change_double_decode
Automatic merge from submit-queue

Avoid double decoding all client responses

Fixes #35982 

The linked issue uncovered that we were always double decoding the response in restclient for get, list, update, create, and patch.  That's fairly expensive, most especially for list.  This PR refines the behavior of the rest client to avoid double decoding, and does so while minimizing the changes to rest client consumers.

restclient must be able to deal with multiple types of servers. Alter the behavior of restclient.Result#Raw() to not process the body on error, but instead to return the generic error (which still matches the error checking cases in api/error like IsBadRequest). If the caller uses
.Error(), .Into(), or .Get(), try decoding the body as a Status.

For older servers, continue to default apiVersion "v1" when calling restclient.Result#Error(). This was only for 1.1 servers and the extensions group, which we have since fixed.

This removes a double decode of very large objects (like LIST) - we were trying to DecodeInto status, but that ends up decoding the entire result and then throwing it away.  This makes the decode behavior specific to the type of action the user wants.

```release-note
The error handling behavior of `pkg/client/restclient.Result` has changed.  Calls to `Result.Raw()` will no longer parse the body, although they will still return errors that react to `pkg/api/errors.Is*()` as in previous releases.  Callers of `Get()` and `Into()` will continue to receive errors that are parsed from the body if the kind and apiVersion of the body match the `Status` object.

This more closely aligns rest client as a generic RESTful client, while preserving the special Kube API extended error handling for the `Get` and `Into` methods (which most Kube clients use).
```
2016-11-02 11:36:41 -07:00
Kubernetes Submit Queue c6c06f5492 Merge pull request #36025 from mikedanese/kubeadm_config_defaults
Automatic merge from submit-queue

kubeadm: move defaulting to the api group

ref #35796

@pires @kubernetes/sig-cluster-lifecycle
2016-11-02 03:51:00 -07:00