Commit Graph

106 Commits

Author SHA1 Message Date
Dave Chen
8c7609fbe2 kubeadm: bump to use golang generic
Signed-off-by: Dave Chen <dave.chen@arm.com>
2022-12-14 10:31:18 +08:00
Paco Xu
241445759e add go:build no windows for some control-plane related UT for kubeadm 2022-09-26 17:17:41 +08:00
Claudiu Belu
d192029e6a unittests: Fixes cmd unit tests for Windows
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- filepath.IsAbs does not consider "/" or "\" as absolute paths, even
  though files can be addressed as such.
- paths not properly joined (filepath.Join should be used).
- files not closed, which means that they cannot be removed / renamed.
- some assertions fail due to slashes / backslashes not matching.
- backslashes need to be escaped in yaml files, or put between ''
instead of "".
2022-08-26 16:03:13 +03:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08:00
Kubernetes Prow Robot
bf000e8770
Merge pull request #104770 from pacoxu/dual-stack-ga-kubeadm
cleanup: DualStack GA for kubeadm
2021-09-28 03:42:42 -07:00
Paco Xu
751ad37a05 kubeadm: cleanup remove some empty feature gate for dual-stack 2021-09-28 15:34:26 +08:00
Paco Xu
0b8433a3f5 kubeadm: remove --port from kube-scheduler manifest 2021-09-15 12:58:35 +08:00
Paco Xu
1385bd3a06 kubeadm: fix ut failures of dualstack GA 2021-09-14 13:16:40 +08:00
Paco Xu
a0cc3f1c9a cleanup: DualStack GA for kubeadm 2021-09-04 22:38:14 +08:00
XinYang
72fd01095d
re-order imports for kubeadm
Signed-off-by: XinYang <xinydev@gmail.com>
2021-08-17 22:40:46 +08:00
Jian Zeng
c486b229d2 refactor(kubeadm): remove the flag --port from KCM manifest
Signed-off-by: Jian Zeng <zengjian.zj@bytedance.com>
2021-08-05 19:51:02 +08:00
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
Vinayak Goyal
e6bf19bcf6 Update CreateInitStaticPodManifestFiles, CreateStaticPodFiles and CreateLocalEtcdStaticPodManifestFile to take into account if the command was run as dry-run. 2021-06-09 15:01:42 -07:00
pacoxu
a074ccfe36 remove --insecure-port in kubeadm 2021-05-19 11:48:07 +08:00
Kubernetes Prow Robot
15213128e1
Merge pull request #99687 from pacoxu/dual-stack/follow-up-1
cleanup: disable dual stack for some manifest UT
2021-03-04 00:29:23 -08:00
pacoxu
496deb6df9 cleanup: disable dual stack for some manifest UT 2021-03-03 16:00:20 +08:00
SataQiu
2ba178c92c kubeadm: skip validating pod subnet against node-cidr-mask when allocate-node-cidrs is set to be false 2021-03-01 11:19:47 +08:00
Jordan Liggitt
8761972f68 Use private key fixtures for kubeadm unit tests 2021-02-01 10:06:10 -05:00
Shihang Zhang
ff641f6eb2 mv TokenRequest and TokenRequestProjection to GA 2020-10-29 20:47:01 -07:00
Antonio Ojea
8b52995d32 kubeadm: validate podSubnet against node-cidr-mask
the controller manager should validate the podSubnet against the node-mask
because if they are incorrect can cause the controller-manager to fail.

We don't need to calculate the node-cidr-masks, because those should
be provided by the user, if they are wrong we fail in validation.
2020-10-22 16:24:13 +02:00
Lubomir I. Ivanov
8ece27bf4b kubeadm: remove the --experimental-kustomize feature
The feature was replaced by --experimental-patches and deprecated in
1.19.
2020-09-18 03:49:53 +03:00
Kubernetes Prow Robot
046ac5100e
Merge pull request #92720 from neolit123/1.19-add-kcm-port
kubeadm: add --port=0 for kube-controller-manager and kube-scheduler
2020-07-03 05:03:25 -07:00
Lubomir I. Ivanov
f66513d98a kubeadm: add --port=0 for kube-controller-manager and kube-scheduler
Kubeadm setup of kube-controller-manager and kube-scheduler is
lacking the --port=0 option which caused the component to enable
the insecure port by default and serve insecurely on the default
node interface.

