Skip to content

Commit c6bce60

Browse files
committed
update documentation
1 parent 228eb0e commit c6bce60

File tree

11 files changed

+143
-144
lines changed

11 files changed

+143
-144
lines changed

pkg/component/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
// Component is the central interface that component operators have to implement.
1616
// Besides being a conroller-runtime client.Object, the implementing type has to expose accessor
17-
// methods for the deployment's target namespace and name, and for the components's spec and status.
17+
// methods for the deployment's target namespace and name, and for the components's spec and status,
1818
// via methods GetSpec() and GetStatus().
1919
type Component interface {
2020
client.Object
@@ -26,10 +26,10 @@ type Component interface {
2626
// This is the value that will be passed to Generator.Generator() as name.
2727
GetDeploymentName() string
2828
// Return a read-only accessor to the component's spec.
29-
// Which, as a consequence, obviously has to implement the types.Unstructurable interface.
29+
// The returned value has to implement the types.Unstructurable interface.
3030
GetSpec() types.Unstructurable
3131
// Return a read-write (usually a pointer) accessor to the component's status,
32-
// resp. to the corresponding sub-struct if the status extends component.Status.
32+
// resp. to the corresponding substruct if the status extends component.Status.
3333
GetStatus() *Status
3434
}
3535

website/content/en/_index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
{{< blocks/cover title="component-operator-runtime" image_anchor="top" height="full" color="blue" >}}
88
<div class="mx-auto">
9-
<span class="font-weight-bold">A Framework for Kubernetes Component Operators</span><br><br><br>
10-
<a class="btn btn-lg btn-primary mr-3 mb-4" href="{{< relref "/docs" >}}">
11-
Documentation <i class="fas fa-arrow-alt-circle-right ml-2"></i>
12-
</a>
13-
<a class="btn btn-lg btn-secondary mr-3 mb-4" href="https://github.com/sap/component-operator-runtime">
14-
Source Repository <i class="fab fa-github ml-2 "></i>
15-
</a>
9+
<span class="font-weight-bold">A Kubernetes Component Operator Framework</span><br><br><br>
10+
<a class="btn btn-lg btn-primary mr-3 mb-4" href="{{< relref "/docs" >}}">
11+
Documentation <i class="fas fa-arrow-alt-circle-right ml-2"></i>
12+
</a>
13+
<a class="btn btn-lg btn-secondary mr-3 mb-4" href="https://github.com/sap/component-operator-runtime">
14+
Source Repository <i class="fab fa-github ml-2 "></i>
15+
</a>
1616
</div>
1717
{{< /blocks/cover >}}

website/content/en/docs/_index.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ on such components that are or contain Kubernetes operators themselves.
1212
It can therefore serve as a starting point to develop [SAP Kyma module operators](https://github.com/kyma-project/template-operator),
1313
but can also be used independently of Kyma.
1414

15-
Regarding its mission statement, this project could be compared with the [Operator Lifecycle Manager (OLM)](https://olm.operatorframework.io/).
15+
Regarding its mission statement, this project can be compared with the [Operator Lifecycle Manager (OLM)](https://olm.operatorframework.io/).
1616
However, other than OLM, which follows a generic modelling approach, component-operator-runtime encourages the development of opinionated,
1717
concretely modeled, component-specific operators. This makes the resulting logic much more explicit, and also allows to react better on
1818
specific lifecycle needs of the managed component.
1919

2020
Of course, components might equally be managed by using generic Kustomization or Helm chart deployers (such as provided by [ArgoCD](https://argoproj.github.io/) or [FluxCD](https://fluxcd.io/flux/)).
2121
However, these tools have certain weaknesses when it is about to deploy other operators, i.e. components which extend the Kubernetes API,
22-
e.g. by adding custom resource definitions, aggregated API servers, according controllers, and admission webhooks.
23-
For example these generic controllers tend to produce race conditions or dead locks upon first installation or deletion of the managed components.
22+
e.g. by adding custom resource definitions, aggregated API servers, according controllers, or admission webhooks.
23+
For example these generic solutions tend to produce race conditions or dead locks upon first installation or deletion of the managed components.
2424
This is where component-operator-runtime tries to act in a smarter and more robust way.
2525

26-
This website provides the full technical documentation for the project, and can be
27-
used as a reference; if you feel that there's anything missing, please let us know
28-
or [raise a PR](https://github.com/sap/component-operator-runtime/pulls) to add it.
26+
If you want to report bugs, or request new features or enhancements, please [open an issue](https://github.com/sap/component-operator-runtime/issues)
27+
or [raise a pull request](https://github.com/sap/component-operator-runtime/pulls).

website/content/en/docs/concepts/_index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ Usually (but not necessarily) the managed component contains one or multiple oth
1212

1313
Other than existing tools addressing this case, such as the [Operator Lifecycle Manager (OLM)](https://olm.operatorframework.io/),
1414
this project proposes a more opinionated programming model. That is, the idea is to represent the managed component by an own custom resource type,
15-
which (usually) would be instantiated only once in the cluster. We feel encouraged to go this way, as many community projects (e.g. Istio), are following the same pattern.
16-
The component-operator-runtime framework now provides a generic controller, implemented as [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) reonciler, to facilitate the development of the according controller logic for the custom resource type modeling the component.
15+
which (usually) will be instantiated only once in the cluster. We feel encouraged to go this way, as many community projects are following the pattern of providing dedicated lifecycle operators.
16+
17+
The component-operator-runtime framework plugs into the [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) SDK by implementing the controller-runtime `Reconciler` interface.

website/content/en/docs/concepts/dependents.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To be more precise, assume for example, that the managed component contains some
1717
Then, if the component resource would be deleted, none of the component's dependent objects would be touched as long as there exist foreign
1818
instances of the managed custom resource definition in the cluster.
1919

20-
In some special situations however, it is desirable to have more control on the lifecycle of the dependent objects.
20+
In some special situations, it is desirable to have even more control on the lifecycle of the dependent objects.
2121
To support such cases, the `Generator` implementation can set the following annotations in the manifests of the dependents:
2222
- `mycomponent-operator.mydomain.io/reconcile-policy`: defines how the object is reconciled; can be one of:
2323
- `on-object-change` (which is the default): the object will be reconciled whenever its generated manifest changes
@@ -26,8 +26,8 @@ To support such cases, the `Generator` implementation can set the following anno
2626
- `mycomponent-operator.mydomain.io/update-policy`: defines how the object (if existing) is updated; can be one of:
2727
- `default` (which is the default): a regular update (i.e. PUT) call will be made to the Kubernetes API server
2828
- `recreate`: if the object would be updated, it will be deleted and recreated instead
29-
- `mycomponent-operator.mydomain.io/order`: the order at which this object will be reconciled; dependents will be reconciled order by order; that is, objects of the same order will be deployed in the canonical order, and the controller will only proceed to the next order if all objects of previous orders are ready; specified orders can be negative or positive numbers between -32768 and 32767, objects with no explicit order set are treated as order 0.
30-
- `mycomponent-operator.mydomain.io/purge-order`: (optional) the order after which this object will be purged
29+
- `mycomponent-operator.mydomain.io/order`: the order at which this object will be reconciled; dependents will be reconciled order by order; that is, objects of the same order will be deployed in the canonical order, and the controller will only proceed to the next order if all objects of previous orders are ready; specified orders can be negative or positive numbers between -32768 and 32767, objects with no explicit order set are treated as if they would specify order 0.
30+
- `mycomponent-operator.mydomain.io/purge-order`: (optional) the order by which this object will be purged
3131

3232
Note that, in the above paragraph, `mycomponent-operator.mydomain.io` has to be replaced with whatever was passed as `name` when calling `NewReconciler()`.
3333

website/content/en/docs/concepts/reconciler.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ description: >
77
Reconciliation logic for dependent objects
88
---
99

10-
Dependent objects are - by definition - the resources returned by the `Generate()` method of the provided resource generator.
10+
Dependent objects are - by definition - the resources returned by the `Generate()` method of the used resource generator.
1111
Whenever a component resource (that is, an instance of the component's custom resource type) is created, udpated, or deleted,
1212
the set of dependent object probably changes, and the cluster state has to be synchronized with that new declared state.
1313

14-
This happens in the reconciler which is instantiated by calling the following constructor:
14+
This is the job of the reconciler which is instantiated by calling the following constructor:
1515

1616
```go
1717
package component
@@ -20,27 +20,31 @@ func NewReconciler[T Component](
2020
name string,
2121
client client.Client,
2222
discoveryClient discovery.DiscoveryInterface,
23-
recorder record.EventRecorder,
23+
eventRecorder record.EventRecorder,
2424
scheme *runtime.Scheme,
2525
resourceGenerator manifests.Generator
2626
) *Reconciler[T]
2727
```
2828

29-
The passed type parameter `T Component` would be the concrete runtime type of the custom resource type. Furthermore,
29+
The passed type parameter `T Component` is the concrete runtime type of the component's custom resource type. Furthermore,
3030
- `name` is supposed to be a unique name (typically a DNS name) uniquely identifying this component operator in the cluster; ìt will be used in annotations, labels, for leader election, ...
31-
- `client` is a controller-runtime `client.Client`, having all the needed privileges to manage the dependent objects (probably it will have cluster-admin rights); the `client` must bypass informer caches for the following types:
31+
- `client`, `discoveryClient`, `eventRecorder` and `scheme` are deprecated and will be removed in future releases; they can be passed as `nil`
32+
- `resourceGenerator` is an implementation of the `Generator` interface, describing how the dependent objects are rendered from the component's spec.
33+
34+
The object returned by `NewReconciler` implements the controller-runtime `Reconciler` interface, and can therefore be used as a drop-in
35+
in kubebuilder managed projects. After creation, the reconciler has to be registered with the responsible controller-runtime manager instance by calling
36+
37+
```go
38+
func (r *Reconciler[T]) SetupWithManager(mgr ctrl.Manager) error
39+
```
40+
41+
The used manager `mgr` has to fulfill a few requirements:
42+
- its client must bypass informer caches for the following types:
3243
- the type `T` itself
3344
- the type `CustomResourceDefinition` from the `apiextensions.k8s.io/v1` group
3445
- the type `APIService` from the `apiregistration.k8s.io/v1` group
35-
- `discoveryClient` is a normal discovery client as provided by client-go
36-
- `recorder` is a standard event recorder
37-
- `scheme` is a `runtime.Scheme` which must recognize at least the following types:
46+
- its scheme must recognize at least the following types:
3847
- the types in the API group defined in this repository
3948
- the core group (`v1`)
4049
- group `apiextensions.k8s.io/v1`
41-
- group `apiregistration.k8s.io/v1`
42-
- all concrete (i.e. non-unstructured) types returned by the `Generate()` method of the passed resource generator
43-
- `resourceGenerator` is an implementation of the `Generator` interface, describing how the dependent objects are rendered from the component's spec.
44-
45-
The object returned by `NewReconciler` implements the controller-runtime `Reconciler` interface, and can therefore be used as a drop-in
46-
in kubebuilder managed projects.
50+
- group `apiregistration.k8s.io/v1`.

0 commit comments

Comments
 (0)