in gke-deploy/core/resource/application.go [106:129]
func convertApplicationToMap(app *applicationsv1beta1.Application) (map[string]interface{}, error) {
asMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(app)
if err != nil {
return nil, fmt.Errorf("failed to convert to unstructured")
}
// The resulting map will have null/empty values for metadata.creationTimestamp and status.
// We remove these from the map to make sure they are not included in the output YAML.
metadata, ok := asMap["metadata"]
if ok {
metadataMap, ok := metadata.(map[string]interface{})
if ok {
_, ok := metadataMap["creationTimestamp"]
if ok {
delete(metadataMap, "creationTimestamp")
}
}
}
_, ok = asMap["status"]
if ok {
delete(asMap, "status")
}
return asMap, nil
}