diff --git a/extended/src/main/java/io/kubernetes/client/extended/kubectl/KubectlCreate.java b/extended/src/main/java/io/kubernetes/client/extended/kubectl/KubectlCreate.java index a6b26f9fc3..d8d928c923 100644 --- a/extended/src/main/java/io/kubernetes/client/extended/kubectl/KubectlCreate.java +++ b/extended/src/main/java/io/kubernetes/client/extended/kubectl/KubectlCreate.java @@ -119,7 +119,8 @@ public static Object loadAndSubmitResource(Reader content) throws Exception { Set resources = discovery.findAll(); Optional apiResource = resources.stream() .filter(r -> r.getKind().equalsIgnoreCase(kind) - && r.getVersions().stream().anyMatch(v -> v.equalsIgnoreCase(apiVersion))) + && r.getVersions().stream().anyMatch(v -> v.equalsIgnoreCase(apiVersion)) + && (r.getGroup() == null || r.getGroup().equalsIgnoreCase((String) yamlMap.get("group")))) .findFirst(); // Check if the resource kind was found