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
50bf223a
Unverified
Commit
50bf223a
authored
Mar 11, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75224 from neolit123/certs-print-key-on-phase
kubeadm: print key inside the upload-certs phase of init
parents
4ea48886
c5c4cd25
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
3 deletions
+13
-3
init.go
cmd/kubeadm/app/cmd/init.go
+5
-0
data.go
cmd/kubeadm/app/cmd/phases/init/data.go
+1
-0
data_test.go
cmd/kubeadm/app/cmd/phases/init/data_test.go
+1
-0
uploadcerts.go
cmd/kubeadm/app/cmd/phases/init/uploadcerts.go
+5
-2
copycerts.go
cmd/kubeadm/app/phases/copycerts/copycerts.go
+1
-1
No files found.
cmd/kubeadm/app/cmd/init.go
View file @
50bf223a
...
@@ -379,6 +379,11 @@ func (d *initData) SetCertificateKey(key string) {
...
@@ -379,6 +379,11 @@ func (d *initData) SetCertificateKey(key string) {
d
.
certificateKey
=
key
d
.
certificateKey
=
key
}
}
// SkipCertificateKeyPrint returns the skipCertificateKeyPrint flag.
func
(
d
*
initData
)
SkipCertificateKeyPrint
()
bool
{
return
d
.
skipCertificateKeyPrint
}
// Cfg returns initConfiguration.
// Cfg returns initConfiguration.
func
(
d
*
initData
)
Cfg
()
*
kubeadmapi
.
InitConfiguration
{
func
(
d
*
initData
)
Cfg
()
*
kubeadmapi
.
InitConfiguration
{
return
d
.
cfg
return
d
.
cfg
...
...
cmd/kubeadm/app/cmd/phases/init/data.go
View file @
50bf223a
...
@@ -30,6 +30,7 @@ type InitData interface {
...
@@ -30,6 +30,7 @@ type InitData interface {
UploadCerts
()
bool
UploadCerts
()
bool
CertificateKey
()
string
CertificateKey
()
string
SetCertificateKey
(
key
string
)
SetCertificateKey
(
key
string
)
SkipCertificateKeyPrint
()
bool
Cfg
()
*
kubeadmapi
.
InitConfiguration
Cfg
()
*
kubeadmapi
.
InitConfiguration
DryRun
()
bool
DryRun
()
bool
SkipTokenPrint
()
bool
SkipTokenPrint
()
bool
...
...
cmd/kubeadm/app/cmd/phases/init/data_test.go
View file @
50bf223a
...
@@ -33,6 +33,7 @@ var _ InitData = &testInitData{}
...
@@ -33,6 +33,7 @@ var _ InitData = &testInitData{}
func
(
t
*
testInitData
)
UploadCerts
()
bool
{
return
false
}
func
(
t
*
testInitData
)
UploadCerts
()
bool
{
return
false
}
func
(
t
*
testInitData
)
CertificateKey
()
string
{
return
""
}
func
(
t
*
testInitData
)
CertificateKey
()
string
{
return
""
}
func
(
t
*
testInitData
)
SetCertificateKey
(
key
string
)
{}
func
(
t
*
testInitData
)
SetCertificateKey
(
key
string
)
{}
func
(
t
*
testInitData
)
SkipCertificateKeyPrint
()
bool
{
return
false
}
func
(
t
*
testInitData
)
Cfg
()
*
kubeadmapi
.
InitConfiguration
{
return
nil
}
func
(
t
*
testInitData
)
Cfg
()
*
kubeadmapi
.
InitConfiguration
{
return
nil
}
func
(
t
*
testInitData
)
DryRun
()
bool
{
return
false
}
func
(
t
*
testInitData
)
DryRun
()
bool
{
return
false
}
func
(
t
*
testInitData
)
SkipTokenPrint
()
bool
{
return
false
}
func
(
t
*
testInitData
)
SkipTokenPrint
()
bool
{
return
false
}
...
...
cmd/kubeadm/app/cmd/phases/init/uploadcerts.go
View file @
50bf223a
...
@@ -21,7 +21,6 @@ import (
...
@@ -21,7 +21,6 @@ import (
"github.com/pkg/errors"
"github.com/pkg/errors"
"k8s.io/klog"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/options"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow"
cmdutil
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
cmdutil
"k8s.io/kubernetes/cmd/kubeadm/app/cmd/util"
...
@@ -40,6 +39,7 @@ func NewUploadCertsPhase() workflow.Phase {
...
@@ -40,6 +39,7 @@ func NewUploadCertsPhase() workflow.Phase {
options
.
CfgPath
,
options
.
CfgPath
,
options
.
UploadCerts
,
options
.
UploadCerts
,
options
.
CertificateKey
,
options
.
CertificateKey
,
options
.
SkipCertificateKeyPrint
,
},
},
}
}
}
}
...
@@ -51,7 +51,7 @@ func runUploadCerts(c workflow.RunData) error {
...
@@ -51,7 +51,7 @@ func runUploadCerts(c workflow.RunData) error {
}
}
if
!
data
.
UploadCerts
()
{
if
!
data
.
UploadCerts
()
{
klog
.
V
(
1
)
.
Infoln
(
"[upload-certs] Skipping certs upload"
)
fmt
.
Printf
(
"[upload-certs] Skipping phase. Please see --%s
\n
"
,
options
.
UploadCerts
)
return
nil
return
nil
}
}
client
,
err
:=
data
.
Client
()
client
,
err
:=
data
.
Client
()
...
@@ -70,5 +70,8 @@ func runUploadCerts(c workflow.RunData) error {
...
@@ -70,5 +70,8 @@ func runUploadCerts(c workflow.RunData) error {
if
err
:=
copycerts
.
UploadCerts
(
client
,
data
.
Cfg
(),
data
.
CertificateKey
());
err
!=
nil
{
if
err
:=
copycerts
.
UploadCerts
(
client
,
data
.
Cfg
(),
data
.
CertificateKey
());
err
!=
nil
{
return
errors
.
Wrap
(
err
,
"error uploading certs"
)
return
errors
.
Wrap
(
err
,
"error uploading certs"
)
}
}
if
!
data
.
SkipCertificateKeyPrint
()
{
fmt
.
Printf
(
"[upload-certs] Using certificate key:
\n
%s
\n
"
,
data
.
CertificateKey
())
}
return
nil
return
nil
}
}
cmd/kubeadm/app/phases/copycerts/copycerts.go
View file @
50bf223a
...
@@ -85,7 +85,7 @@ func CreateCertificateKey() (string, error) {
...
@@ -85,7 +85,7 @@ func CreateCertificateKey() (string, error) {
//UploadCerts save certs needs to join a new control-plane on kubeadm-certs sercret.
//UploadCerts save certs needs to join a new control-plane on kubeadm-certs sercret.
func
UploadCerts
(
client
clientset
.
Interface
,
cfg
*
kubeadmapi
.
InitConfiguration
,
key
string
)
error
{
func
UploadCerts
(
client
clientset
.
Interface
,
cfg
*
kubeadmapi
.
InitConfiguration
,
key
string
)
error
{
fmt
.
Printf
(
"[upload-certs]
s
toring the certificates in ConfigMap %q in the %q Namespace
\n
"
,
kubeadmconstants
.
KubeadmCertsSecret
,
metav1
.
NamespaceSystem
)
fmt
.
Printf
(
"[upload-certs]
S
toring the certificates in ConfigMap %q in the %q Namespace
\n
"
,
kubeadmconstants
.
KubeadmCertsSecret
,
metav1
.
NamespaceSystem
)
decodedKey
,
err
:=
hex
.
DecodeString
(
key
)
decodedKey
,
err
:=
hex
.
DecodeString
(
key
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
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