Add --port=0 by default to both components. Users are still allowed
the explicitly set the flag (via extraArgs), which allows them
to override this default kubeadm behavior and enable the insecure port.

NOTE: the flag is deprecated and should be removed from kubeadm manifests
once it's removed from core.
2020-07-01 22:23:21 +03:00
Lubomir I. Ivanov
ceb768ccbd kubeadm: apply patches to static Pods
Add PatchStaticPod() in staticpod/utils.go

Apply patches to static Pods in:
- phases/controlplane/CreateStaticPodFiles()
- phases/etcd/CreateLocalEtcdStaticPodManifestFile() and
CreateStackedEtcdStaticPodManifestFile()

Add unit tests and update Bazel.
2020-06-26 02:14:47 +03:00
Lubomir I. Ivanov
144778db83 kubeadm: plumb the patches option trough init/join/upgrade
This changes adds the "patches" option in all places where
the "kustomize" option is already present.
2020-06-26 02:14:47 +03:00
Kubernetes Prow Robot
613cd04d8c
Merge pull request #90064 from neolit123/1.19-fix-authz-warning
kubeadm: fix misleading warning for authz modes
2020-04-23 12:32:06 -07:00
SataQiu
35f3f82029 kubeadm: remove the dependence on /pkg/features
Signed-off-by: SataQiu <1527062125@qq.com>
2020-04-12 15:05:44 +08:00
Lubomir I. Ivanov
6cfd772401 kubeadm: fix misleading warning for authz modes
kubeadm init prints:
  W0410 23:02:10.119723   13040 manifests.go:225] the default kube-apiserver
  authorization-mode is "Node,RBAC"; using "Node,RBAC"

Add a new function compareAuthzModes() and a unit test for it.
Make sure the warning is printed only if the user modes don't match
the defaults.
2020-04-10 23:45:40 +03:00
Kubernetes Prow Robot
3769de9401
Merge pull request #85745 from aojea/kubeadm_etcd_ipv6
kubeadm: default etcd address based on the IP family
2019-12-02 15:02:58 -08:00
Rafael Fernández López
f0ea7bcf9e
kubeadm: set cluster name on the controller manager
On kubeadm's configuration it's possible to set up the cluster
name. Forward this information to the controller manager's
`--cluster-name` argument.
2019-12-02 18:32:50 +01:00
Antonio Ojea
335a3e9efb kubeadm: use correct IP family for etcd localhost
kubeadm always use the IPv4 localhost address by defaultA for etcd

The probe hostname is obtained before the generation of the etcd
parameters, so it can't detect the right IP familiy for the
host of the probe.
This causes that with IPv6 clusters doesn't work because the probe
uses the IPv4 localhost address.

This patchs configures the right localhost address based on the used
AdvertiseAddress IP family.
2019-11-30 17:25:30 +01:00
Arvinderpal Wander
e8ee8622b8 Add support for new dual-stack flags for kubernetes-controller-
manager in kubeadm:
 - node-cidr-mask-size-ipv4
 - node-cidr-mask-size-ipv6
2019-11-25 09:11:16 -08:00
Thomas Gosteli
40ab042f90 kubeadm: preserve order of user specified apiserver authorization-mode 2019-09-12 15:30:12 +02:00
fabriziopandini
97181595f0 kubeadm-kustomize-core 2019-08-12 14:16:51 +02:00
Ed Bartosh
b4300ec24e kubeadm: remove dependency on pkg/kubeapiserver/authorizer/modes
Moved 2 more constants from pkg/kubeapiserver/authorizer/modes
to kubeadm/app/constants module to remove dependency.
2019-08-08 12:08:23 +03:00
Lubomir I. Ivanov
e142bf6203 kubeadm: enable secure serving for the kube-scheduler
Secure serving was already enabled for kube-controller-manager.
Do the same for kube-scheduler, by passing the flags
"authentication-kubeconfig" and "authorization-kubeconfig"
to the binary in the static Pod.

