add warning, if someone mounts a file at the default registries.yaml location, while they also use a different kind of registry spec

This commit is contained in:
iwilltry42 2021-01-18 15:52:16 +01:00
parent f0486a388b
commit 4e2b1baa62
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110

View File

@ -26,6 +26,7 @@ import (
"fmt"
"os"
"runtime"
"strings"
"time"
"github.com/spf13/cobra"
@ -278,6 +279,10 @@ func parseCreateClusterCmd(cmd *cobra.Command, args []string, cliConfig *conf.Si
log.Fatalln(err)
}
if strings.Contains(volume, k3d.DefaultRegistriesFilePath) && (cliConfig.Registries.Create || cliConfig.Registries.Config != "" || len(cliConfig.Registries.Use) != 0) {
log.Warnf("Seems like you're mounting a file at '%s' while also using a referenced registries config or k3d-managed registries: Your mounted file will probably be overwritten!", k3d.DefaultRegistriesFilePath)
}
// create new entry or append filter to existing entry
if _, exists := volumeFilterMap[volume]; exists {
volumeFilterMap[volume] = append(volumeFilterMap[volume], filters...)