Browse Source

Merge pull request #917 from erikwilson/fix-strongswan-root-etc

Fallback to /etc/strongswan for config
pull/919/head
Erik Wilson 5 years ago committed by GitHub
parent
commit
5622a88be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      pkg/agent/flannel/setup.go

11
pkg/agent/flannel/setup.go

@ -147,10 +147,10 @@ func createFlannelConf(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")
if dataDir == "" {
return nil
dataDir = "/"
}
dataDir = path.Join(dataDir, "etc", "strongswan")
@ -159,6 +159,13 @@ func setupStrongSwan(nodeConfig *config.Node) error {
if err == nil && info.Mode()&os.ModeSymlink == 0 {
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
os.Remove(nodeConfig.AgentConfig.StrongSwanDir)

Loading…
Cancel
Save