mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
commit
660906928d
|
|
@ -19,13 +19,14 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager
|
|||
FROM debian:stable
|
||||
|
||||
RUN useradd -m kubekey && apt-get update && apt-get install bash curl -y; apt-get autoclean; rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /home/kubekey
|
||||
#ADD addons /home/kubekey/addons
|
||||
|
||||
#ADD addons /home/kubekey/addons
|
||||
#ADD kubekey /home/kubekey/kubekey
|
||||
#RUN chown kubekey:kubekey -R /home/kubekey/kubekey
|
||||
|
||||
COPY --from=builder /workspace/manager /home/kubekey
|
||||
USER kubekey:kubekey
|
||||
|
||||
WORKDIR /home/kubekey
|
||||
COPY --from=builder /workspace/manager /home/kubekey
|
||||
|
||||
ENTRYPOINT ["/home/kubekey/manager"]
|
||||
|
|
@ -110,13 +110,16 @@ func SetDefaultHostsCfg(cfg *ClusterSpec) []HostCfg {
|
|||
if host.Port == "" {
|
||||
host.Port = DefaultSSHPort
|
||||
}
|
||||
if host.Password == "" && host.PrivateKeyPath == "" {
|
||||
host.PrivateKeyPath = "~/.ssh/id_rsa"
|
||||
}
|
||||
if host.PrivateKeyPath != "" && strings.HasPrefix(strings.TrimSpace(host.PrivateKeyPath), "~/") {
|
||||
homeDir, _ := util.Home()
|
||||
host.PrivateKeyPath = strings.Replace(host.PrivateKeyPath, "~/", fmt.Sprintf("%s/", homeDir), 1)
|
||||
if host.PrivateKey == "" {
|
||||
if host.Password == "" && host.PrivateKeyPath == "" {
|
||||
host.PrivateKeyPath = "~/.ssh/id_rsa"
|
||||
}
|
||||
if host.PrivateKeyPath != "" && strings.HasPrefix(strings.TrimSpace(host.PrivateKeyPath), "~/") {
|
||||
homeDir, _ := util.Home()
|
||||
host.PrivateKeyPath = strings.Replace(host.PrivateKeyPath, "~/", fmt.Sprintf("%s/", homeDir), 1)
|
||||
}
|
||||
}
|
||||
|
||||
if host.Arch == "" {
|
||||
host.Arch = DefaultArch
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ func CreateCluster(clusterCfgFile, k8sVersion, ksVersion string, logger *log.Log
|
|||
return errors.New("Please do not use uppercase letters in hostname: " + host.Name)
|
||||
}
|
||||
}
|
||||
fmt.Println(objName)
|
||||
|
||||
return Execute(executor.NewExecutor(&cfg.Spec, objName, logger, "", verbose, skipCheck, skipPullImages, false))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func validateOptions(cfg Cfg) (Cfg, error) {
|
|||
return cfg, errors.New("Must specify at least one of password, private key, keyfile or agent socket")
|
||||
}
|
||||
|
||||
if len(cfg.KeyFile) > 0 {
|
||||
if len(cfg.PrivateKey) == 0 && len(cfg.KeyFile) > 0 {
|
||||
content, err := ioutil.ReadFile(cfg.KeyFile)
|
||||
if err != nil {
|
||||
return cfg, errors.Wrapf(err, "Failed to read keyfile %q", cfg.KeyFile)
|
||||
|
|
|
|||
Loading…
Reference in New Issue