mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Fallback to /etc/strongswan for config
Needed for docker image
This commit is contained in:
parent
30c14a4db6
commit
12307a4a69
@ -147,10 +147,10 @@ func createFlannelConf(nodeConfig *config.Node) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupStrongSwan(nodeConfig *config.Node) error {
|
func setupStrongSwan(nodeConfig *config.Node) error {
|
||||||
// if we don't know the location of extracted strongswan data then return
|
// if data dir env is not set point to root
|
||||||
dataDir := os.Getenv("K3S_DATA_DIR")
|
dataDir := os.Getenv("K3S_DATA_DIR")
|
||||||
if dataDir == "" {
|
if dataDir == "" {
|
||||||
return nil
|
dataDir = "/"
|
||||||
}
|
}
|
||||||
dataDir = path.Join(dataDir, "etc", "strongswan")
|
dataDir = path.Join(dataDir, "etc", "strongswan")
|
||||||
|
|
||||||
@ -159,6 +159,13 @@ func setupStrongSwan(nodeConfig *config.Node) error {
|
|||||||
if err == nil && info.Mode()&os.ModeSymlink == 0 {
|
if err == nil && info.Mode()&os.ModeSymlink == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if err == nil {
|
||||||
|
target, err := os.Readlink(nodeConfig.AgentConfig.StrongSwanDir)
|
||||||
|
// current link is the same, return
|
||||||
|
if err == nil && target == dataDir {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// clean up strongswan old link
|
// clean up strongswan old link
|
||||||
os.Remove(nodeConfig.AgentConfig.StrongSwanDir)
|
os.Remove(nodeConfig.AgentConfig.StrongSwanDir)
|
||||||
|
Loading…
Reference in New Issue
Block a user