Skip to content

Commit

Permalink
fix: correct etc config dir
Browse files Browse the repository at this point in the history
fix issue: #370

Signed-off-by: Deshi Xiao <[email protected]>
  • Loading branch information
xiaods committed Nov 22, 2024
1 parent 6875f88 commit 462bda0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/agent/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func get(ctx context.Context, envInfo *cmds.Agent, proxy proxy.Proxy) (*config.N
if envInfo.Rootless {
nodePasswordRoot = filepath.Join(envInfo.DataDir, "agent")
}
nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "rancher", "node")
nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "k8e", "node")
if err := os.MkdirAll(nodeConfigPath, 0755); err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmds/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ var (
Name: "private-registry",
Usage: "(agent/runtime) Private registry configuration file",
Destination: &AgentConfig.PrivateRegistry,
Value: "/etc/rancher/" + version.Program + "/registries.yaml",
Value: "/etc/" + version.Program + "/registries.yaml",
}
AirgapExtraRegistryFlag = &cli.StringSliceFlag{
Name: "airgap-extra-registry",
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmds/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var (
ServerConfig Server
DataDirFlag = &cli.StringFlag{
Name: "data-dir,d",
Usage: "(data) Folder to hold state default /var/lib/" + version.Program + " or ${HOME}/.rancher/" + version.Program + " if not root",
Usage: "(data) Folder to hold state default /var/lib/" + version.Program + " or ${HOME}/." + version.Program + " if not root",
Destination: &ServerConfig.DataDir,
EnvVar: version.ProgramUpper + "_DATA_DIR",
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rootless/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func setupMounts(stateDir string) error {
{"/var/log", filepath.Join(stateDir, "logs")},
{"/var/lib/cni", filepath.Join(stateDir, "cni")},
{"/var/lib/kubelet", filepath.Join(stateDir, "kubelet")},
{"/etc/rancher", filepath.Join(stateDir, "etc", "rancher")},
{"/etc/k8e", filepath.Join(stateDir, "etc", "k8e")},
{"/run/k8e/containerd", filepath.Join(runDir, "k8e", "containerd")},
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/server/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ func verifyLocalPassword(ctx context.Context, config *Config, mu *sync.Mutex, de
if config.ControlConfig.Rootless {
nodePasswordRoot = filepath.Join(path.Dir(config.ControlConfig.DataDir), "agent")
}
nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "rancher", "node")
nodeConfigPath := filepath.Join(nodePasswordRoot, "etc", "k8e", "node")
nodePasswordFile := filepath.Join(nodeConfigPath, "password")

passBytes, err := os.ReadFile(nodePasswordFile)
Expand Down

0 comments on commit 462bda0

Please sign in to comment.