in pkg/agent/baker.go [191:239]
func getBakerFuncMap(config *datamodel.NodeBootstrappingConfiguration, params paramsMap, variables paramsMap) template.FuncMap {
funcMap := getContainerServiceFuncMap(config)
funcMap["GetParameter"] = func(s string) interface{} {
if v, ok := params[s].(paramsMap); ok && v != nil {
if v["value"] == nil {
// return empty string so we don't get <no value> from go template
return ""
}
return v["value"]
}
return ""
}
// TODO: GetParameterPropertyLower
funcMap["GetParameterProperty"] = func(s, p string) interface{} {
if v, ok := params[s].(paramsMap); ok && v != nil {
//nolint:errcheck // this code been writen before linter was added
param := v["value"].(paramsMap)[p]
if param == nil {
// return empty string so we don't get <no value> from go template
return ""
}
return param
}
return ""
}
funcMap["GetVariable"] = func(s string) interface{} {
if variables[s] == nil {
// return empty string so we don't get <no value> from go template
return ""
}
return variables[s]
}
funcMap["GetVariableProperty"] = func(v, p string) interface{} {
if v, ok := variables[v].(paramsMap); ok && v != nil {
if v[p] == nil {
// return empty string so we don't get <no value> from go template
return ""
}
return v[p]
}
return ""
}
return funcMap
}