Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 'get node' call during bootstrapping #40873

Merged
merged 1 commit into from Feb 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions cmd/kubeadm/app/node/BUILD
Expand Up @@ -24,8 +24,6 @@ go_library(
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/kubelet/util/csr:go_default_library",
"//vendor:github.com/square/go-jose",
"//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/client-go/tools/clientcmd",
Expand Down
15 changes: 0 additions & 15 deletions cmd/kubeadm/app/node/bootstrap.go
Expand Up @@ -22,8 +22,6 @@ import (
"sync"
"time"

apierrs "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -124,19 +122,6 @@ func createClients(caCert []byte, endpoint, token string, nodeName types.NodeNam
return ac, nil
}

// checkForNodeNameDuplicates checks whether there are other nodes in the cluster with identical node names.
func checkForNodeNameDuplicates(clientSet *clientset.Clientset) error {
hostName, err := os.Hostname()
if err != nil {
return fmt.Errorf("Failed to get node hostname [%v]", err)
}
_, err = clientSet.Nodes().Get(hostName, metav1.GetOptions{})
if err != nil && !apierrs.IsNotFound(err) {
return err
}
return nil
}

// checks the connection requirements for a specific API endpoint
func checkAPIEndpoint(clientSet *clientset.Clientset, endpoint string) error {
// check general connectivity
Expand Down
5 changes: 0 additions & 5 deletions cmd/kubeadm/app/node/csr.go
Expand Up @@ -51,11 +51,6 @@ func PerformTLSBootstrap(cfg *clientcmdapi.Config) error {
return fmt.Errorf("failed to generate private key [%v]", err)
}

// Make sure there are no other nodes in the cluster with identical node name.
if err := checkForNodeNameDuplicates(c); err != nil {
return err
}

cert, err := csr.RequestNodeCertificate(c.Certificates().CertificateSigningRequests(), key, name)
if err != nil {
return fmt.Errorf("failed to request signed certificate from the API server [%v]", err)
Expand Down
2 changes: 0 additions & 2 deletions plugin/pkg/auth/authorizer/rbac/bootstrappolicy/policy.go
Expand Up @@ -244,8 +244,6 @@ func ClusterRoles() []rbac.ClusterRole {
// a role to use for bootstrapping a node's client certificates
ObjectMeta: metav1.ObjectMeta{Name: "system:node-bootstrapper"},
Rules: []rbac.PolicyRule{
// used to check if the node already exists
rbac.NewRule("get").Groups(legacyGroup).Resources("nodes").RuleOrDie(),
// used to create a certificatesigningrequest for a node-specific client certificate, and watch for it to be signed
rbac.NewRule("create", "get", "list", "watch").Groups(certificatesGroup).Resources("certificatesigningrequests").RuleOrDie(),
},
Expand Down
Expand Up @@ -577,12 +577,6 @@ items:
kubernetes.io/bootstrapping: rbac-defaults
name: system:node-bootstrapper
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- certificates.k8s.io
resources:
Expand Down