|
1 | 1 | # Reference Documentation
|
2 | 2 |
|
| 3 | +The implementation generalizes and extends [`DependentResource`](https://javaoperatorsdk.io/docs/dependent-resources) |
| 4 | +and [`Workflow`](https://javaoperatorsdk.io/docs/workflows) features |
| 5 | +of [Java Operator SDK](https://github.com/operator-framework/java-operator-sdk) and more. |
| 6 | +Although it is limited only to Kubernetes resources it makes it very easy to use in language-independent |
| 7 | +(DependentResources in JOSDK are also covering external resources) way. |
| 8 | + |
| 9 | +## [Glue resource](https://github.com/csviri/resource-glue-operator/releases/latest/download/glues.io.csviri.operator.resourceglue-v1.yml) |
| 10 | + |
| 11 | +`Glue` is the heart of the operator. Note that `GlueOperator` controller just creates a new `Glue` with a related resource, |
| 12 | +for each parent custom resource. `Glue` defines `resources` (sometimes referred to as managed resources) and `related resources`: |
| 13 | + |
| 14 | +### Managed resources |
| 15 | + |
| 16 | +#### Attributes |
| 17 | + |
| 18 | +The `resources` section is a list of resources to be reconciled. It has several attributes: |
| 19 | + |
| 20 | +- **`name`** - is a mandatory attribute. The resource is referenced by this name from other places, typically other resource templates and `JSCondition`. |
| 21 | + If it is used in a `JSCondition` the `name` must be a valid JavaScript variable name. |
| 22 | +- **`resource`** - is the desired state of the resource applied by default using Server Side Apply. The resource is templated using |
| 23 | + [Qute Templating Engine](https://quarkus.io/guides/qute-reference), other resources can be referenced from the templates, see below. |
| 24 | + There is a restriction, that the managed resource is namespaced, and the namespace is always the same as the namespace of the `Glue` |
| 25 | + (and/or parent for `GlueOperator`), so the `namespace` field in resource **metadata should not be specified**. |
| 26 | +- **`dependsOn`** - is a list of names of other managed resources (not related resources). The resource is not reconciled until all the resources |
| 27 | + which it depends on are not reconciled and ready (if there is a `readyPostCondition` present). |
| 28 | + Note that during the cleanup phase (when a `Glue` is deleted) resources are cleaned up in reverse order. |
| 29 | +- **`condition`** - a condition to specify if the resource should be there or not, thus even if the condition is evaluated to be `true` |
| 30 | + and the resource is created, if one of the following reconciliations the condition is evaluated to `false` the resource is deleted. |
| 31 | + (Same as `reconcilePrecondition` in Java Operator SDK) |
| 32 | +- **`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 | + can proceed in reconciliation. |
| 34 | + |
| 35 | +#### Reconciliation |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +#### Referencing Other Resources |
| 40 | + |
| 41 | +#### Conditions |
| 42 | + |
| 43 | + |
| 44 | +### Related Resources |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +## [GlueOperator resource](https://github.com/csviri/resource-glue-operator/releases/latest/download/glueoperators.io.csviri.operator.resourceglue-v1.yml) |
| 49 | + |
3 | 50 | ## Deployment
|
4 | 51 |
|
5 |
| -### Deployment Modes |
| 52 | +Implementation is using [Quarkus Operator SDK (QOSDK)](https://github.com/quarkiverse/quarkus-operator-sdk), |
| 53 | +the default [configuration options](https://docs.quarkiverse.io/quarkus-operator-sdk/dev/includes/quarkus-operator-sdk.html) |
| 54 | +defined by QOSDK can be overridden using environment variables. |
| 55 | + |
| 56 | +With every release, there are Kubernetes resources provided to make an initial deployment very simple. |
| 57 | +See `kubernetes.yml` in [release assets](https://github.com/csviri/resource-glue-operator/releases). |
| 58 | +While we will provide more options, users are encouraged to enhance/adjust this for their purposes. |
| 59 | + |
| 60 | +Since the project is a meta-controller, it needs to have access rights to all the resources it manages. |
| 61 | +When creating specialized roles for a deployment, roles should contain the union of required access rights |
| 62 | +for all the managed resource types, specifically: `["list", "watch", "create", "patch", "delete"]` |
| 63 | +and `["list", "watch"]` for related resources. |
| 64 | + |
| 65 | +The project is mainly tested with cluster-scoped deployment, however, QOSDK namespace-scoped deployments are also supported. |
| 66 | + |
| 67 | +See also the upcoming deployment modes/options: [sharding with label selectors](https://github.com/csviri/resource-glue-operator/issues/50), |
| 68 | +[watching only one custom resources type](https://github.com/csviri/resource-glue-operator/issues/54) |
| 69 | + |
| 70 | +## Implementation details and performance |
6 | 71 |
|
7 |
| -## Glue Resource |
| 72 | +Informers are used optimally, in terms of that, for every resource type only one informer is registered in the background. Event there are more `Glue` or `GlueOperator` |
| 73 | +resources containing the same resource type. |
8 | 74 |
|
9 |
| -## GlueOperator Resource |
| 75 | +The templating and some of the Javascript condition is probably the most time-consuming and resource-intensive part which will |
| 76 | +be continuously improved in the follow-up releases. |
10 | 77 |
|
11 |
| -# Current Limitations |
| 78 | +## Current Limitations |
12 | 79 |
|
13 | 80 | Note that none of the limitations are unsolvable, and will be continuously removed in the coming releases.
|
14 | 81 |
|
15 | 82 | 1. Child resources and related resources are always namespace scoped resources, and in the same namespace as the
|
16 |
| - primary resource (`Glue` or the parent in case of `GlueOperator`) |
| 83 | + primary resource (`Glue` or the parent in the case of `GlueOperator`) |
17 | 84 |
|
18 |
| -2.~~Related resource changes are not triggering the reconciliation. |
19 |
| -Due to a bug in fabric8 client, after that is fixed, this is trivial to fix too: |
20 |
| -https://github.com/fabric8io/kubernetes-client/issues/5729~~ |
| 85 | +2. ~~Related resource changes are not triggering the reconciliation. |
| 86 | + Due to a bug in fabric8 client, after that is fixed, this is trivial to fix too: |
| 87 | + https://github.com/fabric8io/kubernetes-client/issues/5729~~ |
21 | 88 |
|
22 | 89 | ## Related Documents
|
23 | 90 |
|
|
0 commit comments