Skip to content

Commit

Permalink
kubeadm: use kubelet bootstrap instead of reimplementing
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedanese committed Jul 27, 2017
1 parent 3a0d8f8 commit fe7ba9e
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 90 deletions.
2 changes: 1 addition & 1 deletion build/debs/kubeadm-10.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
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"
Expand Down
2 changes: 0 additions & 2 deletions cmd/kubeadm/app/cmd/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ go_library(
"//cmd/kubeadm/app/cmd/phases:go_default_library",
"//cmd/kubeadm/app/constants:go_default_library",
"//cmd/kubeadm/app/discovery:go_default_library",
"//cmd/kubeadm/app/node:go_default_library",
"//cmd/kubeadm/app/phases/addons:go_default_library",
"//cmd/kubeadm/app/phases/apiconfig:go_default_library",
"//cmd/kubeadm/app/phases/controlplane:go_default_library",
Expand All @@ -46,7 +45,6 @@ go_library(
"//pkg/printers:go_default_library",
"//pkg/util/i18n:go_default_library",
"//pkg/util/initsystem:go_default_library",
"//pkg/util/node:go_default_library",
"//pkg/util/version:go_default_library",
"//pkg/version:go_default_library",
"//vendor/github.com/ghodss/yaml:go_default_library",
Expand Down
17 changes: 1 addition & 16 deletions cmd/kubeadm/app/cmd/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ import (
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/validation"
kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
"k8s.io/kubernetes/cmd/kubeadm/app/discovery"
kubeadmnode "k8s.io/kubernetes/cmd/kubeadm/app/node"
"k8s.io/kubernetes/cmd/kubeadm/app/preflight"
kubeadmutil "k8s.io/kubernetes/cmd/kubeadm/app/util"
kubeconfigutil "k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig"
"k8s.io/kubernetes/pkg/api"
nodeutil "k8s.io/kubernetes/pkg/util/node"
)

var (
Expand Down Expand Up @@ -178,20 +176,7 @@ func (j *Join) Run(out io.Writer) error {
return err
}

hostname := nodeutil.GetHostname(j.cfg.NodeName)

client, err := kubeconfigutil.KubeConfigToClientSet(cfg)
if err != nil {
return err
}
if err := kubeadmnode.ValidateAPIServer(client); err != nil {
return err
}
if err := kubeadmnode.PerformTLSBootstrap(cfg, hostname); err != nil {
return err
}

kubeconfigFile := filepath.Join(kubeadmconstants.KubernetesDir, kubeadmconstants.KubeletKubeConfigFileName)
kubeconfigFile := filepath.Join(kubeadmconstants.KubernetesDir, kubeadmconstants.KubeletBootstrapKubeConfigFileName)
if err := kubeconfigutil.WriteToDisk(kubeconfigFile, cfg); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions cmd/kubeadm/app/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const (
FrontProxyClientCertCommonName = "front-proxy-client" //used as subject.commonname attribute (CN)

AdminKubeConfigFileName = "admin.conf"
KubeletBootstrapKubeConfigFileName = "bootstrap-kubelet.conf"
KubeletKubeConfigFileName = "kubelet.conf"
ControllerManagerKubeConfigFileName = "controller-manager.conf"
SchedulerKubeConfigFileName = "scheduler.conf"
Expand Down
10 changes: 1 addition & 9 deletions cmd/kubeadm/app/node/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@ load(

go_library(
name = "go_default_library",
srcs = [
"csr.go",
"validate.go",
],
srcs = ["validate.go"],
tags = ["automanaged"],
deps = [
"//cmd/kubeadm/app/util/kubeconfig:go_default_library",
"//pkg/kubelet/util/csr:go_default_library",
"//vendor/k8s.io/api/certificates/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library",
"//vendor/k8s.io/client-go/util/cert:go_default_library",
],
)

Expand Down
61 changes: 0 additions & 61 deletions cmd/kubeadm/app/node/csr.go

This file was deleted.

1 change: 0 additions & 1 deletion hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ cmd/kubeadm/app/discovery
cmd/kubeadm/app/discovery/file
cmd/kubeadm/app/discovery/token
cmd/kubeadm/app/images
cmd/kubeadm/app/node
cmd/kubeadm/app/phases/addons
cmd/kubeadm/app/phases/certs/pkiutil
cmd/kubeadm/app/phases/token
Expand Down

0 comments on commit fe7ba9e

Please sign in to comment.