in images/controller/pkg/appconfigbundle.go [43:75]
func GetConfigMaps(namespace string) ([]ConfigMapObject, error) {
objs := make([]ConfigMapObject, 0)
type configMapItems struct {
Items []ConfigMapObject `yaml:"items,omitempty"`
}
cmd := exec.Command("sh", "-c", fmt.Sprintf("kubectl get configmaps -n %s -o yaml", namespace))
output, err := cmd.Output()
if err != nil {
return objs, err
}
var items configMapItems
err = yaml.Unmarshal(output, &items)
if err != nil {
return objs, err
}
if items.Items == nil {
// Possible single-value query.
var obj ConfigMapObject
err = yaml.Unmarshal(output, &obj)
if err != nil {
return objs, err
}
objs = append(objs, obj)
} else {
for _, item := range items.Items {
objs = append(objs, item)
}
}
return objs, err
}