Skip to content

Commit

Permalink
additional IT
Browse files Browse the repository at this point in the history
Signed-off-by: Attila Mészáros <csviri@gmail.com>
  • Loading branch information
csviri committed May 2, 2024
1 parent 14df0d2 commit d959f27
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ See sample usage within `Glue` [here](https://github.com/csviri/kubernetes-glue-
The following attributes can be defined for a related resource:

- **`name`** - same as for child resource, unique identifier, used to reference the resource.
- **`clusterScoped`** - if the related resource is cluster scoped. Default is `false`.
- **`apiVersion`** - Kubernetes resource API Version of the resource
- **`kind`** - Kubernetes kind property of the resource
- **`resourceNames`** - list of string of the resource names within the same namespace as `Glue`.
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/io/csviri/operator/glue/GlueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,19 @@ void relatedResourceFromDifferentNamespace() {

@Test
void clusterScopedRelatedResource() {
var glue = create(TestUtils.loadGlue("/glue/ClusterScopedRelatedResource.yaml"));

await().untilAsserted(() -> {
var cm = get(ConfigMap.class, "configmap1");
assertThat(cm).isNotNull();
assertThat(cm.getData()).containsEntry("phase", "Active");
});

delete(glue);
await().timeout(TestUtils.GC_WAIT_TIMEOUT).untilAsserted(() -> {
var cm = get(ConfigMap.class, "configmap1");
assertThat(cm).isNull();
});
}

private List<Glue> testWorkflowList(int num) {
Expand Down
22 changes: 22 additions & 0 deletions src/test/resources/glue/ClusterScopedRelatedResource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: io.csviri.operator.glue/v1beta1
kind: Glue
metadata:
name: "testglue"
spec:
childResources:
- name: configMap
resource:
apiVersion: v1
kind: ConfigMap
metadata:
name: "configmap1"
data:
phase: "{related.status.phase}"
relatedResources:
- name: related
apiVersion: v1
kind: Namespace
clusterScoped: true
resourceNames: ["default"]


0 comments on commit d959f27

Please sign in to comment.