INNER CODE UNIT · Go

getConfigFileNameMap

NVIDIA/k8s-device-plugin · cmd/config-manager/main.go:456

func getConfigFileNameMap(f *Flags) (map[string]bool, error) {
	files, err := os.ReadDir(f.ConfigFileSrcdir)
	if err != nil {
		return nil, fmt.Errorf("error reading directory: %v", err)
	}

	filemap := make(map[string]bool)
	for _, f := range files {
		// ConfigMaps mounted as volumes have special files with the prefix
		// "..". We want to explicitly exclude these as well as any directories.
		if !f.IsDir() && !strings.HasPrefix(f.Name(), "..") {
			filemap[f.Name()] = true
		}
	}

	return filemap, nil
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…