func getOrderedKubeletConfigFlagWithCustomConfigurationString()

in pkg/agent/utils.go [370:393]


func getOrderedKubeletConfigFlagWithCustomConfigurationString(customConfig, defaultConfig map[string]string) string {
	config := customConfig

	for k, v := range defaultConfig {
		// add key-value only when the flag does not exist in custom config.
		if _, ok := config[k]; !ok {
			config[k] = v
		}
	}

	keys := []string{}
	ommitedKubletConfigFlags := datamodel.GetCommandLineOmittedKubeletConfigFlags()
	for key := range config {
		if !ommitedKubletConfigFlags[key] {
			keys = append(keys, key)
		}
	}
	sort.Strings(keys)
	var buf bytes.Buffer
	for _, key := range keys {
		buf.WriteString(fmt.Sprintf("%s=%s ", key, config[key]))
	}
	return buf.String()
}