Skip to content

Commit 1736095

Browse files
committed
docs & test fix
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 38d3e30 commit 1736095

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ In other words, it also allows you to write **workflows** over resources in a **
1717

1818
## Contact Us
1919

20-
Either in the discussion section here on GitHub or at [Kubernetes Slack Operator Channel](https://kubernetes.slack.com/archives/CAW0GV7A5).
20+
Either in the discussion section here on GitHub or at [Kubernetes Slack Operator Channel](https://kubernetes.slack.com/archives/CAW0GV7A5). While
21+
in "object" form only placeholder substitutions are possible, in string template you can use all the
22+
features of qute.
2123

2224
## Quick Introduction
2325

@@ -61,6 +63,8 @@ spec:
6163
parent:
6264
apiVersion: glueoperator.sample/v1 # watches all the custom resource of type WebPage
6365
kind: WebPage
66+
status: # update the status of the custom resource at the end of reconciliation
67+
observedGeneration: "{parent.metadata.generation}"
6468
childResources:
6569
- name: htmlconfigmap
6670
resource:

docs/reference.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ of [Java Operator SDK](https://github.com/operator-framework/java-operator-sdk)
66
Although it is limited only to Kubernetes resources it makes it very easy to use in language-independent
77
(DependentResources in JOSDK are also covering external resources) way.
88

9+
## Generic Notes
10+
11+
- All templates (both object and string based) uses [Qute templating engine](https://quarkus.io/guides/qute-reference).
12+
913
## [Glue resource](https://github.com/java-operator-sdk/kubernetes-glue-operator/releases/latest/download/glues.glue-v1.yml)
1014

1115
`Glue` is the heart of the operator. Note that `GlueOperator` controller just creates a new `Glue` with a related resource,
@@ -57,6 +61,9 @@ The following attributes can be defined for a related resource:
5761
- **`apiVersion`** - Kubernetes resource API Version of the resource
5862
- **`kind`** - Kubernetes kind property of the resource
5963
- **`resourceNames`** - list of string of the resource names within the same namespace as `Glue`.
64+
- **`statusPatch`** - template object used to update status of the related resource at the end of the reconciliation. See [sample](https://github.com/java-operator-sdk/kubernetes-glue-operator/blob/main/src/test/resources/glue/PatchRelatedStatus.yaml#L20-L21).
65+
All the available resources (child, related) are provided.
66+
- **`statusPatchTemplate`** - same as `statusPatch` just as a string template. See [sample](https://github.com/java-operator-sdk/kubernetes-glue-operator/blob/main/src/test/resources/glue/PatchRelatedStatusWithTemplate.yaml#L20-L21).
6067

6168
### Referencing other resources
6269

@@ -91,6 +98,9 @@ The specs of `GlueOperator` are almost identical to `Glue`, it just adds some ad
9198
- **`apiVersion`** and **`kind`** - of the target custom resources.
9299
- **`labelSelector`** - optional label selector for the target resources.
93100
- **`clusterScoped`** - optional boolean value, if the parent resource is cluster scoped. Default is `false`.
101+
- **`status`** - template object to update status of the related resource at the end of the reconciliation.
102+
All the available resources (parent, child, related) are available.
103+
- **`statusTemplate`** - same as `status` just as a string template.
94104
- **`glueMetadata`** - optionally, you can customize the `Glue` resource created for each parent resource.
95105
This is especially important when the parent is a cluster scoped resource - in that case it is mandatory to set.
96106
Using this you can specify the **`name`** and **`namespace`** of the created `Glue`.

src/test/java/io/javaoperatorsdk/operator/glue/sample/webpage/WebPageE2E.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ void testWebPageCRUDOperations() {
5959
assertThat(ingress).isNotNull();
6060
});
6161

62+
var wp = client.resources(WebPage.class).withName("webpage1").get();
63+
assertThat(wp.getStatus().getObservedGeneration()).isNotNull();
64+
6265
client.resource(createdWebPage).delete();
6366

6467
await().timeout(TestUtils.GC_WAIT_TIMEOUT).untilAsserted(() -> {
65-
var wp = client.resources(WebPage.class).withName("webpage1").get();
6668
var deployment =
6769
client.resources(Deployment.class).withName(webPage.getMetadata().getName()).get();
6870
var configMap =
@@ -74,7 +76,7 @@ void testWebPageCRUDOperations() {
7476
assertThat(configMap).isNull();
7577
assertThat(service).isNull();
7678
assertThat(ingress).isNull();
77-
assertThat(wp.getStatus().getObservedGeneration()).isNotNull();
79+
7880
});
7981
}
8082

0 commit comments

Comments
 (0)