1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-24 21:07:32 +00:00

Pass private registries list through the function calls

This commit is contained in:
moelsayed
2018-01-31 19:50:55 +02:00
parent cb290d23e3
commit 4159d7f156
17 changed files with 93 additions and 86 deletions

View File

@@ -37,7 +37,7 @@ const (
CleanerContainerName = "kube-cleaner"
)
func (h *Host) CleanUpAll(ctx context.Context, cleanerImage string) error {
func (h *Host) CleanUpAll(ctx context.Context, cleanerImage string, prsMap map[string]v3.PrivateRegistry) error {
log.Infof(ctx, "[hosts] Cleaning up host [%s]", h.Address)
toCleanPaths := []string{
ToCleanEtcdDir,
@@ -47,10 +47,10 @@ func (h *Host) CleanUpAll(ctx context.Context, cleanerImage string) error {
ToCleanCalicoRun,
ToCleanTempCertPath,
}
return h.CleanUp(ctx, toCleanPaths, cleanerImage)
return h.CleanUp(ctx, toCleanPaths, cleanerImage, prsMap)
}
func (h *Host) CleanUpWorkerHost(ctx context.Context, cleanerImage string) error {
func (h *Host) CleanUpWorkerHost(ctx context.Context, cleanerImage string, prsMap map[string]v3.PrivateRegistry) error {
if h.IsControl {
log.Infof(ctx, "[hosts] Host [%s] is already a controlplane host, skipping cleanup.", h.Address)
return nil
@@ -61,10 +61,10 @@ func (h *Host) CleanUpWorkerHost(ctx context.Context, cleanerImage string) error
ToCleanCNIBin,
ToCleanCalicoRun,
}
return h.CleanUp(ctx, toCleanPaths, cleanerImage)
return h.CleanUp(ctx, toCleanPaths, cleanerImage, prsMap)
}
func (h *Host) CleanUpControlHost(ctx context.Context, cleanerImage string) error {
func (h *Host) CleanUpControlHost(ctx context.Context, cleanerImage string, prsMap map[string]v3.PrivateRegistry) error {
if h.IsWorker {
log.Infof(ctx, "[hosts] Host [%s] is already a worker host, skipping cleanup.", h.Address)
return nil
@@ -75,10 +75,10 @@ func (h *Host) CleanUpControlHost(ctx context.Context, cleanerImage string) erro
ToCleanCNIBin,
ToCleanCalicoRun,
}
return h.CleanUp(ctx, toCleanPaths, cleanerImage)
return h.CleanUp(ctx, toCleanPaths, cleanerImage, prsMap)
}
func (h *Host) CleanUpEtcdHost(ctx context.Context, cleanerImage string) error {
func (h *Host) CleanUpEtcdHost(ctx context.Context, cleanerImage string, prsMap map[string]v3.PrivateRegistry) error {
toCleanPaths := []string{
ToCleanEtcdDir,
ToCleanSSLDir,
@@ -89,14 +89,14 @@ func (h *Host) CleanUpEtcdHost(ctx context.Context, cleanerImage string) error {
ToCleanEtcdDir,
}
}
return h.CleanUp(ctx, toCleanPaths, cleanerImage)
return h.CleanUp(ctx, toCleanPaths, cleanerImage, prsMap)
}
func (h *Host) CleanUp(ctx context.Context, toCleanPaths []string, cleanerImage string) error {
func (h *Host) CleanUp(ctx context.Context, toCleanPaths []string, cleanerImage string, prsMap map[string]v3.PrivateRegistry) error {
log.Infof(ctx, "[hosts] Cleaning up host [%s]", h.Address)
imageCfg, hostCfg := buildCleanerConfig(h, toCleanPaths, cleanerImage)
log.Infof(ctx, "[hosts] Running cleaner container on host [%s]", h.Address)
if err := docker.DoRunContainer(ctx, h.DClient, imageCfg, hostCfg, CleanerContainerName, h.Address, CleanerContainerName); err != nil {
if err := docker.DoRunContainer(ctx, h.DClient, imageCfg, hostCfg, CleanerContainerName, h.Address, CleanerContainerName, prsMap); err != nil {
return err
}