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
44b8af09
Commit
44b8af09
authored
Apr 25, 2020
by
Knic Knic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix usage of path instead of filepath
parent
2c493411
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
44 deletions
+42
-44
setup.go
pkg/agent/flannel/setup.go
+1
-2
server.go
pkg/daemons/control/server.go
+41
-42
No files found.
pkg/agent/flannel/setup.go
View file @
44b8af09
...
...
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"
...
...
@@ -147,7 +146,7 @@ func setupStrongSwan(nodeConfig *config.Node) error {
if
dataDir
==
""
{
dataDir
=
"/"
}
dataDir
=
path
.
Join
(
dataDir
,
"etc"
,
"strongswan"
)
dataDir
=
file
path
.
Join
(
dataDir
,
"etc"
,
"strongswan"
)
info
,
err
:=
os
.
Lstat
(
nodeConfig
.
AgentConfig
.
StrongSwanDir
)
// something exists but is not a symlink, return
...
...
pkg/daemons/control/server.go
View file @
44b8af09
...
...
@@ -13,7 +13,6 @@ import (
"net"
"net/http"
"os"
"path"
"path/filepath"
"strconv"
"strings"
...
...
@@ -174,7 +173,7 @@ func apiServer(ctx context.Context, cfg *config.Control, runtime *config.Control
setupStorageBackend
(
argsMap
,
cfg
)
certDir
:=
filepath
.
Join
(
cfg
.
DataDir
,
"tls
/
temporary-certs"
)
certDir
:=
filepath
.
Join
(
cfg
.
DataDir
,
"tls
"
,
"
temporary-certs"
)
os
.
MkdirAll
(
certDir
,
0700
)
argsMap
[
"cert-dir"
]
=
certDir
...
...
@@ -272,53 +271,53 @@ func prepare(ctx context.Context, config *config.Control, runtime *config.Contro
return
err
}
os
.
MkdirAll
(
path
.
Join
(
config
.
DataDir
,
"tls"
),
0700
)
os
.
MkdirAll
(
path
.
Join
(
config
.
DataDir
,
"cred"
),
0700
)
os
.
MkdirAll
(
file
path
.
Join
(
config
.
DataDir
,
"tls"
),
0700
)
os
.
MkdirAll
(
file
path
.
Join
(
config
.
DataDir
,
"cred"
),
0700
)
runtime
.
ClientCA
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-ca.crt"
)
runtime
.
ClientCAKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-ca.key"
)
runtime
.
ServerCA
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"server-ca.crt"
)
runtime
.
ServerCAKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"server-ca.key"
)
runtime
.
RequestHeaderCA
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"request-header-ca.crt"
)
runtime
.
RequestHeaderCAKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"request-header-ca.key"
)
runtime
.
IPSECKey
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"ipsec.psk"
)
runtime
.
ClientCA
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-ca.crt"
)
runtime
.
ClientCAKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-ca.key"
)
runtime
.
ServerCA
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"server-ca.crt"
)
runtime
.
ServerCAKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"server-ca.key"
)
runtime
.
RequestHeaderCA
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"request-header-ca.crt"
)
runtime
.
RequestHeaderCAKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"request-header-ca.key"
)
runtime
.
IPSECKey
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"ipsec.psk"
)
runtime
.
ServiceKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"service.key"
)
runtime
.
PasswdFile
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"passwd"
)
runtime
.
NodePasswdFile
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"node-passwd"
)
runtime
.
ServiceKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"service.key"
)
runtime
.
PasswdFile
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"passwd"
)
runtime
.
NodePasswdFile
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"node-passwd"
)
runtime
.
KubeConfigAdmin
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"admin.kubeconfig"
)
runtime
.
KubeConfigController
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"controller.kubeconfig"
)
runtime
.
KubeConfigScheduler
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"scheduler.kubeconfig"
)
runtime
.
KubeConfigAPIServer
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"api-server.kubeconfig"
)
runtime
.
KubeConfigCloudController
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"cloud-controller.kubeconfig"
)
runtime
.
KubeConfigAdmin
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"admin.kubeconfig"
)
runtime
.
KubeConfigController
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"controller.kubeconfig"
)
runtime
.
KubeConfigScheduler
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"scheduler.kubeconfig"
)
runtime
.
KubeConfigAPIServer
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"api-server.kubeconfig"
)
runtime
.
KubeConfigCloudController
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"cloud-controller.kubeconfig"
)
runtime
.
ClientAdminCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-admin.crt"
)
runtime
.
ClientAdminKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-admin.key"
)
runtime
.
ClientControllerCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-controller.crt"
)
runtime
.
ClientControllerKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-controller.key"
)
runtime
.
ClientCloudControllerCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-cloud-controller.crt"
)
runtime
.
ClientCloudControllerKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-cloud-controller.key"
)
runtime
.
ClientSchedulerCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-scheduler.crt"
)
runtime
.
ClientSchedulerKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-scheduler.key"
)
runtime
.
ClientKubeAPICert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-apiserver.crt"
)
runtime
.
ClientKubeAPIKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-apiserver.key"
)
runtime
.
ClientKubeProxyCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-proxy.crt"
)
runtime
.
ClientKubeProxyKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-proxy.key"
)
runtime
.
ClientK3sControllerCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-k3s-controller.crt"
)
runtime
.
ClientK3sControllerKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-k3s-controller.key"
)
runtime
.
ClientAdminCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-admin.crt"
)
runtime
.
ClientAdminKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-admin.key"
)
runtime
.
ClientControllerCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-controller.crt"
)
runtime
.
ClientControllerKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-controller.key"
)
runtime
.
ClientCloudControllerCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-cloud-controller.crt"
)
runtime
.
ClientCloudControllerKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-cloud-controller.key"
)
runtime
.
ClientSchedulerCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-scheduler.crt"
)
runtime
.
ClientSchedulerKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-scheduler.key"
)
runtime
.
ClientKubeAPICert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-apiserver.crt"
)
runtime
.
ClientKubeAPIKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-apiserver.key"
)
runtime
.
ClientKubeProxyCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-proxy.crt"
)
runtime
.
ClientKubeProxyKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kube-proxy.key"
)
runtime
.
ClientK3sControllerCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-k3s-controller.crt"
)
runtime
.
ClientK3sControllerKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-k3s-controller.key"
)
runtime
.
ServingKubeAPICert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"serving-kube-apiserver.crt"
)
runtime
.
ServingKubeAPIKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"serving-kube-apiserver.key"
)
runtime
.
ServingKubeAPICert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"serving-kube-apiserver.crt"
)
runtime
.
ServingKubeAPIKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"serving-kube-apiserver.key"
)
runtime
.
ClientKubeletKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kubelet.key"
)
runtime
.
ServingKubeletKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"serving-kubelet.key"
)
runtime
.
ClientKubeletKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-kubelet.key"
)
runtime
.
ServingKubeletKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"serving-kubelet.key"
)
runtime
.
ClientAuthProxyCert
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-auth-proxy.crt"
)
runtime
.
ClientAuthProxyKey
=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-auth-proxy.key"
)
runtime
.
ClientAuthProxyCert
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-auth-proxy.crt"
)
runtime
.
ClientAuthProxyKey
=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"client-auth-proxy.key"
)
if
config
.
EncryptSecrets
{
runtime
.
EncryptionConfig
=
path
.
Join
(
config
.
DataDir
,
"cred"
,
"encryption-config.json"
)
runtime
.
EncryptionConfig
=
file
path
.
Join
(
config
.
DataDir
,
"cred"
,
"encryption-config.json"
)
}
cluster
:=
cluster
.
New
(
config
)
...
...
@@ -563,8 +562,8 @@ func genClientCerts(config *config.Control, runtime *config.ControlRuntime) erro
}
func
createServerSigningCertKey
(
config
*
config
.
Control
,
runtime
*
config
.
ControlRuntime
)
(
bool
,
error
)
{
TokenCA
:=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"token-ca.crt"
)
TokenCAKey
:=
path
.
Join
(
config
.
DataDir
,
"tls"
,
"token-ca.key"
)
TokenCA
:=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"token-ca.crt"
)
TokenCAKey
:=
file
path
.
Join
(
config
.
DataDir
,
"tls"
,
"token-ca.key"
)
if
exists
(
TokenCA
,
TokenCAKey
)
&&
!
exists
(
runtime
.
ServerCA
)
&&
!
exists
(
runtime
.
ServerCAKey
)
{
logrus
.
Infof
(
"Upgrading token-ca files to server-ca"
)
...
...
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