This change allows the scheduler to perform reviews on incoming
requests, such as:
- authentication.k8s.io/v1beta1 TokenReview
- authorization.k8s.io/v1 SubjectAccessReview

The authentication and authorization checks for "system:kube-scheduler"
users were previously enabled by PR 72491.
2019-08-03 19:15:32 +03:00
SataQiu
b23772df80 kubeadm: cleanup unnecessary k8sVer parameter for GetStaticPodSpecs 2019-07-13 00:26:07 +08:00
Arvinderpal Wander
7634cc01c5 Fix kubeadm service-cidr mapping to service-cluster-ip-rage for
kube-controller-manager.

If a service CIDR that overlaps with the cluster CIDR is
specified to kube-controller-manager then kube-controller-
manager will incorrectly allocate node CIDRs that overlap
with the service CIDR. The fix ensure that kubeadm
maps the --service-cidr to --service-cluster-ip-range for use
by kube-controller-manager.

As per docs, --allocate-node-cidrs must be true for
--service-cluster-ip-range to be considered. It does not make
sense for --cluster-cidr to be unspecified but for
--service-cluster-ip-range and --allocate-node-cidrs to be
set, since the purpose of these options is to have the
controller-manager do the per node CIDR allocation. Also
note that --service-cluster-ip-range is passed to the
api-server, so the presence of *just*
--service-cluster-ip-range should not imply that
--allocate-node-cidrs should be true.

Resolves: kubernetes/kubeadm/issues/1591
2019-06-05 06:53:32 -07:00
Ed Bartosh
296df304a4 kubeadm: use t.Run in app/phases
Used T.Run API for kubeadm tests in app/phases/*

This should improve testing output and make it more visible
which test is doing what.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2019-03-27 19:39:30 +01:00
Jordan Liggitt
d4591ea324 Revert "Stop using API server's --insecure-port"
This reverts commit 5b64a98689.
2019-03-16 16:24:49 -04:00
Ed Bartosh
39871f565d kubeadm: remove dead code
Removed unused functions and variables from
the kubeadm codebase.
2019-02-22 23:01:14 +01:00
Rostislav M. Georgiev
80e2a3cf07 kubeadm: reduce the usage of InitConfiguration
For historical reasons InitConfiguration is used almost everywhere in kubeadm
as a carrier of various configuration components such as ClusterConfiguration,
local API server endpoint, node registration settings, etc.

Since v1alpha2, InitConfiguration is meant to be used solely as a way to supply
the kubeadm init configuration from a config file. Its usage outside of this
context is caused by technical dept, it's clunky and requires hacks to fetch a
working InitConfiguration from the cluster (as it's not stored in the config
map in its entirety).

This change is a small step towards removing all unnecessary usages of
InitConfiguration. It reduces its usage by replacing it in some places with
some of the following:

- ClusterConfiguration only.
- APIEndpoint (as local API server endpoint).
- NodeRegistrationOptions only.
- Some combinations of the above types, or if single fields from them are used,
  only those field.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
2019-01-28 12:21:01 +02:00
RA489
5b64a98689 Stop using API server's --insecure-port 2019-01-22 17:31:39 +05:30
fabriziopandini
ada466dc67 cleanup-getControllerManagerCommand 2019-01-04 14:08:04 +01:00
Kubernetes Prow Robot
993c65634e
Merge pull request #71973 from MalloZup/fix-1234
Exclude by default address flag fix #1234
2019-01-01 05:36:18 -08:00
dmaiocchi
6148992056 Replace address with bind-address 2018-12-20 22:14:16 +01: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
1d38de3a29 fix test names for manifests
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2018-11-22 15:30:24 +08:00
Yago Nobre
62c9303ecf
Remove DynamicKubeletConfig from init and join workflow, also remove DynamicKubeletConfig feature gate 2018-11-13 11:56:24 -02:00
Marek
064f74b2e8 fixes kubeadm 1221 to remove AuditPolicyConfiguration
Added conversion test and failure.
2018-11-12 14:33:26 -05:00