You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference.md
+39-2Lines changed: 39 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,8 @@ for each parent custom resource. `Glue` defines `resources` (sometimes referred
17
17
18
18
The `resources` section is a list of resources to be reconciled. It has several attributes:
19
19
20
-
-**`name`** - is a mandatory attribute. The resource is referenced by this name from other places, typically other resource templates and `JSCondition`.
20
+
-**`name`** - is a mandatory unique (unique also regarding related resources) attribute.
21
+
The resource is referenced by this name from other places, typically other resource templates and `JSCondition`.
21
22
If it is used in a `JSCondition` the `name` must be a valid JavaScript variable name.
22
23
-**`resource`** - is the desired state of the resource applied by default using Server Side Apply. The resource is templated using
23
24
[qute templating engine](https://quarkus.io/guides/qute-reference), other resources can be referenced from the templates, see below.
@@ -32,11 +33,41 @@ The `resources` section is a list of resources to be reconciled. It has several
32
33
-**`readyPostCondition`** - condition to check if the resource is considered to be ready. If a resource is ready all the resources, which depend on it
33
34
can proceed in reconciliation.
34
35
36
+
#### Built-in conditions
37
+
38
+
At the moment there are two types of built-in conditions provided:
39
+
40
+
-**`ReadyCondition`** - check if a resource is up and running. Use it only as a `readyPostCondition`. See sample usage [here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/sample/mutation/mutation.glue.yaml#L24-L25).
41
+
-**`JSCondition`** - a generic condition, that allows writing conditions in JavaScript. As input, all the resources are available which
42
+
are either managed or related. The script should return a boolean value.
43
+
See accessing the related resource in [WebPage sample](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/sample/webpage/webpage.operator.yaml#L62-L64),
44
+
and cross-referencing resources [here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglue/TwoResourcesAndCondition.yaml#L23-L28).
45
+
35
46
### Related resources
36
47
48
+
Related resources are resources that are not managed (not created, updated, or deleted) during reconciliation, but serve as an input for it.
49
+
See sample usage within `Glue`[here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglue/RelatedResourceSimpleWithCondition.yaml)
50
+
The following attributes can be defined for a related resource:
51
+
52
+
-**`name`** - same as for managed resource, unique identifier, used to reference the resource.
53
+
-**`apiVersion`** - Kubernetes resource API Version of the resource
54
+
-**`kind`** - Kubernetes kind property of the resource
55
+
-**`resourceNames`** - list of string of the resource names within the same namespace as `Glue`.
56
+
37
57
### Referencing other resources
38
58
39
-
### Built-in conditions
59
+
Both in `JSCondition` and resource templates other resources can be referenced by the name.
60
+
61
+
If there are more `resourceNames` specified for a related resource, the resource is referenced in a form
62
+
`[related resource name]#[resource name]`. See sample [here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglue/MultiNameRelatedResource.yaml).
63
+
64
+
When a resource `B` references another resource `A`, resource `A` will be guaranteed to be in the cache - especially for initial reconciliation when the resource is created -
65
+
only if `B` depends on `A` on it. This is natural, in other words, after reconciliation up-to-date version of the resource is guaranteed to be in the cache after reconciliation.
66
+
See sample resource cross-referencing [here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglue/CrossReferenceResource.yaml).
67
+
68
+
The metadata of `Glue` can be referenced under `glueMetadata`, see sample [here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglue/TemplateForConcurrency.yaml#L12-L12)
69
+
70
+
In addition to that in `GlueOperator` the **`parent`** attribute can be used to reference the parent resource on which behalf the resources are created. See sample [here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglueoperator/Templating.yaml).
40
71
41
72
### Reconciliation notes
42
73
@@ -49,6 +80,12 @@ The `DependentResource` implementation of JOSDK makes all kinds of optimizations
The specs of `GlueOperator` are almost identical to `Glue`, it just adds one additional attribute **`parent`**,
84
+
which has two sub-attributes: **`apiVersion`** and **`kind`**. This structure specifies the resource
85
+
types - usually but not necessarily custom resources - watched.
86
+
87
+
See minimal `GlueOperator`[here](https://github.com/csviri/resource-workflow-operator/blob/main/src/test/resources/resourceglueoperator/Templating.yaml).
88
+
52
89
## Deployment
53
90
54
91
Implementation is using [Quarkus Operator SDK (QOSDK)](https://github.com/quarkiverse/quarkus-operator-sdk),
0 commit comments