Skip to content

Commit

Permalink
using oc style resolving for openshift resources
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Apr 2, 2022
1 parent b3ae5a7 commit 0fb3068
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,13 @@ private void internalLoadFromJandex(ClassLoader classLoader) throws IOException
continue;
}
Class<? extends KubernetesResource> krClazz = (Class<? extends KubernetesResource>) clazz;
mappings.put(getKeyFromClass(krClazz), krClazz);
TypeKey keyFromClass = getKeyFromClass(krClazz);
mappings.put(keyFromClass, krClazz);

// oc behavior - allow resolving against just the version
if (keyFromClass.apiGroup != null && keyFromClass.apiGroup.endsWith(".openshift.io")) {
mappings.putIfAbsent(new TypeKey(keyFromClass.kind, null, keyFromClass.version), krClazz);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void testResourceGetFromLoadWhenSingleDocumentsWithoutDelimiter() {
assertNotNull(result);
assertEquals(1, result.size());
HasMetadata deploymentResource = result.get(0);
assertEquals("template.openshift.io/v1", deploymentResource.getApiVersion());
assertEquals("v1", deploymentResource.getApiVersion());
assertEquals("Pod", deploymentResource.getKind());
assertEquals("example-pod", deploymentResource.getMetadata().getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

apiVersion: template.openshift.io/v1
apiVersion: v1
kind: Template
metadata:
name: example-template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

---
apiVersion: template.openshift.io/v1
apiVersion: v1
kind: Template
metadata:
name: foo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

---
apiVersion: template.openshift.io/v1
apiVersion: v1
kind: Template
metadata:
name: foo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

apiVersion: template.openshift.io/v1
apiVersion: v1
kind: Template
metadata:
name: example-template
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-tests/src/test/resources/test-scc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

---
kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
apiVersion: v1
metadata:
name: scc-get
allowPrivilegedContainer: true
Expand Down
2 changes: 1 addition & 1 deletion kubernetes-tests/src/test/resources/test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

---
kind: "Template"
apiVersion: "template.openshift.io/v1"
apiVersion: "v1"
metadata:
annotations:
iconClass: "icon-jboss"
Expand Down

0 comments on commit 0fb3068

Please sign in to comment.