-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure manually defined CRDs are considered before generated ones (
#2662) * fix: ensure manually defined CRDs are considered before generated ones Fixes #2658 Signed-off-by: Chris Laprun <claprun@redhat.com> * fix: output more details in logs on errors / failures Signed-off-by: Chris Laprun <claprun@redhat.com> * wip: add more logging Signed-off-by: Chris Laprun <claprun@redhat.com> * fix: add missing file Signed-off-by: Chris Laprun <claprun@redhat.com> * fix: make sure generated CRDs are applied Signed-off-by: Chris Laprun <claprun@redhat.com> --------- Signed-off-by: Chris Laprun <claprun@redhat.com>
- Loading branch information
Showing
9 changed files
with
201 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: externals.crd.example | ||
spec: | ||
group: crd.example | ||
names: | ||
kind: External | ||
singular: external | ||
plural: externals | ||
scope: Namespaced | ||
versions: | ||
- name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
foo: | ||
type: "string" | ||
type: "object" | ||
served: true | ||
storage: true |
26 changes: 26 additions & 0 deletions
26
...nit5/src/test/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtensionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.javaoperatorsdk.operator.junit; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.fabric8.kubernetes.client.KubernetesClientBuilder; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class LocallyRunOperatorExtensionTest { | ||
|
||
@Test | ||
void getAdditionalCRDsFromFiles() { | ||
System.out.println(Path.of("").toAbsolutePath()); | ||
System.out.println(Path.of("src/test/crd/test.crd").toAbsolutePath()); | ||
final var crds = LocallyRunOperatorExtension.getAdditionalCRDsFromFiles( | ||
List.of("src/test/resources/crd/test.crd", "src/test/crd/test.crd"), | ||
new KubernetesClientBuilder().build()); | ||
assertNotNull(crds); | ||
assertEquals(2, crds.size()); | ||
assertEquals("src/test/crd/test.crd", crds.get("externals.crd.example")); | ||
assertEquals("src/test/resources/crd/test.crd", crds.get("tests.crd.example")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: tests.crd.example | ||
spec: | ||
group: crd.example | ||
names: | ||
kind: Test | ||
singular: test | ||
plural: tests | ||
scope: Namespaced | ||
versions: | ||
- name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
type: "object" | ||
served: true | ||
storage: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Configuration name="TestConfig" status="WARN"> | ||
<Appenders> | ||
<Console name="Console" target="SYSTEM_OUT"> | ||
<PatternLayout pattern="%d %threadId %-30c{1.} [%-5level] %msg%n%throwable"/> | ||
</Console> | ||
</Appenders> | ||
<Loggers> | ||
<Logger level="debug" name="io.javaoperatorsdk.operator" additivity="false"> | ||
<AppenderRef ref="Console"/> | ||
</Logger> | ||
<Root level="info"> | ||
<AppenderRef ref="Console"/> | ||
</Root> | ||
</Loggers> | ||
</Configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: externals.crd.example | ||
spec: | ||
group: crd.example | ||
names: | ||
kind: External | ||
singular: external | ||
plural: externals | ||
scope: Namespaced | ||
versions: | ||
- name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
properties: | ||
type: "object" | ||
served: true | ||
storage: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.