Commit 6e3c9066 authored by kaiyou's avatar kaiyou
Browse files

Strconv earlier when converting ports

parent 43e8d1cd
Pipeline #724 passed with stage
in 2 minutes and 40 seconds
......@@ -16,6 +16,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
......@@ -424,7 +425,7 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
nodeConfig.AgentConfig.StrongSwanDir = filepath.Join(envInfo.DataDir, "strongswan")
nodeConfig.CACerts = info.CACerts
nodeConfig.Containerd.Config = filepath.Join(envInfo.DataDir, "etc/containerd/config.toml")
nodeConfig.Containerd.Port = envInfo.ContainerdPort
nodeConfig.Containerd.Port = strconv.Itoa(envInfo.ContainerdPort)
nodeConfig.Containerd.Root = filepath.Join(envInfo.DataDir, "containerd")
nodeConfig.Containerd.Opt = filepath.Join(envInfo.DataDir, "containerd")
if !envInfo.Debug {
......@@ -466,7 +467,7 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
os.Setenv("NODE_NAME", nodeConfig.AgentConfig.NodeName)
nodeConfig.AgentConfig.KubeletPort = envInfo.KubeletPort
nodeConfig.AgentConfig.KubeletPort = strconv.Itoa(envInfo.KubeletPort)
nodeConfig.AgentConfig.ExtraKubeletArgs = envInfo.ExtraKubeletArgs
nodeConfig.AgentConfig.ExtraKubeProxyArgs = envInfo.ExtraKubeProxyArgs
......
......@@ -76,7 +76,7 @@ func Setup(ctx context.Context, config *config.Node, onChange func([]string)) er
disconnect := map[string]context.CancelFunc{}
validPorts := map[string]bool{string(config.Containerd.Port): true, string(config.AgentConfig.KubeletPort): true}
validPorts := map[string]bool{config.Containerd.Port: true, config.AgentConfig.KubeletPort: true}
wg := &sync.WaitGroup{}
for _, address := range addresses {
......
......@@ -6,7 +6,6 @@ import (
"math/rand"
"os"
"path/filepath"
"strconv"
"strings"
"time"
......@@ -59,7 +58,7 @@ func startKubeProxy(cfg *config.Agent) {
func startKubelet(cfg *config.Agent) {
argsMap := map[string]string{
"healthz-bind-address": "127.0.0.1",
"port": strconv.Itoa(cfg.KubeletPort),
"port": cfg.KubeletPort,
"read-only-port": "0",
"cluster-domain": cfg.ClusterDomain,
"kubeconfig": cfg.KubeConfigKubelet,
......
......@@ -40,7 +40,7 @@ type Node struct {
type Containerd struct {
Address string
Log string
Port int
Port string
Root string
State string
Config string
......@@ -68,7 +68,7 @@ type Agent struct {
ClientCA string
CNIBinDir string
CNIConfDir string
KubeletPort int
KubeletPort string
ExtraKubeletArgs []string
ExtraKubeProxyArgs []string
PauseImage string
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment