|
|
@ -7,9 +7,7 @@ import (
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/Microsoft/hcsshim"
|
|
|
|
|
|
|
|
"github.com/k3s-io/k3s/pkg/daemons/config"
|
|
|
|
"github.com/k3s-io/k3s/pkg/daemons/config"
|
|
|
|
"github.com/k3s-io/k3s/pkg/util"
|
|
|
|
"github.com/k3s-io/k3s/pkg/util"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
@ -17,9 +15,6 @@ import (
|
|
|
|
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
|
|
|
|
"k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// NetworkName may be overridden at runtime in downstream projects
|
|
|
|
|
|
|
|
var NetworkName = "vxlan0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
socketPrefix = "npipe://"
|
|
|
|
socketPrefix = "npipe://"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -40,10 +35,6 @@ func kubeProxyArgs(cfg *config.Agent) map[string]string {
|
|
|
|
argsMap["hostname-override"] = cfg.NodeName
|
|
|
|
argsMap["hostname-override"] = cfg.NodeName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if sourceVip := waitForManagementIP(NetworkName); sourceVip != "" {
|
|
|
|
|
|
|
|
argsMap["source-vip"] = sourceVip
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return argsMap
|
|
|
|
return argsMap
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -133,18 +124,3 @@ func kubeletArgs(cfg *config.Agent) map[string]string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return argsMap
|
|
|
|
return argsMap
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func waitForManagementIP(networkName string) string {
|
|
|
|
|
|
|
|
for range time.Tick(time.Second * 5) {
|
|
|
|
|
|
|
|
network, err := hcsshim.GetHNSNetworkByName(networkName)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
logrus.WithError(err).Warning("can't find HNS network, retrying", networkName)
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if network.ManagementIP == "" {
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return network.ManagementIP
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|