Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Rke
Commits
ad678b6a
Commit
ad678b6a
authored
5 years ago
by
Dax McDonald
Committed by
Alena Prokharchyk
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Remove dead code
parent
8022b815
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
cluster/certificates.go
+0
-33
cluster/certificates.go
cluster/cluster.go
+0
-8
cluster/cluster.go
cmd/cert.go
+0
-4
cmd/cert.go
pki/util.go
+0
-14
pki/util.go
services/workerplane.go
+1
-9
services/workerplane.go
with
1 addition
and
68 deletions
+1
-68
cluster/certificates.go
+
0
-
33
View file @
ad678b6a
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"github.com/rancher/rke/pki"
"github.com/rancher/rke/pki"
"github.com/rancher/rke/pki/cert"
"github.com/rancher/rke/pki/cert"
"github.com/rancher/rke/services"
"github.com/rancher/rke/services"
"github.com/sirupsen/logrus"
)
)
func
SetUpAuthentication
(
ctx
context
.
Context
,
kubeCluster
,
currentCluster
*
Cluster
,
fullState
*
FullState
)
error
{
func
SetUpAuthentication
(
ctx
context
.
Context
,
kubeCluster
,
currentCluster
*
Cluster
,
fullState
*
FullState
)
error
{
...
@@ -24,20 +23,6 @@ func SetUpAuthentication(ctx context.Context, kubeCluster, currentCluster *Clust
...
@@ -24,20 +23,6 @@ func SetUpAuthentication(ctx context.Context, kubeCluster, currentCluster *Clust
return
nil
return
nil
}
}
func
regenerateAPICertificate
(
c
*
Cluster
,
certificates
map
[
string
]
pki
.
CertificatePKI
)
(
map
[
string
]
pki
.
CertificatePKI
,
error
)
{
logrus
.
Debugf
(
"[certificates] Regenerating kubeAPI certificate"
)
kubeAPIAltNames
:=
pki
.
GetAltNames
(
c
.
ControlPlaneHosts
,
c
.
ClusterDomain
,
c
.
KubernetesServiceIP
,
c
.
Authentication
.
SANs
)
caCrt
:=
certificates
[
pki
.
CACertName
]
.
Certificate
caKey
:=
certificates
[
pki
.
CACertName
]
.
Key
kubeAPIKey
:=
certificates
[
pki
.
KubeAPICertName
]
.
Key
kubeAPICert
,
_
,
err
:=
pki
.
GenerateSignedCertAndKey
(
caCrt
,
caKey
,
true
,
pki
.
KubeAPICertName
,
kubeAPIAltNames
,
kubeAPIKey
,
nil
)
if
err
!=
nil
{
return
nil
,
err
}
certificates
[
pki
.
KubeAPICertName
]
=
pki
.
ToCertObject
(
pki
.
KubeAPICertName
,
""
,
""
,
kubeAPICert
,
kubeAPIKey
,
nil
)
return
certificates
,
nil
}
func
GetClusterCertsFromKubernetes
(
ctx
context
.
Context
,
kubeCluster
*
Cluster
)
(
map
[
string
]
pki
.
CertificatePKI
,
error
)
{
func
GetClusterCertsFromKubernetes
(
ctx
context
.
Context
,
kubeCluster
*
Cluster
)
(
map
[
string
]
pki
.
CertificatePKI
,
error
)
{
log
.
Infof
(
ctx
,
"[certificates] Getting Cluster certificates from Kubernetes"
)
log
.
Infof
(
ctx
,
"[certificates] Getting Cluster certificates from Kubernetes"
)
...
@@ -132,24 +117,6 @@ func (c *Cluster) getBackupHosts() []*hosts.Host {
...
@@ -132,24 +117,6 @@ func (c *Cluster) getBackupHosts() []*hosts.Host {
return
backupHosts
return
backupHosts
}
}
func
regenerateAPIAggregationCerts
(
c
*
Cluster
,
certificates
map
[
string
]
pki
.
CertificatePKI
)
(
map
[
string
]
pki
.
CertificatePKI
,
error
)
{
logrus
.
Debugf
(
"[certificates] Regenerating Kubernetes API server aggregation layer requestheader client CA certificates"
)
requestHeaderCACrt
,
requestHeaderCAKey
,
err
:=
pki
.
GenerateCACertAndKey
(
pki
.
RequestHeaderCACertName
,
nil
)
if
err
!=
nil
{
return
nil
,
err
}
certificates
[
pki
.
RequestHeaderCACertName
]
=
pki
.
ToCertObject
(
pki
.
RequestHeaderCACertName
,
""
,
""
,
requestHeaderCACrt
,
requestHeaderCAKey
,
nil
)
//generate API server proxy client key and certs
logrus
.
Debugf
(
"[certificates] Regenerating Kubernetes API server proxy client certificates"
)
apiserverProxyClientCrt
,
apiserverProxyClientKey
,
err
:=
pki
.
GenerateSignedCertAndKey
(
requestHeaderCACrt
,
requestHeaderCAKey
,
true
,
pki
.
APIProxyClientCertName
,
nil
,
nil
,
nil
)
if
err
!=
nil
{
return
nil
,
err
}
certificates
[
pki
.
APIProxyClientCertName
]
=
pki
.
ToCertObject
(
pki
.
APIProxyClientCertName
,
""
,
""
,
apiserverProxyClientCrt
,
apiserverProxyClientKey
,
nil
)
return
certificates
,
nil
}
func
RotateRKECertificates
(
ctx
context
.
Context
,
c
*
Cluster
,
flags
ExternalFlags
,
clusterState
*
FullState
)
error
{
func
RotateRKECertificates
(
ctx
context
.
Context
,
c
*
Cluster
,
flags
ExternalFlags
,
clusterState
*
FullState
)
error
{
var
(
var
(
serviceAccountTokenKey
string
serviceAccountTokenKey
string
...
...
This diff is collapsed.
Click to expand it.
cluster/cluster.go
+
0
-
8
View file @
ad678b6a
...
@@ -265,14 +265,6 @@ func rebuildLocalAdminConfig(ctx context.Context, kubeCluster *Cluster) error {
...
@@ -265,14 +265,6 @@ func rebuildLocalAdminConfig(ctx context.Context, kubeCluster *Cluster) error {
return
nil
return
nil
}
}
func
isLocalConfigWorking
(
ctx
context
.
Context
,
localKubeConfigPath
string
,
k8sWrapTransport
transport
.
WrapperFunc
)
bool
{
if
_
,
err
:=
GetK8sVersion
(
localKubeConfigPath
,
k8sWrapTransport
);
err
!=
nil
{
log
.
Infof
(
ctx
,
"[reconcile] Local config is not valid (error: %v), rebuilding admin config"
,
err
)
return
false
}
return
true
}
func
getLocalConfigAddress
(
localConfigPath
string
)
(
string
,
error
)
{
func
getLocalConfigAddress
(
localConfigPath
string
)
(
string
,
error
)
{
config
,
err
:=
clientcmd
.
BuildConfigFromFlags
(
""
,
localConfigPath
)
config
,
err
:=
clientcmd
.
BuildConfigFromFlags
(
""
,
localConfigPath
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
cmd/cert.go
+
0
-
4
View file @
ad678b6a
...
@@ -126,10 +126,6 @@ func generateCSRFromCli(ctx *cli.Context) error {
...
@@ -126,10 +126,6 @@ func generateCSRFromCli(ctx *cli.Context) error {
return
GenerateRKECSRs
(
context
.
Background
(),
rkeConfig
,
externalFlags
)
return
GenerateRKECSRs
(
context
.
Background
(),
rkeConfig
,
externalFlags
)
}
}
func
showRKECertificatesFromCli
(
ctx
*
cli
.
Context
)
error
{
return
nil
}
func
rebuildClusterWithRotatedCertificates
(
ctx
context
.
Context
,
func
rebuildClusterWithRotatedCertificates
(
ctx
context
.
Context
,
dialersOptions
hosts
.
DialersOptions
,
dialersOptions
hosts
.
DialersOptions
,
flags
cluster
.
ExternalFlags
,
svcOptionData
map
[
string
]
*
v3
.
KubernetesServicesOptions
)
(
string
,
string
,
string
,
string
,
map
[
string
]
pki
.
CertificatePKI
,
error
)
{
flags
cluster
.
ExternalFlags
,
svcOptionData
map
[
string
]
*
v3
.
KubernetesServicesOptions
)
(
string
,
string
,
string
,
string
,
map
[
string
]
pki
.
CertificatePKI
,
error
)
{
...
...
This diff is collapsed.
Click to expand it.
pki/util.go
+
0
-
14
View file @
ad678b6a
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"math/big"
"math/big"
"net"
"net"
"os"
"os"
"path"
"path/filepath"
"path/filepath"
"reflect"
"reflect"
"strings"
"strings"
...
@@ -373,19 +372,6 @@ func GetLocalKubeConfig(configPath, configDir string) string {
...
@@ -373,19 +372,6 @@ func GetLocalKubeConfig(configPath, configDir string) string {
return
fmt
.
Sprintf
(
"%s%s%s"
,
baseDir
,
KubeAdminConfigPrefix
,
fileName
)
return
fmt
.
Sprintf
(
"%s%s%s"
,
baseDir
,
KubeAdminConfigPrefix
,
fileName
)
}
}
func
strCrtToEnv
(
crtName
,
crt
string
)
string
{
return
fmt
.
Sprintf
(
"%s=%s"
,
getEnvFromName
(
crtName
),
crt
)
}
func
strKeyToEnv
(
crtName
,
key
string
)
string
{
envName
:=
getEnvFromName
(
crtName
)
return
fmt
.
Sprintf
(
"%s=%s"
,
getKeyEnvFromEnv
(
envName
),
key
)
}
func
getTempPath
(
s
string
)
string
{
return
TempCertPath
+
path
.
Base
(
s
)
}
func
populateCertMap
(
tmpCerts
map
[
string
]
CertificatePKI
,
localConfigPath
string
,
extraHosts
[]
*
hosts
.
Host
)
map
[
string
]
CertificatePKI
{
func
populateCertMap
(
tmpCerts
map
[
string
]
CertificatePKI
,
localConfigPath
string
,
extraHosts
[]
*
hosts
.
Host
)
map
[
string
]
CertificatePKI
{
certs
:=
make
(
map
[
string
]
CertificatePKI
)
certs
:=
make
(
map
[
string
]
CertificatePKI
)
// CACert
// CACert
...
...
This diff is collapsed.
Click to expand it.
services/workerplane.go
+
1
-
9
View file @
ad678b6a
...
@@ -7,7 +7,7 @@ import (
...
@@ -7,7 +7,7 @@ import (
"github.com/rancher/rke/log"
"github.com/rancher/rke/log"
"github.com/rancher/rke/pki"
"github.com/rancher/rke/pki"
"github.com/rancher/rke/util"
"github.com/rancher/rke/util"
"github.com/rancher/types/apis/management.cattle.io/v3"
v3
"github.com/rancher/types/apis/management.cattle.io/v3"
"golang.org/x/sync/errgroup"
"golang.org/x/sync/errgroup"
)
)
...
@@ -149,11 +149,3 @@ func doDeployWorkerPlane(ctx context.Context, host *hosts.Host,
...
@@ -149,11 +149,3 @@ func doDeployWorkerPlane(ctx context.Context, host *hosts.Host,
}
}
return
runKubeproxy
(
ctx
,
host
,
localConnDialerFactory
,
prsMap
,
processMap
[
KubeproxyContainerName
],
alpineImage
)
return
runKubeproxy
(
ctx
,
host
,
localConnDialerFactory
,
prsMap
,
processMap
[
KubeproxyContainerName
],
alpineImage
)
}
}
func
copyProcessMap
(
m
map
[
string
]
v3
.
Process
)
map
[
string
]
v3
.
Process
{
c
:=
make
(
map
[
string
]
v3
.
Process
)
for
k
,
v
:=
range
m
{
c
[
k
]
=
v
}
return
c
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help