Skip to content

Commit ebbc1fe

Browse files
committed
Update reference.md
1 parent ff1c52d commit ebbc1fe

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

docs/reference.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ for each parent custom resource. `Glue` defines `resources` (sometimes referred
1717

1818
The `resources` section is a list of resources to be reconciled. It has several attributes:
1919

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`.
2122
If it is used in a `JSCondition` the `name` must be a valid JavaScript variable name.
2223
- **`resource`** - is the desired state of the resource applied by default using Server Side Apply. The resource is templated using
2324
[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
3233
- **`readyPostCondition`** - condition to check if the resource is considered to be ready. If a resource is ready all the resources, which depend on it
3334
can proceed in reconciliation.
3435

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+
3546
### Related resources
3647

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+
3757
### Referencing other resources
3858

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).
4071

4172
### Reconciliation notes
4273

@@ -49,6 +80,12 @@ The `DependentResource` implementation of JOSDK makes all kinds of optimizations
4980

5081
## [GlueOperator resource](https://github.com/csviri/resource-glue-operator/releases/latest/download/glueoperators.io.csviri.operator.resourceglue-v1.yml)
5182

83+
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+
5289
## Deployment
5390

5491
Implementation is using [Quarkus Operator SDK (QOSDK)](https://github.com/quarkiverse/quarkus-operator-sdk),

0 commit comments

Comments
 (0)