1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-15 22:49:13 +00:00

Support to generate Windows worker plan

- Put Windows worker plan generating back to reduce the changing from
Windows on rancher/rancher
- Prepare for rke bootstraps Windows cluster

**Issue:**
https://github.com/rancher/rancher/issues/16460
This commit is contained in:
Frank Mai
2019-07-05 12:23:48 +08:00
committed by Alena Prokharchyk
parent 9544db09d3
commit 277797df0f
6 changed files with 289 additions and 35 deletions

View File

@@ -95,12 +95,28 @@ func doRunDeployer(ctx context.Context, host *hosts.Host, containerEnv []string,
Cmd: []string{"cert-deployer"},
Env: containerEnv,
}
if host.DockerInfo.OSType == "windows" { // compatible with Windows
imageCfg = &container.Config{
Image: certDownloaderImage,
Cmd: []string{
"pwsh", "-NoLogo", "-NonInteractive", "-File", "c:/usr/bin/cert-deployer.ps1",
},
Env: containerEnv,
}
}
hostCfg := &container.HostConfig{
Binds: []string{
fmt.Sprintf("%s:/etc/kubernetes:z", path.Join(host.PrefixPath, "/etc/kubernetes")),
},
Privileged: true,
}
if host.DockerInfo.OSType == "windows" { // compatible with Windows
hostCfg = &container.HostConfig{
Binds: []string{
fmt.Sprintf("%s:c:/etc/kubernetes", path.Join(host.PrefixPath, "/etc/kubernetes")),
},
}
}
_, err = docker.CreateContainer(ctx, host.DClient, host.Address, CrtDownloaderContainer, imageCfg, hostCfg)
if err != nil {
return fmt.Errorf("Failed to create Certificates deployer container on host [%s]: %v", host.Address, err)