Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c272bc56
Unverified
Commit
c272bc56
authored
Jan 06, 2017
by
Paulo Pires
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubeadm: flag token discovery pieces to be refactored.
parent
a5193353
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
discovery.go
cmd/kubeadm/app/discovery/discovery.go
+9
-0
csr.go
cmd/kubeadm/app/node/csr.go
+3
-2
No files found.
cmd/kubeadm/app/discovery/discovery.go
View file @
c272bc56
...
...
@@ -22,6 +22,7 @@ import (
"net/http"
kubeadmapi
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
)
...
...
@@ -33,6 +34,9 @@ func For(d kubeadmapi.Discovery) (*clientcmdapi.Config, error) {
return
runFileDiscovery
(
d
.
File
)
case
d
.
HTTPS
!=
nil
:
return
runHTTPSDiscovery
(
d
.
HTTPS
)
case
d
.
Token
!=
nil
:
// TODO move token discovery here
return
runTokenDiscovery
(
d
.
Token
)
default
:
return
nil
,
fmt
.
Errorf
(
"Couldn't find a valid discovery configuration. Please provide one."
)
}
...
...
@@ -58,4 +62,9 @@ func runHTTPSDiscovery(hd *kubeadmapi.HTTPSDiscovery) (*clientcmdapi.Config, err
return
clientcmd
.
Load
(
kubeconfig
)
}
// TODO implement
// runTokenDiscovery executes token-based discovery.
func
runTokenDiscovery
(
td
*
kubeadmapi
.
TokenDiscovery
)
(
*
clientcmdapi
.
Config
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"Couldn't find a valid discovery configuration. Please provide one."
)
}
cmd/kubeadm/app/node/csr.go
View file @
c272bc56
...
...
@@ -29,12 +29,13 @@ import (
certutil
"k8s.io/kubernetes/pkg/util/cert"
)
// TODO @mikedanese move this to PerformTLSBootstrap
func
PerformTLSBootstrapDeprecated
(
connection
*
ConnectionDetails
)
(
*
clientcmdapi
.
Config
,
error
)
{
fmt
.
Println
(
"[csr] Created API client to obtain unique certificate for this node, generating keys and certificate signing request"
)
key
,
err
:=
certutil
.
MakeEllipticPrivateKeyPEM
()
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to generat
ing
private key [%v]"
,
err
)
return
nil
,
fmt
.
Errorf
(
"failed to generat
e
private key [%v]"
,
err
)
}
cert
,
err
:=
csr
.
RequestNodeCertificate
(
connection
.
CertClient
.
CertificateSigningRequests
(),
key
,
connection
.
NodeName
)
if
err
!=
nil
{
...
...
@@ -80,7 +81,7 @@ func PerformTLSBootstrap(cfg *clientcmdapi.Config) error {
key
,
err
:=
certutil
.
MakeEllipticPrivateKeyPEM
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to generat
ing
private key [%v]"
,
err
)
return
fmt
.
Errorf
(
"failed to generat
e
private key [%v]"
,
err
)
}
cert
,
err
:=
csr
.
RequestNodeCertificate
(
c
.
Certificates
()
.
CertificateSigningRequests
(),
key
,
name
)
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment