core/src/main/java/io/fabric8/maven/core/util/kubernetes/KubernetesResourceUtil.java
public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions,
                                          File file, String appName) throws IOException {
        Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName);
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.convertValue(fragment, HasMetadata.class);
        } catch (ClassCastException exp) {
            throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage()));
        }
    }
public static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions,
                                          File file, String appName) throws IOException {
        Map<String,Object> fragment = readAndEnrichFragment(platformMode, apiVersions, file, appName);
        ObjectMapper mapper = new ObjectMapper();
        try {
            return mapper.convertValue(fragment, HasMetadata.class);
        } catch (ClassCastException exp) {
            throw new IllegalArgumentException(String.format("Resource fragment %s has an invalid syntax (%s)", file.getPath(), exp.getMessage()));
        }
    }
Read a Kubernetes resource fragment and add meta information extracted from the filename
to the resource descriptor. I.e. the following elements are added if not provided in the fragment:

<ul>
<li>name - Name of the resource added to metadata</li>
<li>kind - Resource's kind</li>
<li>apiVersion - API version (given as parameter to this method)</li>
</ul>


@param apiVersions the API versions to add if not given.
@param file file to read, whose name must match {@link #FILENAME_PATTERN}.  @return map holding the fragment
@param appName resource name specifying resources belonging to this application